Multiple Testing Simulator
The learner reruns many simulated studies, each testing a family of hypotheses (some true nulls, some real effects, optionally correlated), and compares unadjusted testing with Bonferroni, Šidák, Holm, Hochberg, Benjamini–Hochberg and Benjamini–Yekutieli on FWER, false rejections, FDR and power. Views show one study's sorted p-values against each procedure's threshold, the pooled p-value histogram, error-rate bars with exact values, and FWER against m; further scenarios simulate planned versus post-hoc pairwise comparisons and choosing the tail or the level after seeing the data.
Used in: Introduction to Statistics
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | — | Title bar text. Default depends on the scenario. |
| scenario | string | "tests" | tests: m tests per study with m0 true nulls; pairs: all pairwise comparisons of k group means (planned pair vs largest-vs-smallest); direction: one z test whose one-sided direction is chosen after seeing z; levels: one test whose level is chosen after seeing p. |
| m | number | 20 | tests: hypotheses per study (1 to 10000; the plot shows the 400 smallest p-values). |
| nullShare | number | 0.8 | tests: share π0 of the m hypotheses that are true nulls (m0 = round(π0 m)). |
| m0 | number | — | tests: exact number of true nulls; overrides nullShare unless nullShare has a slider. |
| effectZ | number | 3 (tests), 0 (direction, levels) | Mean of the z statistic under a real effect (standard-error units). direction/levels: 0 means H0 is true. |
| power | number | — | tests: instead of effectZ, the power of one unadjusted level-α test against each real effect; effectZ is solved from it. |
| test | string | "two-sided" | tests: two-sided or one-sided (upper) z tests. |
| alpha | number | 0.05 | Significance level; also the FDR level q for BH and BY. |
| correlation | number | 0 | tests: correlation ρ between every pair of test statistics in a study (0 to 0.99). |
| procedures | string[] | ["none", "bonferroni", "holm", "bh"] (pairs: ["bonferroni"]) | Procedures compared: none, bonferroni, sidak, holm, hochberg, bh, by (aliases such as benjamini-hochberg, unadjusted are accepted). pairs: applied to all k(k−1)/2 pairs, in addition to the planned and post-hoc rules. The learner can toggle them. |
| groups | number | 5 | pairs: number of groups k (2 to 10). |
| nPerGroup | number | 10 | pairs: observations per group (σ = 1 known). |
| groupMeans | number[] | all 0 | pairs: true group means in σ units; padded with 0 or cut to k. |
| plannedPair | number[] | [1, 2] | pairs: the two groups (1-based) of the comparison fixed in advance. |
| levels | number[] | [0.01, 0.05, 0.1] | levels: the conventional levels the post-hoc analyst picks from. |
| view | string | first of views | Initial view: study (one study), histogram (pooled p-values; z for direction), rates (error-rate bars), curve (FWER against m; tests only). |
| views | string[] | all views of the scenario | Views offered in the toggle (tests: study, histogram, rates, curve; pairs: study, rates; direction and levels: histogram, rates). |
| metric | string | "fwer" (direction, levels: "rate") | Initial bar metric in the rates view: fwer, falseRejections, fdr, power, rate. |
| readout | string[] | fwer, falseRejections, fdr, power, exact (as relevant) | Table columns (tests, pairs): fwer, falseRejections, pcer, fdr, power, nullShareOfRejections, rejections, perTestLevel, exact. |
| studies | number | tests: 40000/m clamped to 200..2000; pairs, direction, levels: 2000 | Studies simulated at first; the learner adds more. Capped so that studies × m stays under 400,000. |
| parameters | array | tests: m, nullShare, effectZ (power instead of effectZ when power is set); pairs: groups; direction: alpha, effectZ; levels: effectZ | Sliders as [{name, min, max, initial, step?, label?}], name one of m, nullShare, effectZ, power, alpha, correlation, groups, nPerGroup. [] shows no sliders. |
| seed | number | string | 1 | Random seed; the same seed gives the same studies. |
| controls | string[] | all controls shown | Registry ids of the procedure buttons, view tabs, metric options and table columns to show (core ones always show). Absent shows everything. Fitted by tooling from the props and what the lecture has taught; authors do not pick it by hand. |
PreviousNext