# Single test adjustment (must specify n)
w <- wald_test(estimate = 2.0, se = 0.8)
pval(w) # Original p-value
w_adj <- adjust_pval(w, method = "bonferroni", n = 10)
pval(w_adj) # Adjusted (multiplied by 10, capped at 1)
w_adj$original_pval # Can still access original
# Adjusting multiple tests at once
tests <- list(
wald_test(estimate = 2.5, se = 0.8),
wald_test(estimate = 1.2, se = 0.5),
wald_test(estimate = 0.8, se = 0.9)
)
# BH (FDR) correction - n is inferred from list length
adjusted <- adjust_pval(tests, method = "BH")
sapply(adjusted, pval) # Adjusted p-values
# Compare methods
sapply(tests, pval) # Original
sapply(adjust_pval(tests, method = "bonferroni"), pval) # Conservative
sapply(adjust_pval(tests, method = "BH"), pval) # Less conservative
Run the code above in your browser using DataLab