[R-sig-finance] tips and tricks for rolling regressions?

Patrick Burns patrick at burns-stat.com
Thu Aug 26 13:18:56 CEST 2004


At least some investigation -- if not absolute worry -- is probably
in order.  GARCH can confuse optimizers, so it is entirely believable
that you are not getting optimal results.

Though it doesn't make sense to me, some times changing the scale
of the data can make the optimizer behave better.  Proprietary code
that I wrote liked to have the returns in percent rather than fractional
form.

Patrick Burns

Burns Statistics
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Ajay Shah wrote:

>>#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.
>
>  
>



More information about the R-sig-finance mailing list