[R] order.max specification problem in the ar.ols function

soham chakraborty soham_r at isical.ac.in
Tue Nov 27 11:36:09 CET 2012


Hello
I am facing a curious problem.I have a time series data with which i want to
fit auto-regressive  model of order p, where p runs from 1:9.I am using a
for loop which will fit an AR(p) model for each value of p using the
*ar.ols* function.
I am using the following code
for ( p in 1:9){
a=ar.ols (x=data.ts, order.max=p, demean=T, intercept=T)
}
Specifying the *order.max* to be p, it gives me a fitted AR model of order
exactly p, though it may not be the best model.
The code works fine except for p=4,5, in which cases it fits an AR (3) model
to the data.
I don't seem to understand what is the problem.Also is there any alternative
way by which i can fit an AR(p) model where p is specified by the user?
Any help in this matter will be of immense help.
Thank you.
Soham Chakraborty



--
View this message in context: http://r.789695.n4.nabble.com/order-max-specification-problem-in-the-ar-ols-function-tp4650942.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list