estimate_residual_cov_poet_local | R Documentation |
This internal function computes a time-varying covariance matrix estimate for a given
window of asset returns by combining factor-based and sparse residual covariance estimation.
It uses results from a local PCA to form residuals and then applies an adaptive thresholding
procedure (via adaptive_poet_rho()
) to shrink the residual covariance.
estimate_residual_cov_poet_local(
localPCA_results,
returns,
M0 = 10,
rho_grid = seq(0.005, 2, length.out = 30),
floor_value = 1e-12,
epsilon2 = 1e-06
)
localPCA_results |
A list containing the results from local PCA, with components:
|
returns |
A numeric matrix of asset returns with dimensions |
M0 |
Integer. The number of observations to leave out between the two sub-samples in the adaptive thresholding procedure. Default is 10. |
rho_grid |
A numeric vector of candidate shrinkage parameters |
floor_value |
A small positive number specifying the lower bound for eigenvalues in the final positive semidefinite repair. Default is |
epsilon2 |
A small positive tuning parameter for the adaptive thresholding. Default is |
The function follows these steps:
**Local Residuals:**
Extract the local loadings \Lambda_t
from the last element of localPCA_results\$loadings
and
factors \hat{F}
from localPCA_results\$f_hat
. Let w_t
denote the corresponding kernel weights.
The local residuals are computed as:
U_{\text{local}} = R - F \Lambda_t,
where R
is the returns matrix.
**Adaptive Thresholding:**
The function calls adaptive_poet_rho()
on U_{\text{local}}
to select an optimal shrinkage parameter
\hat{\rho}_t
.
**Residual Covariance Estimation:** The raw residual covariance is computed as:
S_{u,\text{raw}} = \frac{1}{T} U_{\text{local}}^\top U_{\text{local}},
and a threshold is set as:
\text{threshold} = \hat{\rho}_t × \text{mean}(|S_{u,\text{raw}}|),
where the mean is taken over the off-diagonal elements.
Soft-thresholding is then applied to obtain the shrunk residual covariance matrix \hat{S}_u
.
**Total Covariance Estimation:** The final covariance matrix is constructed by combining the factor component with the shrunk residual covariance:
\Sigma_R(t) = \Lambda_t \left(\frac{F^\top F}{T}\right) \Lambda_t^\top + \hat{S}_u.
**PSD Repair:**
A final positive semidefinite repair is performed by flooring eigenvalues at floor_value
and symmetrizing the matrix.
A list containing:
best_rho
: The selected shrinkage parameter \hat{\rho}_t
for the local residual covariance.
residual_cov
: The shrunk residual covariance matrix \hat{\Sigma}_e(T)
.
total_cov
: The final estimated time-varying covariance matrix \Sigma_R(t)
.
loadings
: The local factor loadings \Lambda_t
from the local PCA.
naive_resid_cov
: The raw (unshrunk) residual covariance matrix.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.