Calculate eigenvalues needed for the quadratic approximation method, which only works for two-sided p-values. Automatically uses C++ implementation when available for 2-5x speedup.
getGFisherlam(D, w, M, GM, use.cpp = TRUE)An n-dimensional vector of degrees of freedom.
An n-dimensional vector of weights.
Correlation matrix of the input Z-scores from which the input p-values were obtained.
Covariance matrix between \(w_1 T_1, ..., w_n T_n\), typically the output
from getGFisherGM.
Logical, default TRUE. If TRUE, uses fast C++ implementation.
Set to FALSE to force pure R implementation.
A list with:
Vector of eigenvalues (positive values > 1e-10) used in the quadratic approximation
Calculate Eigenvalues for Quadratic Approximation
This function implements the eigenvalue calculation described in Section 3.4 of the GFisher paper.
Algorithm:
Construct the tilde correlation matrix \(\tilde{M}\) from formula (13): $$\tilde{M}_{ij} = \text{sign}(M_{ij}) \sqrt{|GM_{ij}| / (\min(d_i, d_j) \cdot 2)}$$
Ensure \(\tilde{M}\) is a valid correlation matrix (all elements <= 1, positive definite)
Compute weighted Cholesky: \(WM = \text{chol}(\tilde{M}) \cdot \text{diag}(\sqrt{w})\)
Extract eigenvalues from \(WM^T WM\)
For \(d > 1\), add additional eigenvalues corresponding to higher degrees of freedom
When weights are negative, eigenvalues can be negative. However, we keep the restriction to positive eigenvalues to be consistent with the GFisher publication.
Note: This method only works for two-sided p-values. The quadratic approximation leverages the chi-square representation under the null hypothesis.
Performance Note:
When use.cpp = TRUE (default), this function uses a C++ implementation with
Armadillo's optimized LAPACK routines for eigenvalue decomposition, providing substantial
speedup over the pure R implementation. The C++ version automatically falls back to
R if unavailable.
Zhang, H., & Wu, Z. (2023). The generalized Fisher's combination and accurate p-value calculation under dependence. Biometrics, 79(2), 1159-1172. See Section 3.4 and Formula (13).