Predicting Multivariate time series model (MARSS) with covariates

858 views Asked by At

I am running a multivariate autoregressive state-space model using the MARSS package. I get an error when attempting to predict. This is the code -

library(MARSS)

A = "zero"
U = "zero"
B = "identity"
Z = "identity"
Q = "equalvarcov"
R = "equalvarcov"
C = "unconstrained"
y = rbind(rnorm(30))
covariates = rbind(x = rnorm(30))
model.list = list(B=B,U=U,Q=Q,Z=Z,A=A,R=R,C=C,c=covariates)
control.list = list(maxit=500)
MARSS.MODEL = MARSS(y, model=model.list, control=control.list)
newdata <-  rbind(x = rnorm(10))
predict(MARSS.MODEL, newdata=list(c=newdata),n.ahead=10,t.start=31)

This is the error -

Error: predict_marxss: c are time-varying.In this case, you cannot forecast past the end of the time series(t.start+n.ahead must be < length of original data).
0

There are 0 answers