plot(dcc.fit)不返回任何输出

时间:2017-12-01 14:15:34

标签: r

$y = new DateTime('@0');
$x = new DateTime('@0');
$secondsOfYear = $y->add(new DateInterval('P1Y'))->getTimestamp();
$secondsOfThreeMonths = $x->add(new DateInterval('P3M'))->getTimestamp();

print_r([$secondsOfYear,$secondsOfThreeMonths,(int)($secondsOfYear/$secondsOfThreeMonths)]);
// output
Array
(
    [0] => 31536000
    [1] => 7776000
    [2] => 4
)

我正在使用Rstudio和Rversion 3.4.2

我正在使用rugarch和rmgarch来规范并将DCC模型与我的数据相匹配。模型生成成功,但我无法生成图表。这是我的代码片段:

> dput(MSFT.GSPC.ret[1:20,])
structure(c(-0.0343636188400374, 0.0104885242596549, -0.0340719994524541, 
0.0129834504230537, 0.00726425460144453, -0.0259456191414236, 
-0.0331137622240925, 0.0187248508043534, 0.0403345305611627, 
0.0269175013880338, -0.0748170288918457, -0.0093898221229205, 
-0.0214547692070148, -0.0243910256435065, 0.0153138591890918, 
-0.0340067862273159, -0.00630881036315545, -0.00507636532488531, 
-0.00382393403377179, 0.0504309696315595, -0.0390991755058661, 
0.00192033767176891, 0.000955221868328415, 0.0267299500582903, 
0.0111278249512576, -0.0131485767905737, -0.00439601996101047, 
0.0120962453648144, 0.0106147630153357, -0.0068555164525268, 
0.000522156347618541, -0.00712061248542284, -0.00291656817789931, 
-0.0280225841963713, 0.00604648360431792, -0.00422161942814814, 
-0.00394620386197975, -0.0278408131523173, 0.0249048507060516, 
0.0105717406599295), class = c("xts", "zoo"), .indexCLASS = "Date", .indexTZ = "UTC", tclass = "Date", tzone = "UTC", src = "yahoo", updated = structure(1512141560.23421, class = c("POSIXct", 
"POSIXt")), ret_type = "log", index = structure(c(946944000, 
947030400, 947116800, 947203200, 947462400, 947548800, 947635200, 
947721600, 947808000, 948153600, 948240000, 948326400, 948412800, 
948672000, 948758400, 948844800, 948931200, 949017600, 949276800, 
949363200), tzone = "UTC", tclass = "Date"), .Dim = c(20L, 2L
), .Dimnames = list(NULL, c("MSFT", "GSPC")))

我选择哪一个并不重要,我得到的输出不存在:

PHP Sandbox

但是,如果我选择0离开,那么我会收到以下警告:

# univariate normal GARCH(1,1) for each series
garch11.spec = ugarchspec(mean.model = list(armaOrder = c(0,0)), 
                          variance.model = list(garchOrder = c(1,1), 
                          model = "sGARCH"), 
                          distribution.model = "norm")

# dcc specification - GARCH(1,1) for conditional correlations
dcc.garch11.spec = dccspec(uspec = multispec( replicate(2, garch11.spec) ), 
                           dccOrder = c(1,1), 
                           distribution = "mvnorm")
dcc.garch11.spec

dcc.fit = dccfit(dcc.garch11.spec, data = MSFT.GSPC.ret)
class(dcc.fit)
slotNames(dcc.fit)
names(dcc.fit@mfit)
names(dcc.fit@model)

# many extractor functions - see help on DCCfit object
# coef, likelihood, rshape, rskew, fitted, sigma, 
# residuals, plot, infocriteria, rcor, rcov
# show, nisurface

# show dcc fit
dcc.fit

# plot method
plot(dcc.fit)
# Make a plot selection (or 0 to exit): 
#   
# 1:   Conditional Mean (vs Realized Returns)
# 2:   Conditional Sigma (vs Realized Absolute Returns)
# 3:   Conditional Covariance
# 4:   Conditional Correlation
# 5:   EW Portfolio Plot with conditional density VaR limits

0 个答案:

没有答案