Hi everyone! I'd like to have some help to overcome the following error. I have a time series of monthly yields from 2010/01 to 2019/12 and I need to forecast only the 2019 data (better, 2019 will be my out-of-sample). I run these commands, but at the end I obtain this error:
set.seed(20200210)
library(forecast)
x<-arima.sim(n=108, list(ar=0.5))
data.ts<-ts(x, start = c(2010,01), frequency = 12)
time=window(data.ts, start=c(2010,01), end=c(2018,12))
yieldsarima<- arima(time, order=c(1,0,0))
yieldsarima$coef
ar1 intercept 0.4458780 -0.1409129
forecast(yieldsarima, h=12)
Error in attr(data, "tsp") <- c(start, end, frequency) : object is not a matrix
This would be the last passage but I don't know how to solve it. Can anyone help me?