This function calculates the \(V_{pT}\) statistic, which is part of the hypothesis testing procedure to determine whether the covariance matrix of asset returns is time-varying. It incorporates kernel-weighted factor interactions and residual correlations.
compute_V_pT(local_factors, residuals, h, iT, ip, kernel_func)A numeric scalar \(V_{pT}\) representing the computed statistic based on kernel-weighted factor interactions and residual correlations.
A list where each element is a numeric matrix representing the local factor scores for a specific time period. Each matrix should have \(T\) rows (time periods) and \(m\) columns (factors).
A numeric matrix of residuals with \(T\) rows (time periods) and \(p\) columns (assets).
A numeric value indicating the bandwidth parameter for the kernel function.
An integer specifying the number of time periods.
An integer specifying the number of assets.
A function representing the kernel used for weighting. Typically, an Epanechnikov kernel or another boundary kernel function.
The function performs the following steps:
Iterates over each pair of time periods \((s, r)\) where \(s < r\).
Computes the two-fold convolution kernel value \(\bar{K}_{sr}\) using the
two_fold_convolution_kernel function.
Calculates the squared dot product of local factors weighted by the factor covariance matrix.
Computes the squared dot product of residuals between time periods \(s\) and \(r\).
Aggregates these values across all relevant time period pairs and scales by \(\frac{2}{T^2 × p × h}\) to obtain \(V_{pT}\).