[R] look at the underlying source code

R. Michael Weylandt michael.weylandt at gmail.com
Sat May 19 07:50:27 CEST 2012


Unfortunately the task is slightly harder here -- ugarchsim calls a
network of S4 code that is a little hard to trace....

You can get started by typing

getMethod("ugarchsim", "uGARCHfit")

to see the first step which calls a variety of functions with names like

.sgarchsim

You'll have to read a line of code here that uses switch so it's a
little harder to follow if you've never used that construct before
than method dispatch or if/then might be.

It looks like these are not exported so you'll have to use

getAnywhere(.sgarchsim)

to start following those. It looks like that in turn calls .sgarchsim1
or .sgarchsim2 which are the end of the line and should help you out.

Hope this helps,
Michael

On Fri, May 18, 2012 at 2:16 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> Hello,
>
> There are two simple ways,
>
> 1. Type  the function name without parenthesis at an R prompt;
> 2. Download the source from CRAN or R-Forge, R is open source.
>
> Hope this helps,
>
> Rui Barradas
>
> jaimie villanueva wrote
>>
>> hi
>>
>> someone can show me how can i get the source code of a function. Is a S4
>> class or Method. (I'm not an expert in R environment)
>> Exactly, Function "ugarchsim" from library (rugarch).
>> I need to know (in detailed ) how the variance and  mean ecuation of a
>> arma/garch process are calculated.
>> With other packages like "fGarch" i used to invoked the function debug ()
>> and allows me to step into the functions but with ugarchsim i can't use
>> it.
>>
>> any suggestions are well received
>>
>> thanks
>>
>> Jamie
>>
>>       [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help@ mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/look-at-the-underlying-source-code-tp4630532p4630538.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list