Helper function to check if the coga package is installed
and optionally install it. The coga package is required for functions
with _ind suffix (e.g., p.GFisher_ind, stat.oGFisher_ind).
check_coga(install = FALSE)Logical (invisibly). TRUE if coga is installed (or successfully installed),
FALSE otherwise.
The GFisher package includes optimized functions for calculating p-values when input
p-values are independent. These functions (with _ind suffix) provide faster and
more accurate calculations by leveraging the coga package for weighted sums of
chi-square distributions.
Functions requiring coga:
p.GFisher_ind - Calculate p-value under independence
p.GFisher_ind_w1 - Calculate p-value with equal weights (does not require coga)
stat.oGFisher_ind - Calculate oGFisher statistics under independence
pval.oGFisher_ind - Calculate oGFisher p-value under independence
If coga is not available, you can still use the general functions
(e.g., p.GFisher) with M = diag(n) to indicate independence.
# Check if coga is available
check_coga()
#> 'coga' package is installed and available.
# Install coga if not available
if (FALSE) { # \dontrun{
check_coga(install = TRUE)
} # }