compute_M_hat {TVMVP} | R Documentation |
Compute M_{\hat{}}
Statistic for Covariance Time-Variation Hypothesis Testing
Description
This function calculates the M_{\hat{}}
statistic, which measures the average squared
discrepancy between local and global factor models across all assets and time periods.
It quantifies the difference between locally estimated factors/loadings and their global
counterparts.
Usage
compute_M_hat(
local_factors,
global_factors,
local_loadings,
global_loadings,
iT,
ip,
m
)
Arguments
local_factors |
A list where each element is a numeric matrix representing the
local factor scores for a specific time period. Each matrix should have |
global_factors |
A numeric matrix of global factor scores with |
local_loadings |
A list where each element is a numeric matrix representing the
local factor loadings for a specific time period. Each matrix should have |
global_loadings |
A numeric matrix of global factor loadings with |
iT |
An integer specifying the number of time periods. |
ip |
An integer specifying the number of assets. |
m |
An integer specifying the number of factors. |
Details
The function performs the following steps:
Initializes the
M_{\hat{}}
statistic to zero.If the number of factors
m
is equal to one, it ensures thatglobal_loadings
andglobal_factors
are treated as matrices.Iterates over each asset
i = 1
toN
and each time periodt = 1
toT
.For each asset and time period, computes:
-
common_H1
: The dot product of the local loadings and local factors. -
common_H0
: The dot product of the global loadings and global factors. The squared difference
(common\_H1 - common\_H0)^2
and adds it toM_{\hat{}}
.
-
After all iterations, normalizes
M_{\hat{}}
by dividing by the product ofN
andT
.
Value
A numeric scalar M_{\hat{}}
representing the average squared discrepancy
between local and global factor models across all assets and time periods.