
Plausible-value / weight-aware multiverse (specification-curve) analysis
Source:R/lsa_multiverse.R
lsa_multiverse.RdRuns an lsastrat estimator across a grid of analytic specifications – the "forking paths" of a multiverse analysis – and collects one tracked quantity from each, so the robustness of a finding to defensible analytic choices can be read off a specification curve. Every specification inherits correct plausible-value pooling and replicate-weight inference from the underlying estimator.
Usage
lsa_multiverse(
data,
estimator,
grid,
fixed = list(),
design = NULL,
term = NULL,
.progress = FALSE
)Arguments
- data
A data frame of student-level records.
- estimator
The estimator to run: a function (e.g.
social_gradient) or its name.- grid
A named list of forking paths. Each name is an argument of
estimator; each element is a named list of the alternative values for that argument (the inner names label the choices). All combinations are crossed.- fixed
A named list of arguments held constant across specifications.
- design
Optional
lsa_design()whose fields are added tofixed.- term
Which output term (row of the estimator's coefficients) to track; defaults to the first term.
- .progress
Logical; message each specification as it runs.
Value
An object of class "lsa_multiverse": a list with specs (one row
per specification: a column per forking path plus estimate, ci_lo,
ci_hi) and a summary. Plot it with plot.lsa_multiverse().
Examples
data(pisa_mini)
des <- lsa_design(weight = "W_FSTUWT", repweights = paste0("W_FSTURWT", 1:64))
mv <- lsa_multiverse(
pisa_mini, estimator = social_gradient,
grid = list(
achievement = list(math = paste0("PV", 1:10, "MATH"),
read = paste0("PV", 1:10, "READ")),
curvature = list(linear = FALSE, quadratic = TRUE)
),
fixed = list(escs = "ESCS"), design = des, term = "slope")
mv
#> Multiverse: `social_gradient`, term = slope (4 specifications)
#> median estimate: 39.1 range: [36.8, 41.4]
#> 100% of specifications same-signed; 100% exclude 0 (95% CI)