Hi everyone,
I am trying to fit an arima model on a rolling window using rollapply.My aim is to plot a graph of the evolution of the coefficient, plot the error and the standard deviation.
well i encountered the following problems:
1) each window in the roll apply have different set of coeffcients: basically when i plot auto.arima()$coef[1] over time it could be ar1 or ma1 or anything.The reason i am doing this is that plotting the coefficient stability permits to judge the stability of coefficient and assess the accuracy of the model.
> getSymbols("ICICIBANK.NS");
> ICICIBANK.NS<-as.data.frame(ICICIBANK.NS)
> ICICIBANK.NS$returns<-c(NA,diff(log(ICICIBANK.NS$ICICIBANK.NS.Adjusted)))
> z<-ICICIBANK.NS$returns
> z<-na.omit(z)
> y<-rollapply(as.zoo(z),width=100,FUN=function(x) auto.arima(x)$coef[1])
basically i am trying here to have a look at the evolution of the first coefficient.but the model changes from one window to another.
Does anyone have an idea how solve this? or maybe some lead i can work on ?
2) when i do auto.arima to log returns i get an ARIMA(0,0,0) and when i dot it for raw raw prices i get ARIMA(3,1,3):
> getSymbols("ICICIBANK.NS");
[1] "ICICIBANK.NS"
> ICICIBANK.NS<-as.data.frame(ICICIBANK.NS)
> ICICIBANK.NS$returns<-c(NA,diff(log(ICICIBANK.NS$ICICIBANK.NS.Adjusted)))
> auto.arima(ICICIBANK.NS$returns)
Series: ICICIBANK.NS$returns
ARIMA(0,0,0) with zero mean
sigma^2 estimated as 0.003309: log likelihood=3042.76
AIC=-6083.51 AICc=-6083.51 BIC=-6077.86
> auto.arima(ICICIBANK.NS$ICICIBANK.NS.Adjusted)
Series: ICICIBANK.NS$ICICIBANK.NS.Adjusted
ARIMA(3,1,3) with drift
Coefficients:
ar1 ar2 ar3 ma1 ma2 ma3 drift
0.0741 -0.0998 0.5626 -0.0572 0.0662 -0.8633 0.1087
s.e. 0.0306 0.0323 0.0279 0.0192 0.0200 0.0159 0.0606
sigma^2 estimated as 77.62: log likelihood=-7610.48
AIC=15236.96 AICc=15237.02 BIC=15282.22
why would auto.arima() work with prices and not log returns ?
I am trying to fit an arima model on a rolling window using rollapply.My aim is to plot a graph of the evolution of the coefficient, plot the error and the standard deviation.
well i encountered the following problems:
1) each window in the roll apply have different set of coeffcients: basically when i plot auto.arima()$coef[1] over time it could be ar1 or ma1 or anything.The reason i am doing this is that plotting the coefficient stability permits to judge the stability of coefficient and assess the accuracy of the model.
> getSymbols("ICICIBANK.NS");
> ICICIBANK.NS<-as.data.frame(ICICIBANK.NS)
> ICICIBANK.NS$returns<-c(NA,diff(log(ICICIBANK.NS$ICICIBANK.NS.Adjusted)))
> z<-ICICIBANK.NS$returns
> z<-na.omit(z)
> y<-rollapply(as.zoo(z),width=100,FUN=function(x) auto.arima(x)$coef[1])
basically i am trying here to have a look at the evolution of the first coefficient.but the model changes from one window to another.
Does anyone have an idea how solve this? or maybe some lead i can work on ?
2) when i do auto.arima to log returns i get an ARIMA(0,0,0) and when i dot it for raw raw prices i get ARIMA(3,1,3):
> getSymbols("ICICIBANK.NS");
[1] "ICICIBANK.NS"
> ICICIBANK.NS<-as.data.frame(ICICIBANK.NS)
> ICICIBANK.NS$returns<-c(NA,diff(log(ICICIBANK.NS$ICICIBANK.NS.Adjusted)))
> auto.arima(ICICIBANK.NS$returns)
Series: ICICIBANK.NS$returns
ARIMA(0,0,0) with zero mean
sigma^2 estimated as 0.003309: log likelihood=3042.76
AIC=-6083.51 AICc=-6083.51 BIC=-6077.86
> auto.arima(ICICIBANK.NS$ICICIBANK.NS.Adjusted)
Series: ICICIBANK.NS$ICICIBANK.NS.Adjusted
ARIMA(3,1,3) with drift
Coefficients:
ar1 ar2 ar3 ma1 ma2 ma3 drift
0.0741 -0.0998 0.5626 -0.0572 0.0662 -0.8633 0.1087
s.e. 0.0306 0.0323 0.0279 0.0192 0.0200 0.0159 0.0606
sigma^2 estimated as 77.62: log likelihood=-7610.48
AIC=15236.96 AICc=15237.02 BIC=15282.22
why would auto.arima() work with prices and not log returns ?