Let's say I want to use a Gaussian copula $$C_{R_t}(\eta_1, ..., \eta_n) = N_{R_t}(N^{-1}(\eta_1), ...,N^{-1}(\eta_n))$$ with a time-varying correlation matrix $R_t$. Through DCC we model the correlation which evolves as $$Q_t=(1-\alpha-\beta)\overline{Q}+\beta Q_{t-1} + \alpha \epsilon^{*}_{t-1} \epsilon^{*T}_{t-1}$$ where $\epsilon_t^*=N^{-1}(\eta_t)$. The components $r_{ij,t}$ of $R_t$ is then obtained after normalization $$r_{ij,t}=\frac{q_{ij, t}}{\sqrt{q_{ii,t}q_{jj,t}}}$$ (see http://www.frbsf.org/economic-research/files/christoffersen.pdf)

Say that, instead of using some built-in commands in R (such as cgarchspec and cgarchfit from rmgarch package), I'd want to write a function in R to do this. Specifically, I want R to i) compute $Q_t$, which is measurable at time $t-1$ given previous initial values; ii) convert it in $R_t$ as defined above; iii) and use it as input to generate $N$ random draws from the Gaussian copula at time $t$. Next, I would like R to repeat steps i-iii for $t+1$ using values estimated in $t$, in $t+2$ using $t+1$ data, and so on until $t+d$.

How would something like this look like? Anyone has a hint, or any link that would introduce me to such multi-level equation? I beg you to pardon my R ignorance but I've never come across such an exercise during my studies and now I'm totally lost. Moreover, I'd like to implement something similar using other copula families, that's why I want to get the basics writing down the equation for the Gaussian one rather than just using the built-in commands.

Any hint is appreciated, thank you in advance!

  • $\begingroup$ To me that look like a for loop: for (i in 1:t) { update correlation then draw r.v. from copula } $\endgroup$ – lcrmorin May 27 '16 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.