# 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")
vapply(adjusted, pval, numeric(1)) # Adjusted p-values
# Compare methods
vapply(tests, pval, numeric(1)) # Original
vapply(adjust_pval(tests, method = "bonferroni"), pval, numeric(1))
vapply(adjust_pval(tests, method = "BH"), pval, numeric(1))
Run the code above in your browser using DataLab