我有15个不同国家的股票市场,我想提前一天针对R-studio中具有风险价值的DCC模型进行预测。我使用以下代码拟合了DCC-garch模型,并得到了dccfit的结果。
**data1<-read.csv(file.choose(), header = T)
library("rugarch")
library("rmgarch")
library("PerformanceAnalytics")
Date= as.Date(data1$Date, "%d/%m/%Y")
data4<data.frame(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O)
varfit<-varxfit(X=data4, p=1, exogen = NULL,robust = FALSE,gamma = 0.25, delta = 0.01, nc = 10, ns = 500, postpad = "constant")
uspec= ugarchspec(mean.model = list(armaOrder = c(0,0),external.regressors = NULL,include.mean = FALSE), variance.model = list(garchOrder = c(2,1), external.regressors=cbind(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O),model = "eGARCH",variance.targeting=FALSE), distribution.model = "sstd")
mspec = multispec(replicate(15,uspec))
dspec = dccspec(uspec = mspec, VAR = TRUE, lag = 1, dccOrder = c(1,1), external.regressors=cbind(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O),model = "dcc",distribution = "mvt")
dfit = dccfit(dspec, data = data4, out.sample = 0, fit.control = list(eval.se=TRUE), VAR.fit = varfit)
dfit**
现在,当我使用以下命令预测Dcc模型时,会出现以下错误,
预测
**df<-dccforecast(dfit, n.ahead = 1, n.roll = 0, external.forecasts = list(Vregfor=data.frame(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O)), cluster = NULL)**
Bcoef%*%t(Z)中的错误:参数不一致 另外:警告消息: 在.dccforecast(fit,n.ahead = n.ahead,n.roll = n.roll,external.forecasts = external.forecasts中, 外部回归指标预测矩阵NULL ...设置为零...
请帮助我克服这个问题。我将感谢你。