Documentation
¶
Overview ¶
Package multiplicity is the pure multiple-comparison correction core: it maps one vector of raw p-values to its adjusted twin under a named method (bonferroni, holm, bh, by, none), matching R's stats::p.adjust.
The package is deliberately family-agnostic. It knows nothing about tests, overlays, matrices, rows or columns; a caller assembles one family's p-values into a slice, adjusts it, and maps the result back to its own coordinates.
Contract, shared by every method:
- the input slice is never mutated; the result is a fresh slice of the same length, position i adjusting input i;
- NaN inputs are excluded from the family size m and come back as NaN in place (R drops NA from n the same way);
- results are capped at 1;
- ties are ordered by original position, and the step-down (holm) and step-up (bh, by) methods enforce monotonicity with a running max / min over the sorted order, so tied inputs adjust equally;
- with m <= 1 every method returns the input unchanged, as R does.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Adjust ¶
Adjust returns the adjusted p-values of p under method. It errors only on an unknown method; callers validate method names before the fold and surface their own coded error.
func BH ¶
BH returns the Benjamini-Hochberg step-up adjustment: with the non-NaN p sorted descending, the one of ascending rank i adjusts to min(1, min_{j>=i} (m/j)·p_(j)).
func Bonferroni ¶
Bonferroni returns min(1, m·p) for each non-NaN p.
func FamilySize ¶
FamilySize returns m, the number of non-NaN p-values in p — the count every method divides or multiplies by.
Types ¶
type Method ¶
type Method string
Method names one p-value correction procedure.
const ( // MethodNone is the identity: the result is an exact copy. MethodNone Method = "none" // MethodBonferroni multiplies every p by m (family-wise error). MethodBonferroni Method = "bonferroni" // MethodHolm is Holm's step-down procedure (family-wise error). MethodHolm Method = "holm" // MethodBH is the Benjamini-Hochberg step-up procedure (false // discovery rate under independence or positive dependence). MethodBH Method = "bh" // MethodBY is the Benjamini-Yekutieli step-up procedure (false // discovery rate under arbitrary dependence). MethodBY Method = "by" )
The supported correction methods.