0

我正在使用 rmgarch 包中的 DCC Garch - 您在上面看到的代码。情节调整不符合我的意愿,由于 x 轴的标题错误,我不确定情节是否采用了我使用的正确时间序列,因为我有一个非常长的时间序列。我还必须使用每日和每月数据,并且使用每月数据我会遇到问题,在我的结果中看到。

因此,我使用 rcor(dcc.fit) 来显示 DCC Garch 生成的相关性。

现在我的第一个问题是,是否有可能将相关性作为一个向量而不是你所看到的我的 rcor(dcc.fit) 结果,否则这将是很多工作?

我的第二个问题是它只适用于 replicate=2 资产,否则我会收到一条错误消息。我必须处理更多的相关性。是否有可能获得相关时间序列的矩阵?这意味着,将所有相关性同时计算为时间序列并将它们绑定到一个矩阵?

Correlation  A&B   A&C   B&C

T=1                 0,5       -0,5   0,15
T=2                 0,2       -0,3   0,23
T=3 ……

My code I used:

    >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 = returns)
    > rcorr = rcor(dcc.fit) 

#the outcome is above: the error is that this are monthly data and not 
#daily but it shows wrong dates. However, I want to have these correlations as a vector!! 

#1971-07-11 0.1197476
#1971-07-12 0.1199578

#further on.. but with right dates!

, , 1971-07-11 01:00:00

          Stock_1   Stock_2
Stock_1 1.0000000 0.1197476
Stock_2 0.1197476 1.0000000

, , 1971-07-12 01:00:00

          Stock_1   Stock_2
Stock_1 1.0000000 0.1199578
Stock_2 0.1199578 1.0000000

, , 1971-07-13 01:00:00

          Stock_1   Stock_2
Stock_1 1.0000000 0.1194465
Stock_2 0.1194465 1.0000000

, , 1971-07-14 01:00:00

           Stock_1    Stock_2
Stock_1 1.00000000 0.07949913
Stock_2 0.07949913 1.00000000

, , 1971-07-15 01:00:00

           Stock_1    Stock_2
Stock_1 1.00000000 0.08781321
Stock_2 0.08781321 1.00000000

Thank you in advance!
4

1 回答 1

1
#to get time varying correlation
    rho.est.line <- list()
    rho.est.line = rcor(dcc.fit, type="R") # plot(rho.est.line[1,2,])
    outputcorr <- matrix((rho.est.line[1,2,]), nrow = dim(returns)[1], byrow = TRUE)
    rho.est = data.frame((outputcorr)) 
    rho.est.zoo = zoo(rho.est, order.by=index(returns[,1])) 
于 2017-08-22T12:05:13.760 回答