I am doing a recursive one-step-ahead daily forecast with different time series models for 2010. For 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)
for (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 like 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 now I want to extract only the forecast value for each period [1]-[365], so I can work with the forecast data. However, I am not sure how to do this. I tried
sa=sapply(List.y[1:365], `[`, 4)
but then I only get 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 I want all 365 [1] values in a numeric vector or something, so I can work with the data.