I would like to implement the method "Hierarchical PCA", as described in the following paper and compare it to a "standard" PCA. I like to do this in R
AVELLANEDA, Marco. Hierarchical pca and applications to portfolio management. Revista mexicana de economía y finanzas, 2020, 15. Jg., Nr. 1, S. 1-16.
My "standard" PCA is based on a T x n predictor matrix
Predictors_train. Each of the predictors belongs to one of 5 "groups". I would use the following code:
pca_pred <- Predictors_train %>% prcomp(scale. = TRUE, center=TRUE)
Now, implementing the method it seems I have to
- reestimate/adjust the correlation matrix
- estimate a new PCA based on the adjusted covariance matrix.
As for 2), it seems to be clear that I have to use
prcomp() on the adjusted correlation matrix, e.g. in the following form
pca_pred <- AdjustedMatrix %>% prcomp(scale. = TRUE, center=TRUE)
(Maybe I will not need the scaling, as I use a matrix as an input this time and not time series.
As for 1), the method in the paper suggests that I would a) calculate the standard correlation matrix b) use the results within the "blocks" of the predictors c) for elements of different blocks, use the simplified estimate beta_ibeta_jcorr(F_k(i), F_k(j)) , where the F_k()s are the first factors of PCA components within the blocks.
My approach would be to write all the low-level code myself (using some loops). But maybe there is an easier way to do this? In a sense, it seems to be a standard operation, but I cannot figure out the "generic" aspect that would help me to calculate the intra- and inter-block correlation efficiently.
Has anyone experienced similar problems?