This R code predicts sp500 with arima model,
rm(list=ls())
load("StockData.Rdata")
library(seasonal)
library(forecast)
library(tseries)
library(astsa)
sp500 = StockData[,1]
model = auto.arima(sp500,
max.p=52,max.q=52,max.d=52,
seasonal = TRUE,
lambda = "auto", biasadj = TRUE)
predict = forecast(model,biasadj=TRUE, h=2)
Here, I want to use auto.arima with Box-Cox transformation, so I set lambda = "auto"
, and biasadj = TRUE
. However, the predicted value has mean NaN
:
> forecast(model,biasadj=TRUE, h=2)
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
209 NaN -0.1278079 0.1206801 -0.1962931 0.1890652
210 NaN -0.1278079 0.1206801 -0.1962931 0.1890652
I have checked some GitHub questions and some people say that it is because there is NA value in the residual so the point forecast is NaN. However, the residual in model
doesn't contain NaN
so it should not be the case. So, how can I solve that?
Also, why is the predicted value same for t=209 and t=210?