A note on the co-moments in the IFACD model
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
The Independent Factor Autoregressive Conditional Density (IFACD) model of Ghalanos, Rossi and Urga (2014) uniquely, in its class of parametric models, generates time varying higher co-moment forecasts, as a consequence of the ACD specification of the conditional density of the standardized innovations. In this short note I discuss in more detail the properties of the conditional co-moments of this model, certain interesting properties as relates to the higher moment CAPM and a fast algorithm for populating these very large flattened tensors.
Conditional Co-Moments
The conditional co-moments of rt of order 3 and 4 are represented as tensor matrices
M3t=AM3f,t(A⊗A)′,M4t=AM4f,t(A⊗A⊗A)′
where M3f,t and M4f,t are the N×N2 conditional third comoment matrix and the N×N3 conditional fourth comoment matrix of the factors, respectively. M3f,t and M4f,t, are defined as
M3f,t=[M31,f,t,M32,f,t,…,M3N,f,t]M4f,t=[M411,f,t,M412,f,t,…,M41N,f,t|…|M4N1,f,t,M4N2,f,t,…,M4NN,f,t]
where M3k,f,t,k=1,…,N and M4kl,f,t,k,l=1,…,N are the N×N submatrices of M3f,t and M4f,t, respectively, with elements
m3ijk,f,t=E[fi,tfj,tfk,t|Ft−1]m4ijkl,f,t=E[fi,tfj,tfk,tfl,t|Ft−1].
Since the factors fit can be decomposed as zit√hit, and given the assumptions on zit, then E[fi,tfj,tfk,t|Ft−1]=0 . It is also true that for i≠j≠k≠l, then E[fi,tfj,tfk,tfl,t|Ft−1]=0 and when i=j and k=l, then E[fi,tfj,tfk,tfl,t|Ft−1]=hithkt.
Thus, under the assumption of mutual independence, all elements in the conditional co-moments matrices with at least 3 different indices are zero. Finally, we standardize the conditional co-moments to obtain conditional coskewness and cokurtosis of rt
Sijk,t=m3ijk,t(σi,tσj,tσk,t),Kijkl,t=m4ijkl,t(σi,tσj,tσk,tσl,t),
where Sijk,t represents the coskewness between elements i,j,k of rt, σi,t the standard deviation of ri,t, and in the case of i=j=k represents the skewness of asset i at time t, and similarly for the cokurtosis tensor Kijkl,t
Location of non-zero entries
The flattened tensors grow quite quickly in size as n (factors) and m (moment) become larger. Populating the factor matrices with the values from the ACD dynamics in a fast and efficient manner is key if this model is to be called ‘feasible’ and estimation ‘large-scale’. For the third co-moment matrix, this is very simply since the column based vectorized index of the location of non-zero entries is found to be ((1:n)−1)n2+((1:n)−1)n+(1:n).
These represent the (column based vectorized) location in the third co-moment matrix of the factor unstandardized skewness estimated from the ACD model (and determined jointly by the skew and shape dynamics). In the case of the fourth co-moment matrix of the factors, the situation is slightly more involved since in addition to the entries {i=j=k=l} for which the column based vectorized location is found to be ((1:n)−1)n3+((1:n)−1)n2+((1:n)−1)n+(1:n), there are also the entries {i=j,k=l} to consider as discussed in the previous section. To this end, consider the n×n3 matrix of the flattened tensor M4f,ijkl, with the indices illustrated as in the 4×43 matrix below:
j:11111111…44k:11112222…44l:12341234…34i:1{1111}{1112}{1113}{1114}{1121}{1122}{1123}{1124}…{1443}{1444}i:2{2111}{2112}{2113}{2114}{2121}{2122}{2123}{2124}…{2443}{2444}i:3{3111}{3112}{3113}{3114}{3121}{3122}{3123}{3124}…{3443}{3444}i:4{3111}{4112}{4113}{4114}{3121}{4122}{4123}{4124}…{4443}{4444}
We are interested in finding the index location of all the pairs where {i=j,k=l} and their permutations, e.g. {1122},{1212},{2211},{2112},{1221},{2121}.
To do this, we first note the following:
- There are n!2(n−2)! unique pairs.
- Each pair has 6 permutations.
- The number of unique pairs whose difference is d is n−d e.g. for d=1,n=4, we have 3 unique pairs {2,1},{3,2} and {4,3}.
- The first pair has columnwise vector based index v=n+2 e.g. for n=4, the first pair is {2112} in the example matrix above with columnwise vector based index of 6.
- The pth unique pair, representing the first in the set of pairs with n−d differences, has vector based index (p−1)+(n+1), which given the starting pair with index n+2 means that we can calculate the indices of each unique pair in the matrix given the previous unique pair’s position.
- Within each pth unique pair, there are 6 permutations. Starting from the index of the first pair in the series of 6, denoted v1, the second permutation has index v1+((n−1)n)d, the third v2+(n−1)d, the fourth v3+d(n+1)(n−1)2, the fifth v4+(n−1)d and the sixth v5+((n−1)n)d.
- The first pair of the next set of pairs whose difference is n−d has and index which is equal to n3+n2+n+1 more than the previous pair.
This fast method for calculating the location of each entry and populating it accordingly is already implemented in the rmgarch package for the GO-GARCH (NIG/GH) model. In addition, in order to avoid memory problems when it comes time to perform the kronecker multiplications using the mixing matrix A on the factor higher co-moments to arrive at the asset higher co-moments, the method of Buis amd Dyksen (1996) is used which is also implemented in the klin package.
The Higher Moment Time Varying Statistical Factor CAPM
A very interesting application made possible as a result of the model’s properties is the estimation of the (higher moment) time varying betas from the CAPM model. Consider a universe of n assets with returns rt, with benchmark b whose return is rb,t and determined by a linear combination based on a pre-specified weighting vector wt:
rb,t=w′trt
such that w′t1=1. It could be the case that wt represents the weights of the benchmark index or some other pre-deteremined weighting scheme (e.g. equal weight). To calculate the CAPM betas with respect to the benchmark, we need not model the pairwise combination of assets-benchmark but instead only the assets which comprise the benchmark. The following formulae outline the steps:
- Define the conditional covariance: M2t=AHtA′, where Ht=E[ftf′t|ℑt–1],∈RN×N
- Define the conditional 3rd co-moment: M3t=AM3f,t(A′⊗A′),∈RN×N2
- Define the conditional 4th co-moment: M4t=AM4f,t(A′⊗A′⊗A′),∈RN×N3
The conditional beta Covariance:
βi,t=E[(Ri,t–ˉRi,t)(Rm,t–ˉRm,t)]E[(Rm,t–ˉRm,t)2]=m2i,tww′M2tw
where m2i,t:=rowiM2t(i=1,…,N).
The conditional beta Coskewness:
si,t=E[(Ri,t–ˉRi,t)(Rm,t–ˉRm,t)2]E[(Rm,t–ˉRm,t)3]=m3i,t(w⊗w)w′M3t(w⊗w)
where m3i,t:=rowiM3t(i=1,…,N).
The conditional beta Cokurtosis:
ki,t=E[(Ri,t–ˉRi,t)(Rm,t–ˉRm,t)3]E[(Rm,t–ˉRm,t)4]=m4i,t(w⊗w⊗w)w′M4t(w⊗w⊗w)
where m4i,t:=rowiM4t(i=1,…,N)
Thus, considering that we can include dimensionality reduction at the PCA whitening stage (the n.comp argument in the rmgarch::fastica algorithm), the IFACD (and the non-time varying higher moments restricted GO-GARCH sub-model) provides a clear avenue for estimating a large scale statistical factor based time varying higher moment CAPM model. A demonstration is available here.
Fast weighted VaR calculation using the Cornish-Fisher Expansion
In the IFACD model, the conditional weighted density can be calculated using the inversion of the NIG/GH characteristic function via FFT as discussed in Ghalanos, Rossi and Urga (2014) and the rmgarch vignette (for the GO-GARCH model). Methods for working with the weighted density are already available in the rmgarch package including methods for the density, distribution and quantile (dfft, pfft and qfft) on estimated, forecast and simulated objects. An alternative avenue for the calculation of the weighted quantile is to use the Cornish-Fisher expansion which makes use of the conditional higher moments:
VaRt,α=μt+σt(ϕ+(1–ϕ2)St6+(ϕ3–3ϕ)Kt24+(5ϕ–2ϕ3)S2t36)
where ϕ=Φ–1(α), represents the quantile of the standard normal distribution evaluated at the coverage level α, St the skewness at time t and Kt the excess kurtosis at time t. The weighted moments (μt,σt,St,Kt) can be calculated as follows:
μt=w′tM1t,σ2t=w′tΣtwt,St=w′tM3t(wt⊗wt)(w′tΣtwt)3/2,Kt=w′tM4t(wt⊗wt⊗wt)(w′tΣtwt)2,
where M1t is the conditional mean vector, M3t and M4t are the third and fourth co-moment matrices described in the previous section, and Σt the conditional covariance (the notation M2t has also been used).
A demonstration is available here.
References
Buis, P. E., & Dyksen, W. R. (1996). Efficient vector and parallel manipulation of tensor products. ACM Transactions on Mathematical Software (TOMS), 22(1), 18-23.
Ghalanos, A., Rossi, E. & Urga G. (2014). Independent Factor Autoregressive Conditional Density model. Econometric Reviews (forthcoming).
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.