Skip to contents

Delegates to poolr::fisher when installed; otherwise computes the chi-square statistic inline.

Usage

fisher_combined(p_values)

Arguments

p_values

Numeric vector of raw p-values.

Value

An object of class "morie_multiple_testing_result".

Examples

# Combine several independent tests into one global p-value.
res <- fisher_combined(c(0.001, 0.6, 0.5))
res                          # rich print: statistic, df, combined p
#> Combined p-value (fisher)
#> =========================
#> Call: method=fisher 
#> 
#>   Method      fisher
#>   Statistic   16.223
#>   Combined p  0.012604
#>   df          6
#> 
#> Fisher's combination of 3 p-values yields chi-square=16.2235 on 6 df with combined p=0.0126. 
res$p_value                  # the combined p-value
#> [1] 0.01260354
res$statistic                # chi-square = -2 * sum(log p)
#> [1] 16.22346

# One small p can drive the combination significant.
fisher_combined(c(0.0001, 0.9, 0.8, 0.7))$p_value
#> [1] 0.0111562

# All-null inputs stay non-significant.
fisher_combined(c(0.4, 0.5, 0.6))$p_value
#> [1] 0.6441627