View source: R/hypothesis_testing.R
compute_M_hat | R Documentation |
M_{\hat{}}
Statistic for Covariance Time-Variation Hypothesis TestingThis 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.
compute_M_hat(
local_factors,
global_factors,
local_loadings,
global_loadings,
iT,
ip,
m
)
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. |
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 that
global_loadings
and global_factors
are treated as matrices.
Iterates over each asset i = 1
to N
and each time period t = 1
to T
.
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 to M_{\hat{}}
.
After all iterations, normalizes M_{\hat{}}
by dividing by the product of N
and T
.
A numeric scalar M_{\hat{}}
representing the average squared discrepancy
between local and global factor models across all assets and time periods.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.