# NOT RUN {
# Just a vector to be forecasted
y <- c(filter(rnorm(100), 0.95, "recursive"))
# Generate a forecast matrix with a simple persistence model
Yhat <- persistence(y, kseq=1:4)
# The residuals for each horizon
Resid <- residuals(Yhat, y)
# Calculate the score for the k1 horizon
rmse(Resid$h1)
# For all horizons
apply(Resid, 2, rmse)
# }
Run the code above in your browser using DataLab