compute_M_hat: Compute M_{\hat{}} Statistic for Covariance Time-Variation...

View source: R/hypothesis_testing.R

compute_M_hatR 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 T rows (time periods) and m columns (factors).

global_factors

A numeric matrix of global factor scores with T rows (time periods) and m columns (factors).

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 N rows (assets) and m columns (factors).

global_loadings

A numeric matrix of global factor loadings with N rows (assets) and m columns (factors).

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:

  1. Initializes the M_{\hat{}} statistic to zero.

  2. If the number of factors m is equal to one, it ensures that global_loadings and global_factors are treated as matrices.

  3. Iterates over each asset i = 1 to N and each time period t = 1 to T.

  4. 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{}}.

  5. After all iterations, normalizes M_{\hat{}} by dividing by the product of N and T.

Value

A numeric scalar M_{\hat{}} representing the average squared discrepancy between local and global factor models across all assets and time periods.


TVMVP documentation built on June 28, 2025, 1:08 a.m.