I have fitted a DCC GARCH model to my multivariate financial returns data. Now, I need to compute the time-varying conditional correlation matrix by using the standardized residuals obtained from the DCC-GARCH estimation. Here, the problem is I do not know how to compute conditional correlation matrix by using standardized residuals.
Below is my reproducible code:
load libraries
library(rugarch)
library(rmgarch)
data(dji30retw)
Dat = dji30retw[, 1:8, drop = FALSE]
uspec = ugarchspec(mean.model = list(armaOrder = c(0,0)), variance.model = list(garchOrder = c(1,1), model = "eGARCH"), distribution.model = "norm")
spec1 = dccspec(uspec = multispec(replicate(8, uspec)), dccOrder = c(1,1), distribution = "mvnorm")
fit1 = dccfit(spec1, data = Dat)
print(fit1)
My question:
Is it possible to obtain the time-varying conditional correlation matrix as well as variance of the returns, by using standardized residuals obtained from the DCC-GARCH estimation?
I have tried the following code without residuals, but not sure whether it is correct or not:
r1=rcor(fit1, type="cor")
Kindly help me to get the time-varying correlation matrix by using the standardized residuals. I also need help to obtain the variances of each individual returns.
A kind help will be highly appreciated.
Thanks in advance.
Best Answer
From the documentation pp. 18-19, it looks like
rcor
is indeed the correct method to use:But you're passing in the wrong parameter. The major diagonal of any correlation matrix should consist of 1s, which is clearly not the case in your example. What you are actually returning is the Q-matrix.
To extract the fitted conditional correlation matrix you should pass in
type="R"
.As an example, to extract the conditional correlations on the last day of your data (11 Aug 1989), you may use
which returns
The conditional variances are on the diagonal of the matrix returned by
rcov
. For example, on the same day the conditional variances are:which returns
You should experiment with indexing the results of the
rcor
andrcov
methods. And try plotting the numbers to get a feel for them.For example, to plot the conditional variance throughout history of AA, you can run
And to plot the conditional correlation between AA and CVX throughout history, you can run