Plot 无法从dccfit(R)生成绘图
R版本:3.4.2 我正在使用rugarch和mgarch来规范模型,并将带有DCC的模型与我的数据相匹配。模型生成成功,但我无法生成绘图。以下是我的代码片段:Plot 无法从dccfit(R)生成绘图,plot,Plot,R版本:3.4.2 我正在使用rugarch和mgarch来规范模型,并将带有DCC的模型与我的数据相匹配。模型生成成功,但我无法生成绘图。以下是我的代码片段: library(rugarch) library(rmgarch) da=read.table("d-msft3dx0113.txt",header=T) MSFT.ret = da[,3] GSPC.ret = da[,6] MSFT.GSPC.ret = cbind(MSFT.ret,GSPC.ret) garch11.spec
library(rugarch)
library(rmgarch)
da=read.table("d-msft3dx0113.txt",header=T)
MSFT.ret = da[,3]
GSPC.ret = da[,6]
MSFT.GSPC.ret = cbind(MSFT.ret,GSPC.ret)
garch11.spec = ugarchspec(mean.model = list(armaOrder = c(0,0)),
variance.model = list(garchOrder = c(1,1),
model = "sGARCH"),
distribution.model = "norm")
dcc.garch11.spec = dccspec(uspec = multispec( replicate(2, garch11.spec) ),
dccOrder = c(1,1),
distribution = "mvnorm")
dcc.fit = dccfit(dcc.garch11.spec, data = MSFT.GSPC.ret)
dcc.fcst = dccforecast(dcc.fit, n.ahead=100)
plot(dcc.fcst)
当我调用plot时,我得到以下错误:
plot(dcc.fcst)
进行打印选择(或0退出):
尚未调用plot.new 然后我给它一个新的绘图区域:
plot.new()
plot(dcc.fcst)
这给了我一个毫无帮助的情节:
我也有同样的问题。我不知道为什么
plot(dcc.fic)
不能工作。所以我手动提取相关性和协方差rcov
和rcor
是提取我们所需内容的两个函数
plot(rcov(dcc.fit)[1,2,], type = "l", col = "blue",
main = "Conditional Covariance", xlab = "Time",
ylab = "Covariance")
plot(rcor(dcc.fit)[1,2,], type = "l", col = "purple",
main = "Conditional Correlation", xlab = "Time",
ylab = "Correlation")
是的,我最后也做了类似的事情。但是,我无法在forecast上找到/提取预测间隔。。。不确定它们是否包含在预测输出中。