用协变量预测多变量时间序列模型(MARSS)

时间:2016-12-28 04:42:59

标签: r forecasting state-space

我使用MARSS软件包运行多变量自回归状态空间模型。尝试预测时出错。这是代码 -

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)

这是错误 -

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 个答案:

没有答案