[R-sig-finance] tips and tricks for rolling regressions?
Gregor.gawron at rmf.ch
Gregor.gawron at rmf.ch
Thu Aug 26 09:06:02 CEST 2004
I don't get this messege. Maybe, a different sample lenght will help. In
fact, in my original code I am using a different data than the DAX. I
took DAX just for illustrative purposes since the data is available in
'tseries' package.
Gregor
-----Original Message-----
From: Ajay Shah [mailto:ajayshah at mayin.org]
Sent: Donnerstag, 26. August 2004 07:13
To: Gawron, Gregor (MI Switzerland)
Cc: t.khan at econ.bbk.ac.uk; r-sig-finance at stat.math.ethz.ch
Subject: Re: [R-sig-finance] tips and tricks for rolling regressions?
> #moving one-step-ahead GARCH(1,1)
> library(tseries)
>
> width<-1500 #the size of the sample window
>
> data(EuStockMarkets) #data taken from package 'tseries'
> X<- diff(log(EuStockMarkets))[,"DAX"]
>
> n<-length(X)
> from<-sapply((1:n)-width+1,function(x) max(x,1))
> to<-1:n
> all.elements<-apply(cbind(from,to),1,function(x) seq(x[1],x[2]))
> good.elements<-all.elements[width:length(all.elements)]
> better.elements<-as.data.frame(good.elements)
>
> #estimating GARCH(1,1) and extracting the fitted coefficients
> myfun<-function(i){
> out<-garch(X[better.elements[,i]])
> garchsum<-summary(out)[[2]][1:3]
> names(garchsum)<-NULL
> return(garchsum)
> }
>
> res<-sapply(1:length(better.elements),function(i) myfun(i))
>
> #adjusting the output
> RES<-matrix(unlist(res))
> dim(RES)<-dim(res)
> dimnames(RES)<-list(c("a0","a1","b1"),NULL)
> (RES<-t(RES))
When I run your code, I get lots and lots of
***** FALSE CONVERGENCE *****
error messages from the garch() function in the tseries library. Should
I be worried?
-ans.
--
Ajay Shah Consultant
ajayshah at mayin.org Department of Economic Affairs
http://www.mayin.org/ajayshah Ministry of Finance, New Delhi
Any information in this communication is confidential and ma...{{dropped}}
More information about the R-sig-finance
mailing list