
Sample approximate plausible values under fitted posterior scoring
Source:R/api-prediction.R
sample_mfrm_plausible_values.RdSample approximate plausible values under fitted posterior scoring
Usage
sample_mfrm_plausible_values(
fit,
new_data,
person = NULL,
facets = NULL,
score = NULL,
weight = NULL,
person_data = NULL,
person_id = NULL,
population_policy = c("error", "omit"),
n_draws = 5,
interval_level = 0.95,
scoring_quad_points = 31L,
readiness_policy = c("error", "review"),
seed = NULL,
scoring_prior = NULL
)Arguments
- fit
Output from
fit_mfrm()estimated withmethod = "MML"ormethod = "JML".- new_data
Long-format data for the future or partially observed units to be scored.
- person
Optional person column in
new_data. Defaults to the person column recorded infit.- facets
Optional facet-column mapping for
new_data. Supply either an unnamed character vector in the calibrated facet order or a named vector whose names are the calibrated facet names and whose values are the column names innew_data.- score
Optional score column in
new_data. Defaults to the score column recorded infit.- weight
Optional weight column in
new_data. Defaults to the weight column recorded infit, if any.- person_data
Optional one-row-per-person data.frame with the background variables required by a latent-regression fit. Ignored for ordinary fitted-object posterior scoring. Intercept-only latent-regression fits can reconstruct the minimal scored-person table internally. This is the scoring-time table for
new_data, not the fit object's replay/export provenance table. For categorical background variables, supply values on the same coding scale used at fit time; the fitted factor levels and contrasts are reused when building the scoring design matrix. Fitted standardization and polynomial/spline bases are also reused; they are not re-estimated from the scoring cohort.- person_id
Optional person-ID column in
person_data.- population_policy
How missing background data are handled when
fituses the latent-regression branch."error"(default) requires complete person-level covariates;"omit"drops scored persons lacking complete covariates and records that omission inpopulation_review.- n_draws
Number of posterior draws per person. Must be a positive integer.
- interval_level
Posterior interval level passed to
predict_mfrm_units()for the accompanying EAP summary table. The same level selects the empirical draw quantiles reported bysummary().- scoring_quad_points
Number of Gauss-Hermite nodes used only for this scoring call. Passed to
predict_mfrm_units()and independent of the fit-time quadrature order. Fixed or adaptive integration is inherited fromfit.- readiness_policy
Source-fit readiness policy passed to
predict_mfrm_units(). Conditional calibration and scoring-integration checks are shared with that function and retained in the returned settings.- seed
Optional seed for reproducible posterior draws.
- scoring_prior
Optional normal scoring prior,
list(mean = ..., sd = ...), passed topredict_mfrm_units().NULLretains the fitted scoring prior. Estimates and draws retain both the original and the supplied prior; checks of the fitted calibration and numerical accuracy are unchanged.
Value
An object of class mfrm_plausible_values with components:
values: one row per person per drawestimates: companion posterior EAP summariesrow_review: row-preparation reviewpopulation_review: optional person-level omission review for latent-regression scoringinput_data: cleaned canonical scoring rows retained fromnew_dataperson_data: cleaned or supplied person-level background data used for latent-regression scoring;NULLotherwisesettings: scoring settingsnotes: interpretation notes
Details
sample_mfrm_plausible_values() uses predict_mfrm_units() to return
draws from each Person's posterior distribution as
a standalone object. It is useful when downstream workflows want repeated
latent-value imputations rather than just one posterior EAP summary.
In the current mfrmr implementation these are approximate plausible
values drawn from the fitted quadrature-grid posterior under the scoring
basis implied by fit, unless scoring_prior explicitly supplies another
normal prior. With the default prior, for ordinary MML fits this is the fitted marginal
calibration; for latent-regression MML fits it is the fitted conditional
normal population model for the scored persons; for JML fits it is the
fixed facet/step calibration together with a standard normal reference prior
on the quadrature grid. They should be interpreted as posterior uncertainty
summaries for the scored persons, not as deterministic future truth values
and not as a claim of full many-facet plausible-values equivalence with
population-model software.
In other words, the JML path here is a practical scoring approximation
layered on top of the fitted joint-likelihood calibration, whereas the
latent-regression MML path uses the fitted one-dimensional conditional
normal population model. Neither path should be described as a full
many-facet plausible-values system with all ConQuest-style extensions.
Interpreting output
valuescontains one row per person per draw.estimatescontains the companion posterior EAP summaries frompredict_mfrm_units().summary()reports draw counts and empirical draw summaries by person.LowerValueandUpperValueuse the requestedinterval_leveland are labelled withIntervalLevelandDrawSummaryBasis. They are empirical quantiles of a finite sample of discrete draws, not the continuous posterior limits in the companion estimates table. With few draws they are coarse; one draw has an unavailable empirical SD. Recreate older summaries from the original plausible-values object to update these limits and labels; no refitting or resampling is needed.
What this does not justify
This helper does not update the calibration, estimate new non-person facet levels, or provide exact future true values. It samples from the quadrature- grid posterior implied by the existing fitted-model scoring basis, using fixed or Person-specific adaptive nodes according to the fit's setting. Calibration and population parameters remain fixed. These draws alone do not validate downstream group comparisons or regressions; those analyses require a compatible conditioning model and sampling design.
References
The underlying posterior scoring follows the usual quadrature-based EAP
framework of Bock and Aitkin (1981). The interpretation of multiple
posterior draws as plausible-value-style summaries follows the general logic
discussed by Mislevy (1991), while the current implementation remains a
practical fitted-object posterior approximation rather than a full published
many-facet plausible-values method. For JML source fits, the quadrature
posterior uses a package-level standard normal reference prior for this
post hoc scoring layer.
Bock, R. D., & Aitkin, M. (1981). Marginal maximum likelihood estimation of item parameters: Application of an EM algorithm. Psychometrika, 46(4), 443-459.
Mislevy, R. J. (1991). Randomization-based inference about latent variables from complex samples. Psychometrika, 56(2), 177-196.
Examples
toy <- load_mfrmr_data("example_core")
keep_people <- unique(toy$Person)[1:18]
toy_fit <- fit_mfrm(
toy[toy$Person %in% keep_people, , drop = FALSE],
"Person", c("Rater", "Criterion"), "Score",
method = "MML",
quad_points = 5,
maxit = 30
)
new_units <- data.frame(
Person = c("NEW01", "NEW01"),
Rater = unique(toy$Rater)[1],
Criterion = unique(toy$Criterion)[1:2],
Score = c(2, 3)
)
pv <- sample_mfrm_plausible_values(toy_fit, new_units, n_draws = 3, seed = 1)
summary(pv)$draw_summary
#> # A tibble: 1 × 23
#> Person Draws MeanValue SDValue LowerValue UpperValue IntervalLevel
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 NEW01 3 -0.373 0.323 -0.56 0 0.95
#> # ℹ 16 more variables: DrawSummaryBasis <chr>, CalibrationMethod <chr>,
#> # Prior <chr>, PriorMean <dbl>, PriorSD <dbl>, PriorSource <chr>,
#> # RetainedPrior <chr>, RetainedPriorMean <dbl>, RetainedPriorSD <dbl>,
#> # WeightedLikelihood <lgl>, UncertaintyBasis <chr>, ScoringAlgorithm <chr>,
#> # SourceScoringReady <lgl>, ScoreIntegrationReady <lgl>, EstimateUse <chr>,
#> # DrawBasis <chr>