Learn R Programming

TVMVP (version 1.0.5)

compute_B_pT: Compute \(B_{pT}\) Statistic for Covariance Time-Variation Hypothesis Testing

Description

This function calculates the \(B_{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 local and global factor interactions along with residuals.

Usage

compute_B_pT(local_factors, global_factors, residuals, h, iT, ip, kernel_func)

Value

A numeric scalar \(B_{pT}\) representing the computed statistic based on kernel-weighted factor interactions and residuals.

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).

residuals

A numeric matrix of residuals with \(T\) rows (time periods) and \(p\) columns (assets).

h

A numeric value indicating the bandwidth parameter for the kernel function.

iT

An integer specifying the number of time periods.

ip

An integer specifying the number of assets.

kernel_func

A function representing the kernel used for weighting. Typically, an Epanechnikov kernel or another boundary kernel function.

Details

The function performs the following steps:

  1. Computes the sum of squared residuals for each time period \(s\).

  2. Constructs the kernel matrix \(K[s,t]\) by applying the boundary_kernel function to each pair of time periods \((s,t)\).

  3. Calculates the local dot-product matrix \(L[s,t]\) as the dot product between the local factors at time \(s\) and \(t\).

  4. Computes the global dot-product matrix \(G[s,t]\) as the dot product between the global factors at time \(s\) and \(t\).

  5. Computes the element-wise squared difference between \(K * L\) and \(G\), multiplies it by the residuals, and sums over all \(s,t\).

  6. Scales the aggregated value by \(\frac{\sqrt{h}}{T^2 \sqrt{p}}\) to obtain \(B_{pT}\).