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)

Arguments

install

Logical. If TRUE and coga is not installed, attempt to install it from CRAN. Default is FALSE.

Value

Logical (invisibly). TRUE if coga is installed (or successfully installed), FALSE otherwise.

Details

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:

If coga is not available, you can still use the general functions (e.g., p.GFisher) with M = diag(n) to indicate independence.

Examples

# 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)
} # }