[R] GARCH, installing tserise package

knulp knulp109 at gmail.com
Tue Feb 1 06:22:00 CET 2005


Hi, there,

First of all, I am not familar with the GARCH concept as well as R interface. 

I have three questions regarding GARCH (1,1).

First, I got tseries package from CRAN. Where exactly am I supposed to
install it?
In my case, I copies it to C:\Program Files\R\rw2001\library. What do
I need to do in order to actually install it?


Second, I am not sure if I've installed it properly, but I've added
"garch" function into my current R workspace. But, I got the following
error message.

> x.garch <- garch(x, order = c(1,1)) 
Error in .C("fit_garch", as.vector(x, mode = "double"), as.integer(n),  : 
        C function name not in DLL for package tseries

I was running the following GARCH (1,1) model.

> n <- 1100
> a <- c(0.01178, 0.003, 0.005)  # ARCH(1) coefficients, assuming the mean is constant!!
> e <- rnorm(n)
> x <- double(n)
> v <- double(n)
> v[1] <- a[1]/(1.0-a[2]-a[3]) 
> x[1] <- rnorm(1, sd = sqrt(v[1])) 
> v[1]
[1] 0.011875
> x[1]
[1] 0.1037611
> for(i in 2:n) { 
+     v[i] <- a[1]+a[2]*x[i-1]^2+a[3]*v[i-1] 
+     x[i] <- e[i]*sqrt(v[i]) 
+ } 
>
> x <- ts(x[101:1100]) 
>
> x.garch <- garch(x, order = c(1,1)) 

Third, as for setting 'n' and 'x <- ts(x[101, 1100])' 
What does 'n=1100' stand for? I mean, why is it 1100  in the above
example? Any why does 'x <- ts(x[101:1100]) ' start from 101 th to
1100? Does the function assume the 1100 periods? then, why does it
start from 101 for 'ts' function?

Sorry for the idiotic questions above, but they have driven me crazy.

Looking forward to seeing your kind, easy to understand help.
 
Knulp




More information about the R-help mailing list