R/GFisher-independent.R
p.GFisher_ind_w1.RdFast calculation of GFisher p-value when input p-values are independent and have equal weights (or weight = 1). Uses the fact that the sum of independent chi-square random variables is also chi-square distributed.
p.GFisher_ind_w1(q, df)A numeric p-value.
Calculate P-Value of GFisher Under Independence with Equal Weights
When weights are equal (or all equal to \(1/n\)), the GFisher statistic under independence is:
$$S = \frac{1}{n} \sum_{i=1}^n \chi^2_{d_i} \sim \frac{1}{n} \chi^2_{\sum d_i}$$
Zhang, H., & Wu, Z. (2023). The generalized Fisher's combination and accurate p-value calculation under dependence. Biometrics, 79(2), 1159-1172.
# Example: Fast calculation with equal weights
set.seed(123)
n <- 10
df <- rep(2, n) # Equal df
pval <- runif(n)
q <- stat.GFisher(pval, df = df, w = 1)
# Fast exact p-value
p_fast <- p.GFisher_ind_w1(q, df)
print(p_fast)
#> [1] 0.7430077
# Compare with standard chi-square test (df = 2n)
p_chisq <- pchisq(q, df = sum(df), lower.tail = FALSE)
print(p_chisq)
#> [1] 1