Learn R Programming

hypothesize (version 0.11.0)

union_test: Union Test (OR via De Morgan's Law)

Description

Combines hypothesis tests using the OR rule: rejects when ANY component test rejects.

Usage

union_test(...)

Value

A hypothesis_test object of subclass union_test containing:

stat

The minimum p-value (used as the test statistic)

p.value

\(\min(p_1, \ldots, p_k)\)

dof

Number of component tests

n_tests

Number of tests combined

component_pvals

Vector of individual p-values

Arguments

...

hypothesis_test objects or numeric p-values to combine.

Multiplicity Warning

The uncorrected \(\min(p)\) is anti-conservative when testing multiple hypotheses. If you need to control the family-wise error rate, apply adjust_pval() to the component tests before combining, or use fisher_combine() which pools evidence differently.

The raw union test is appropriate when you genuinely want to reject a global null if any sub-hypothesis is false, without multiplicity correction --- for example, in screening or exploratory analysis.

Boolean Algebra

Together with intersection_test() (AND) and complement_test() (NOT), this forms a complete Boolean algebra over hypothesis tests:

  • AND: intersection_test() --- reject when all reject

  • OR: union_test() --- reject when any rejects

  • NOT: complement_test() --- reject when original fails to reject

De Morgan's laws hold by construction:

  • union(a, b) = NOT(AND(NOT(a), NOT(b)))

  • intersection(a, b) = NOT(OR(NOT(a), NOT(b)))

Details

The union test implements the OR operation in the Boolean algebra of hypothesis tests. It is defined via De Morgan's law:

$$\text{union}(t_1, \ldots, t_k) = \text{NOT}(\text{AND}(\text{NOT}(t_1), \ldots, \text{NOT}(t_k)))$$

This is not an approximation --- it is the definition. The implementation is literally the De Morgan law applied to complement_test() and intersection_test().

The resulting p-value is \(\min(p_1, \ldots, p_k)\).

See Also

intersection_test() for AND, complement_test() for NOT, fisher_combine() for evidence pooling

Examples

Run this code
# Screen three biomarkers: reject if ANY is significant
t1 <- wald_test(estimate = 0.5, se = 0.3)
t2 <- wald_test(estimate = 2.1, se = 0.8)
t3 <- wald_test(estimate = 1.0, se = 0.4)
union_test(t1, t2, t3)

# De Morgan's law in action
a <- wald_test(estimate = 2.0, se = 1.0)
b <- wald_test(estimate = 1.5, se = 0.8)
# These are equivalent:
pval(union_test(a, b))
pval(complement_test(intersection_test(complement_test(a), complement_test(b))))

Run the code above in your browser using DataLab