Hi,
I have simulated 100 time series from ARMA(1,1).
For each, I have fitted two AR models - one with AIC AR-order and the other
with 2*AIC AR-order. Later I am generating 99 bootstrap samples from each
model.
Here X is a 100*64 data matrix (where 64 is the size of each data series and
the resample).
When I fit the first model as follows, everything works perfectly.
for (i in 1:N){
.......
x.1<-ar(X[i,],order.max=25)
x.1model<-list(order=c(x.1$order,0,0),ar=x.1$ar)
x.1res<-x.1$resid[!is.na(x.1$resid)]
x.1res<-x.1res-mean(x.1res
x.1<-tsboot(x.1res,x.fun,R=99,l=4,sim="fixed",ran.gen=x.black,ran.args=list(ts=X
[i,],model=x.1model),n.sim=length(X[i,]))
.......
}
Next, for the second model:
for (i in 1:N){
........
x.1<-ar(X[i,],order.max=25)
p[i,]<-min(25,2*x.1$order)
x.2<-ar(X[i,],aic=F,order.max=p[i,])
x.2model<-list(order=c(x.2$order,0,0),ar=x.2$ar)
x.2res<-x.2$resid[!is.na(x.2$resid)]
x.2res<-x.2res-mean(x.2res)
x.2<-tsboot(x.2res,x.fun,R=99,l=4,sim="fixed",ran.gen=x.black,ran.args=list(ts=X
[i,],model=x.2model),n.sim=length(X[i,]))
.......
}
the for-loop terminates the program before going through all N values giving
the following error :
Error in .C("S_arimasim",: Could not invert cov: 18
Dumped
Error was while calling subroutine "S_arimasim"
Sometimes it goes over 90+ values (but <100) but most of the times it stops
quite early (ranging from N=5 to N=40) and I am totally at loss as to why this
happens. It looks like the problem is in 'arima.sim' and not in 'tsboot'.
Has anyone seen this problem before?
All suggestions and ideas are welcome!
Thanks,
Priya
|