# NOT RUN {
data(harborSealWA)
dat <- t(harborSealWA[, -1])
fit <- MARSS(dat[1:2,])
fr <- predict(fit, h=10)
plot(fr, include=10)
# forecast.marssMLE does the same thing as predict with h
fr <- forecast.marssMLE(fit, h=10)
plot(fr)
# without h, predict will show the prediction intervals
fr <- predict(fit)
plot(fr)
# you can fit to a new set of data using the same model and same x0
fr <- predict(fit, newdata=list(y=dat[3:4,]), x0="use.model")
plot(fr)
# but you probably want to re-estimate x0
fr <- predict(fit, newdata=list(y=dat[3:4,]), x0="reestimate")
plot(fr)
# forecast
fr <- forecast.marssMLE(fit, h=10)
# If you load the forecast package, this will work
library(forecast)
fr <- forecast(fit, h=10)
# }
Run the code above in your browser using DataLab