[R] Loop Autoregression
Jonas Ulbrich
Jonas.Ulbrich at ruhr-uni-bochum.de
Sun Jun 1 13:51:01 CEST 2014
Hello everybody, I have to confess that I am relatively new to R.
My problem is the following one:
I have a data set of 500 values. For each value I wanna make prediction
of four steps ahead via autogregression. Because I have to repeat this
procedure on three other data sets I wanna make a loop. (Manual
calculation would take ages.)
My idea which does not work looks is as follows:
x<-NULL
for (i in 1:500){
x[i]<-predict(ar(y[i],order.max=1,method="yule-walker",intercept=TRUE,
n.used=500, n.ahead=4))
}
Doing this I only get an error request that the value of "order.maX"
needs to be smaller than "n.used". But this is the case. Isn't it?
Best Regards
More information about the R-help
mailing list