Wojtek Slusarski
2005-Jun-03 22:51 UTC
[R] RE: GARCH (1 , 1), Hill estimator of alpha, Pareto estimator]
Ukech U. Kidi wrote:> dax<- diff(log(DAX_CAC$DAX[1:1865])) > m1<- garch(dax) > Error: couldn't find function "garch" > m1<- garch(dax[1:1865]) > Error: couldn't find function "garch" > m1<- garch(dax[1:1865])I am sorry, but I forgot to change the addres to r-help in the reply. Well, I am not sure, wheere do you want to get those data from, but if you are able to do that:> dax<- diff(log(DAX_CAC$DAX[1:1865]))Then it means, that you have managed to do that. The thing is, that garch function is in the tseries package and I haven't seen any call to it, so first try: library(tseries) and then: m1<- garch(dax) summary(m1) plot(m1) My scripts usually look like that: library(tseries) #import data from csv file with first row Open, High, Low, Close, Volume wig20 <- read.csv("wig20.txt", sep=";", dec=",") #multiply by 100, because sometimes it's easier to converge the model r <- 100*diff(log(wig20$CLOSE)) kpss.test(r) pp.test(r) acf(r) pacf(r) #if there is no significant autocorelation: y <- r - mean(r) fit <- garch(y, order = c(1,1)) summary(fit) plot(fit) #If you need some particular results for further testing, then use: ch <- predict(fit, genuine=TRUE) e <- fit$residuals #end do what you want or draw any other result this way That's just the basic, but then you can improve it the way you want. If you have lot of models to estimate, I suggest using sink() and postscript(), for saving results, so after writing the code and sourcing that into R by source(), you can go and have a coffe and come back later to browse the results. BTW, check also rmetrics.org. There are also functions for garch modelling in fSeries. Best regards, Wojtek