time series - Recursive daily forecast -


i doing recursive one-step-ahead daily forecast different time series models 2010. example:

set.seed(1096) datum=seq(as.date("2008/1/1"), as.date("2010/12/31"), "days") r=rnorm(1096) y=xts(r,order.by=as.date(datum)) list.y=vector(mode = "list", length = 365l)  (i in 1:365) { window.y <- window(y[,1], end = as.date("2009-12-30") + i)  fit.y <- arima(window.y, order=c(5,0,0)) list.y[[i]] <- forecast(fit.y , h = 1) } 

the list looks this:

list.y [[1]] point forecast     lo 80    hi 80     lo 95    hi 95 732  -0.0506346 -1.333437 1.232168 -2.012511 1.911242 [[2]] point forecast     lo 80    hi 80     lo 95   hi 95 733   0.03905936 -1.242889 1.321008 -1.921511 1.99963 

....

[[365]]  point forecast   lo 80    hi 80     lo 95    hi 95  1096  0.09242849 -1.1794 1.364257 -1.852665 2.037522 

and want extract forecast value each period [1]-[365], can work forecast data. however, not sure how this. tried

sa=sapply(list.y[1:365], `[`, 4) 

but this:

$mean time series: start = 732  end = 732  frequency = 1  [1] -0.0506346  $mean time series: start = 733  end = 733  frequency = 1  [1] 0.03905936 

...

$mean time series: start = 1096  end = 1096  frequency = 1  [1] 0.09242849 

but want 365 [1] values in numeric vector or something, can work data.

just use this: sa2=as.numeric(sa). sa2 numeric vector of forecasted means.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -