Calculate the p-value of a GFisher test statistic when input p-values are
independent. This is substantially faster than using p.GFisher with
M as the identity matrix.
p.GFisher_ind(q, df, w, isExact = TRUE)Numeric value of the observed GFisher statistic.
Vector of degrees of freedom for each p-value transformation. Cannot be single value if the number of independent chi-square variables is greater than 1.
Vector of non-negative weights. If single value, it is expanded to a vector of equal weights. Note: Weights are automatically normalized to sum to 1, consistent with all functions in this package.
Logical. If TRUE (default), uses exact calculation via the coga package.
If FALSE, uses an approximation which may be less accurate but faster.
A numeric p-value.
Calculate P-Value of GFisher Under Independence
Under independence, the GFisher statistic follows a linear combination of independent chi-square distributions:
$$S = \sum_{i=1}^n w_i \chi^2_{d_i}$$
This function computes \(P(S > q)\) using:
Exact method (isExact = TRUE): Uses the coga package to compute
the distribution of a weighted sum of gamma random variables (chi-square is a special
case of gamma). This method is accurate even for very small p-values.
Approximation (isExact = FALSE): Uses a faster approximation from
the coga package, which may be less accurate for extreme tail probabilities.
Weights are automatically scaled so that \(\sum w_i = 1\).
Note on dependencies:
This function requires the coga package, which is listed in Suggests.
If coga is not installed, the function will fail with an error message.
Zhang, H., & Wu, Z. (2023). The generalized Fisher's combination and accurate p-value calculation under dependence. Biometrics, 79(2), 1159-1172.
Witkovsky, V. (2016). Numerical inversion of a characteristic function: An alternative
tool to form the probability distribution of output quantity in linear measurement models.
Acta IMEKO, 5(3), 32-44.
(Describes the characteristic function inversion methodology underlying the coga package)
if (FALSE) { # \dontrun{
# Requires coga package
if (requireNamespace("coga", quietly = TRUE)) {
set.seed(123)
n <- 10
df <- runif(n, 0.5, 5)
w <- abs(rnorm(n))
q <- 40
# Exact calculation
p_exact <- p.GFisher_ind(q = q, df = df, w = w, isExact = TRUE)
print(p_exact)
# Approximation (faster but less accurate)
p_approx <- p.GFisher_ind(q = q, df = df, w = w, isExact = FALSE)
print(p_approx)
# Compare with general method (should be similar but slower)
p_general <- p.GFisher(q = q, df = df, w = w, M = diag(n),
p.type = "two", method = "HYB")
print(p_general)
}
} # }