Package {mfrmr}


Type: Package
Title: Fast Estimation, Diagnostics, and Generalizability for Many-Facet Models
Version: 0.3.2
Date: 2026-11-26
Description: Estimates many-facet ordered-response measurement models (Rating Scale, Partial Credit, and Generalized Many-Facet Rasch Models) including step constraints, declarative category support, explanatory facet covariates, and joint interactions via high-speed C++ Joint Maximum Likelihood, Jeffreys-penalized Joint Maximum Likelihood with Block-Schur standard errors, Gauss-Hermite and Laplace-adaptive Marginal Maximum Likelihood (with expected a posteriori scoring, Warm's weighted likelihood estimation, latent regression, and sandwich covariances), Conditional Maximum Likelihood, and Laplace empirical Bayes Markov rater drift models. Provides multi-threaded C++ batch estimation, connectivity audits prior to estimation, fit diagnostics, Fair(M), Real SE, 'RajuSA-Welch' pairwise bias and parallel split-element differential facet functioning, color-vision-safe 'ggplot2' graphics, and Generalizability (G-Study) and Decision (D-Study) planning including fast Henderson Method 1 ('urGENOVA') estimation. Connects calibration, diagnostics, visualizations, and Markdown, HTML, or Word report generation in one analysis workflow. See Andrich (1978) <doi:10.1007/BF02293814>, Masters (1982) <doi:10.1007/BF02296272>, Warm (1989) <doi:10.1007/BF02294627>, Raju (1990) <doi:10.1177/014662169001400208>, Uto and Ueno (2020) <doi:10.1007/s41237-020-00115-7>, and Brennan (2001, ISBN:9780387952826).
URL: https://github.com/Ryuya-dot-com/mfrmr
BugReports: https://github.com/Ryuya-dot-com/mfrmr/issues
License: MIT + file LICENSE
Language: en
Encoding: UTF-8
LazyData: true
Depends: R (≥ 4.1)
Imports: dplyr, generics, ggplot2 (≥ 3.5.0), grDevices, graphics, grid, lpSolve, Matrix, methods, rlang, stats, tibble, tidyr, tools, utils
LinkingTo: cpp11 (≥ 0.5.4)
Suggests: callr, flextable, jsonlite, kableExtra, knitr, lme4, minqa, nloptr, officer, pkgload, rmarkdown, RSpectra, testthat (≥ 3.0.0), withr
VignetteBuilder: knitr
Config/testthat/edition: 3
Config/roxygen2/version: 8.1.1
NeedsCompilation: yes
Packaged: 2026-11-26 03:44:13 UTC; tohokusla
Author: Ryuya Komuro ORCID iD [aut, cre, cph]
Maintainer: Ryuya Komuro <ryuya.komuro.c4@tohoku.ac.jp>
Repository: CRAN
Date/Publication: 2026-11-26 08:30:08 UTC

Fast Estimation, Diagnostics, and Generalizability for Many-Facet Models

Description

Estimates Many-Facet Rasch Measurement models (RSM, PCM, and GPCM) including step constraints, declarative category support, explanatory facet covariates, and joint interactions via high-speed C++ Joint Maximum Likelihood, Jeffreys-penalized JML with Block-Schur standard errors, Gauss-Hermite and Laplace-adaptive Marginal Maximum Likelihood (with EAP, Warm's WLE, latent regression, and sandwich covariances), Conditional Maximum Likelihood, and Markov rater drift models. Also provides multi-threaded batch estimation, graph connectivity checks, Fair(M), Real SE, RajuSA-Welch pairwise bias and parallel split-element DFF, color-vision-safe ggplot2 graphics, and Generalizability (G-Study) and Decision (D-Study) planning.

Examples

ratings <- load_mfrmr_data("example_core")
fit <- fit_mfrm(ratings, "Person", c("Rater", "Criterion"), "Score")
summary(fit)$overview

Differential Facet Functioning (Parallel Split-Element LRT, RajuSA-Welch, MH, and Logistic)

Description

Screens Differential Facet Functioning (DFF) of raters, tasks, or criteria across reference and focal groups via warm-started parallel C++ split-element MML LRT (with person-clustered sandwich SEs and latent-regression group impact control), CML LRT, FACETS 4.5.3 RajuSA-Welch contrasts, stratified Mantel-Haenszel, or cumulative-logit LRT.

Usage

analyze_dff(
  fit, facet, group, data = NULL, focal = NULL,
  method = c("mml_lrt", "cml_lrt", "raju_welch", "mh", "logistic"),
  df_method = c("facets", "classical"), min_obs = 10, p_adjust = "holm",
  threads = 1L)

Arguments

fit

A fitted model object returned by fit_mfrm.

facet

Character string naming the model facet to screen for differential functioning (e.g., "Rater" or "Criterion").

group

Character string naming the grouping variable in data (e.g., examinee cohort or demographic group).

data

Optional data.frame containing group alongside the rating columns; defaults to the retained calibration data.

focal

Optional character string specifying the focal group level in group. Positive Contrast indicates higher severity/difficulty against the focal group.

method

DFF test family: "mml_lrt" (default C++ split-element MML likelihood-ratio test), "cml_lrt" (C++ split-element CML LRT), "raju_welch" (fixed-calibration pairwise contrast), "mh" (stratified mean-score Mantel-Haenszel), "logistic" (cumulative-logit uniform/non-uniform LRT).

df_method

Degrees-of-freedom convention when method = "raju_welch" ("facets" or "classical").

min_obs

Minimum required ratings per group for an element to be tested (default 10).

p_adjust

Multiple-testing adjustment method passed to p.adjust (default "holm").

threads

Integer number of C++ worker threads for parallel split-element refits (default 1L).

Details

When _R_CHECK_LIMIT_CORES_ requests a core limit, native worker counts are capped at two. The default remains one worker.

Split-likelihood tests support unified, unpenalized RSM/PCM calibrations without anchors, custom facet/step constraints, interactions or restricted category support. Unsupported specifications are rejected rather than dropped. Weights, facet signs and integration/optimizer controls are retained. The selected test method determines the refitting estimator. With method = "mml_lrt", both models are refitted by MML even if the supplied calibration was estimated by JML. MML refits retain source population covariates and add person-level group impact when linearly independent; a fixed-normal source is explicitly extended to an estimated population. Both the baseline and split models use this same population design. A group varying within person cannot be a person-level impact covariate. CML tests condition on person totals and do not use a population distribution.

Both likelihood refits must pass numerical readiness and likelihood checks. Otherwise SE, Statistic, pValue, pAdj and Flagged are NA, with InferenceStatus/InferenceReason. ElementsTested in summaries counts available tests; ElementsUnavailable counts unavailable rows. An all-unavailable Flagged count is NA. These checks do not establish finite-sample test size or power.

RajuSA-Welch analysis holds the source calibration fixed, including GPCM slopes, and appends a zero-valued group context without recalibration. Other fixed-calibration screens also withhold inferential output if the source is not ready. Supplied data must contain exactly the retained calibration ratings and weights; reordered rows are aligned before adding group labels.

Value

An S3 object of class "mfrm_dff" containing table (Facet, Level, ReferenceGroup, FocalGroup, ObsRef, ObsFocal, Contrast, SE, Statistic, df, pValue, pAdj, Flagged), method, reference, and focal. Supports summary() and plot().

See Also

fit_mfrm, estimate_bias, plot.mfrm_fit

Examples

# Saved JML calibration of example_bias, with planted Group x Criterion DFF.
saved <- readRDS(system.file("examples", "bias-jml.rds", package = "mfrmr"))
ratings <- load_mfrmr_data(saved$dataset)
fit <- saved$fit
# Fixed-calibration screen: no split-model refitting.
dff <- analyze_dff(fit, facet = "Criterion", group = "Group", data = ratings,
                   method = "raju_welch")
summary(dff)
plot(dff)

Link and Calibrate New Ratings Against Baseline Facet Anchors

Description

Extracts element anchors from a baseline calibration (baseline_fit), calibrates a new rating cohort (new_data) on the baseline logit scale, and optionally compares benchmark elements to estimates linked through declared stable reference anchors.

Usage

anchor_to_baseline(
  new_data, baseline_fit, person, facets, score, anchor_facets = NULL,
  include_person = FALSE, weight = NULL, model = NULL, method = NULL,
  anchor_policy = "warn", mml_integration = NULL, centering_scope = NULL,
  ..., drift_reference = NULL)

Arguments

new_data

A data.frame of observed ratings from the new administration or wave.

baseline_fit

A fitted baseline model object from fit_mfrm.

person

Character string naming the person identifier column in new_data.

facets

Character vector naming non-person facet columns in new_data.

score

Character string naming the numeric score column in new_data.

anchor_facets

Optional subset of facets to anchor to baseline_fit (defaults to all common non-person facets).

include_person

Logical; whether to anchor common persons as well (default FALSE).

weight

Optional observation weight column name in new_data.

model

Optional model family override; defaults to baseline_fit's model.

method

Optional estimation method override; defaults to baseline_fit's method.

anchor_policy

Policy for anchors absent from new_data ("warn", "error", or "silent").

mml_integration

Optional MML quadrature mode override.

centering_scope

Optional centering scope ("remainder" or "facet").

drift_reference

Optional data frame of stable baseline anchor IDs with columns Facet and Level, for the unified engine. Reference elements set the origin for non-reference elements in the same facet.

...

Additional arguments forwarded to fit_mfrm.

Value

An S3 object of class "mfrm_anchored_fit" containing fit (new cohort calibrated on the baseline scale), diagnostics, baseline_anchors, and drift (element-by-element change on the linked scale). For unified fits without an independent reference, Drift and Flag are unavailable. In supported additive RSM/PCM fits, the comparison is conditional on the supplied baseline reference and uses the new-fit standard error. It is distinct from the local conditional displacement reported for a fixed element or group in a single fitted calibration. Supports summary().

See Also

make_anchor_table, detect_anchor_drift, fit_mfrm

Examples

ratings <- load_mfrmr_data("example_core")
wave1 <- subset(ratings, Group == "A")
wave2 <- subset(ratings, Group == "B")

base_fit <- fit_mfrm(wave1, person = "Person", facets = c("Rater", "Criterion"), score = "Score")
linked <- anchor_to_baseline(
  wave2,
  baseline_fit = base_fit,
  person = "Person",
  facets = c("Rater", "Criterion"),
  score = "Score",
  anchor_facets = "Criterion"
)
linked$drift

Apply Empirical Bayes Shrinkage to Facet and Person Estimates

Description

Applies post-estimation precision-weighted Empirical Bayes shrinkage toward each facet's mean location using estimated between-element variance \hat{\tau}^2 = \max(0, s_{\hat{\beta}}^2 - \overline{\mathrm{SE}^2}) (or a user-supplied facet_prior_sd), stabilizing noisy estimates for low-exposure raters or tasks.

Usage

apply_empirical_bayes_shrinkage(
  fit, facet_prior_sd = NULL, shrink_person = FALSE)

Arguments

fit

A fitted model object returned by fit_mfrm.

facet_prior_sd

Optional positive numeric prior standard deviation (in logits) overriding empirical \hat{\tau}.

shrink_person

Logical; if TRUE, also computes shrunk person estimates in fit$person (default FALSE).

Value

An updated fit object retaining original Estimate and adding ShrunkEstimate and ShrunkSE columns in fit$facets (and fit$person when shrink_person = TRUE).

See Also

fit_mfrm

Examples

ratings <- load_mfrmr_data("example_operational")
fit <- fit_mfrm(
  ratings, person = "Person", facets = c("Rater", "Criterion"), score = "Score"
)

shrunk <- apply_empirical_bayes_shrinkage(fit)
cols <- c("Facet", "Level", "ObsCount", "Estimate", "ShrunkEstimate", "ShrunkSE")
shrunk$facets[, cols]

Augment Observation Rows with Expected Scores and Standardized Residuals

Description

Appends observation-level expected rubric scores, raw and standardized Pearson residuals, observed category probabilities, and unexpected-response flags (⁠|StdResidual| >= 2.0⁠) to the analyzed rating rows.

Usage

augment(x, ...)

## S3 method for class 'tidymfrm'
augment(x, ...)

Arguments

x

A tidymfrm object.

...

Additional arguments (unused).

Value

A tibble::tibble() of observation-level expectations and residuals.

Examples

# Saved JML calibration of example_core; see fit_mfrm() for estimation.
saved <- readRDS(system.file("examples", "core-jml.rds", package = "mfrmr"))
ratings <- load_mfrmr_data(saved$dataset)
wf <- mfrm_workflow(ratings, "Person", c("Rater", "Criterion"), "Score",
                    fit = saved$fit)
head(augment(wf))

Audit Multi-Facet Rating Graph Connectivity and Category Support in C++

Description

Performs a fast pre-estimation C++ union-find connectivity and category-support audit on a rating table before fitting a Many-Facet Rasch model. Identifies disconnected rating subsets (islands lacking shared persons, raters, tasks, anchors, or explanatory covariates) and checks whether interior rubric categories are observed.

Usage

check_mfrm_connectivity(
  data, person, facets, score, model = c("RSM", "PCM", "GPCM"),
  step_facet = NULL, rating_min = NULL, rating_max = NULL, anchors = NULL,
  group_anchors = NULL, dummy_facets = NULL, category_support = NULL,
  facet_formulas = NULL, facet_data = NULL, rater_facet = NULL,
  network = FALSE, rater_panels = NULL)

Arguments

data

A data.frame of observed ratings (one row per rating).

person

Character string naming the person identifier column.

facets

Character vector naming non-person facet columns (e.g., c("Rater", "Criterion")).

score

Character string naming the numeric rubric score column.

model

Measurement model family ("RSM", "PCM", or "GPCM").

step_facet

Facet owning category thresholds when model is "PCM" or "GPCM".

rating_min

Optional integer minimum rubric score.

rating_max

Optional integer maximum rubric score.

anchors

Optional individual element anchor data.frame (Facet, Level, Anchor) linking subsets to a common logit origin.

group_anchors

Optional group-mean anchor data.frame (Facet, Level, Group, GroupValue).

dummy_facets

Optional character vector of facets fixed at 0 logits.

category_support

Optional data.frame with Level, Min, and Max declaring inclusive per-level bounds on the original rubric scale.

facet_formulas

Optional named list of explanatory facet covariate formulas.

facet_data

Optional named list of element covariate data.frames.

network

Logical. Compute the Fiedler value of the unnormalized observed Person-by-rater Laplacian. Large graphs use the optional RSpectra package.

rater_panels

Optional named character vector assigning observed rater IDs to two or more panels. Compute resistance between equal-weight panel mean contrasts.

rater_facet

Facet for the observed Person-by-rater comparison graph. If NULL, infer a rater-like name when possible.

Value

A list containing the multi-facet graph status and counts, per-person score and subset summaries, facet subsets, and the interior category support flag. When a rater facet is available, rater_linkage gives the observed Person-by-rater component table and the persons whose individual removal separates the remaining observed panels. This graph uses shared persons, independently of anchors and shared levels of other facets. Each observed Person-by-rater pair contributes one edge regardless of the number of criteria or repeated scores. The Fiedler value is zero for a disconnected graph. A panel contrast that requires current to cross disconnected components has infinite effective resistance. These statistics describe assignment structure.

See Also

fit_mfrm, describe_mfrm_data

Examples

# Check incomplete two-rater operational assignment (48 persons, 6 raters, 3 criteria)
ratings <- load_mfrmr_data("example_operational")
conn <- check_mfrm_connectivity(
  ratings,
  person = "Person",
  facets = c("Rater", "Criterion"),
  score = "Score"
)
conn$connected
conn$n_subsets
conn$rater_linkage

Compute Cut-Score Classification Accuracy and Consistency Indices

Description

Computes conditional and population-weighted classification accuracy, consistency, overclassification, and underclassification probabilities under a specified multi-facet rating plan using both Lee's (2010) exact summed-score convolution method ("lee_sum") and Rudner's (2005) asymptotic normal ability-estimate approximation ("rudner_normal").

Usage

classification_table(
  fit, rating_plan = NULL, cut_scores = 0, score_cuts = NULL,
  theta = seq(-3, 3, by = 0.5), theta_weights = NULL,
  operational_cuts = cut_scores, facets = NULL,
  readiness_policy = c("error", "review"))

Arguments

fit

A converged "RSM" or "PCM" calibration returned by fit_mfrm.

rating_plan

A data.frame listing the planned facet cells (one row per rating in one examinee's assessment plan). Defaults to the unique observed facet combinations on C++ fits.

cut_scores

Sorted numeric vector of true latent ability cutoffs in logits.

score_cuts

Nondecreasing integer vector of summed-score cutoffs (on 0..max_sum), one per cut_scores entry, for Lee's summed-score rule. Computed proportionally if NULL on C++ fits.

theta

Numeric vector of latent ability evaluation points.

theta_weights

Optional nonnegative numeric weights matching theta to compute marginal population accuracy/consistency and the joint classification matrix.

operational_cuts

Sorted numeric vector of operational logit ability cutoffs used by Rudner's decision rule (defaults to cut_scores).

facets

Optional character vector mapping rating_plan column names to model facets.

readiness_policy

"error" (rejects calibrations with boundary exclusions or non-convergence) or "review" (retains conditional indices tagged SourceStatus = "review_required").

Value

A list containing table (conditional accuracy, consistency, over/underclassification, expected sum, information, and SEM at each theta), marginal (population-weighted summary when theta_weights is supplied), classification_matrix (joint true-by-observed category probabilities), cuts, probabilities, scores, and notes.

See Also

fit_mfrm, compute_information

Examples

ratings <- load_mfrmr_data("example_core")
fit <- fit_mfrm(ratings, person = "Person", facets = c("Rater", "Criterion"), score = "Score")

# Evaluate a 2-rater x 4-criterion (8-rating, max category sum = 24) pass/fail plan at 0 logits
plan <- expand.grid(
  Rater = c("R01", "R02"),
  Criterion = c("Content", "Organization", "Language", "Accuracy"),
  stringsAsFactors = FALSE
)
th_grid <- seq(-3, 3, by = 0.5)
cls <- classification_table(
  fit,
  rating_plan = plan,
  cut_scores = 0,
  score_cuts = 12,
  theta = th_grid,
  theta_weights = stats::dnorm(th_grid)
)
cls$marginal

Compare Many-Facet Models via Information Criteria and Affine-Subspace LRT

Description

Compares two or more fitted Many-Facet models by log-likelihood, AIC, BIC, and (when nested = TRUE or called via anova()) formal likelihood-ratio tests after algebraically verifying affine parameter-subspace nesting across facet locations, step constraints, and GPCM log-slopes.

Usage

compare_mfrm(
  ..., labels = NULL, warn_constraints = TRUE, nested = FALSE)

Arguments

...

Two or more fitted model objects from fit_mfrm.

labels

Optional character vector of model labels.

warn_constraints

Logical; whether to warn when compared models differ in estimation method, sample size, or non-nested parameter subspaces.

nested

Logical; if TRUE, verifies affine subspace containment via SVD and computes sequential chi-square likelihood-ratio tests for nested MML or CML models.

Value

An S3 object of class "mfrm_comparison" containing table (Model, Family, Method, N, FreeParams, LogLik, AIC, BIC, DeltaAIC, DeltaBIC), lrt (sequential LRT table when nested = TRUE and models are verified nested), and comparison_basis.

See Also

fit_mfrm, mfrmr-s3-methods

Examples

ratings <- load_mfrmr_data("example_core")
fit_rsm <- fit_mfrm(ratings, "Person", c("Rater", "Criterion"), "Score", model = "RSM")
fit_pcm <- fit_mfrm(ratings, "Person", c("Rater", "Criterion"), "Score",
                    model = "PCM", step_facet = "Criterion")

cmp <- compare_mfrm(fit_rsm, fit_pcm, labels = c("RSM", "PCM"), nested = TRUE)
cmp$table
cmp$lrt

Compute Category Probability and Fisher Test Information Curves

Description

Evaluates Fisher test information I(\theta), conditional standard error \mathrm{SE}(\theta) = 1 / \sqrt{I(\theta)}, expected total score, and reference category probability curves across a grid of latent ability values for "RSM", "PCM", and "GPCM" calibrations.

Usage

compute_information(
  fit, theta_range = c(-6, 6), theta_points = 201L, rating_plan = NULL,
  exposure_basis = c("observed_total", "per_person_average"))

Arguments

fit

A fitted model object returned by fit_mfrm.

theta_range

Numeric vector of length 2 giving the lower and upper logit bounds of the theta grid (default c(-6, 6)).

theta_points

Integer number of evaluation points along theta_range (default 201L).

rating_plan

Optional data.frame with every non-Person facet and positive integer Count for one person's planned ratings. Supply calibrated levels only and combine repeated combinations in Count.

exposure_basis

With observed ratings, use "observed_total" for all retained exposure or "per_person_average" to divide by the number of retained persons. With the argument omitted, the reference curve counts each observed context once.

Details

Information is additive for conditionally independent ratings with fixed calibration. Conditional SE does not propagate calibration uncertainty. Fitted calibrations report the exposure basis and counts and flag new combinations of calibrated levels in exposures$ObservedContext. An unsupported or numerically unready calibration cannot be used for a precision curve.

Value

An S3 object of class "mfrm_information" containing test_information (Theta, Information, SE, ExpectedScore) and category_curves (ScaleLevel, Theta, Category, Probability). Supports plot.mfrm_fit.

See Also

fit_mfrm, classification_table, plot.mfrm_fit

Examples

# Saved JML calibration of example_core; see fit_mfrm() for estimation.
saved <- readRDS(system.file("examples", "core-jml.rds", package = "mfrmr"))
fit <- saved$fit

info <- compute_information(fit, theta_range = c(-4, 4), theta_points = 81L)
head(info$test_information)
plot(info, type = "information")

Compute Parametric Person-Fit Statistics (lz and Outfit/Infit Screening)

Description

Computes the standardized log-likelihood person-fit index l_z (Drasgow, Levine, & Williams, 1985) alongside person-level InfitMnSq and OutfitMnSq from a fitted Many-Facet model or diagnostic bundle to screen aberrant examinee rating patterns.

Usage

compute_person_fit_indices(
  diagnostics, fit = NULL)

Arguments

diagnostics

Either a fitted model object from fit_mfrm or a diagnostic bundle from diagnose_mfrm.

fit

Optional matching fit_mfrm object when diagnostics is a legacy diagnostic bundle.

Details

For each retained response, category probabilities give the log-probability mean and variance. If any response term for a person is unavailable, the person statistic is withheld rather than computed on a selected subset.

For converged, unpenalized JML person estimates with unit weights, the conditional ability correction projects centered log likelihood off the person likelihood score. With total log-likelihood variance V, score information I, log-likelihood/score covariance C, centered log likelihood L-E(L) and observed score derivative U, the reported correction is

l_z^* = \frac{L-E(L)-(C/I)U}{\sqrt{V-C^2/I}}.

These moments sum over the person's observed rating design and condition on the fitted non-person calibration. They do not include calibration uncertainty. The correction is not supplied for EAP, WLE, penalized or adjusted person scores, non-unit weights, nonconvergence, or insufficient information. Their status remains explicit.

The two-sided normal-reference cutoffs 1.96 and 2.58 are screening references, not calibrated individual or familywise error rates. Short, sparse or dependent rating patterns need design-specific validation. The plot uses the same reported index and flags; Outfit above 1.50 is shown separately. Neither flag alone establishes aberrant behavior.

Value

A data frame of class mfrm_person_fit_indices for either engine. TotalN, N and UnavailableN count retained, usable and unavailable response terms. LogLik, lz, lz_star and lz_star_status describe the statistics and correction eligibility. ReportIndex, ReportValue and ReportFlag use the corrected index when available, otherwise uncorrected l_z. ReportCaveat records the interpretation limits. Infit and Outfit are separate descriptive indices. Compatibility aliases ObsCount, L0 and Flagged refer to N, LogLik and ReportFlag; x$table returns the same table as a plain data frame. Use summary(x) for an overview.

References

Snijders, T. A. B. (2001). Asymptotic null distribution of person fit statistics with estimated person parameter. Psychometrika, 66, 331–342. doi:10.1007/BF02294437.

Sinharay, S. (2016). Asymptotically correct standardization of person-fit statistics beyond dichotomous items. Psychometrika, 81, 992–1013. doi:10.1007/s11336-015-9465-x.

See Also

diagnose_mfrm, plot.mfrm_fit

Examples

ratings <- load_mfrmr_data("example_core")
fit <- fit_mfrm(ratings, person = "Person", facets = c("Rater", "Criterion"), score = "Score")

pfit <- compute_person_fit_indices(fit)
summary(pfit)
plot(fit, type = "person_fit")

Summarize Rating Design Structure, Sparsity, Overlap, and Missing Codes

Description

Audits raw rating tables prior to calibration: summarizes category frequencies, element exposure counts, rater-pair shared-unit overlap, connectivity, duplicate cells, declared missing-value codes, and optional structural omissions relative to a planned assignment roster (expected_design).

Usage

describe_mfrm_data(
  data, person = NULL, facets = NULL, score = NULL, weight = NULL,
  rating_min = NULL, rating_max = NULL, keep_original = FALSE,
  missing_codes = NULL, include_person_facet = FALSE,
  include_agreement = TRUE, rater_facet = NULL, context_facets = NULL,
  agreement_top_n = NULL, expected_design = NULL, min_linking_persons = 2L,
  category_policy = NULL, repeated_ratings = c("review", "independent"),
  comparisons = NULL, spec = NULL)

Arguments

data

A data.frame of observed ratings.

person

Character string naming the person identifier column.

facets

Character vector naming non-person facet columns.

score

Character string naming the numeric rating column.

weight

Optional character string naming an observation weight column.

rating_min

Optional integer minimum rubric score.

rating_max

Optional integer maximum rubric score.

keep_original

Logical; whether to retain original uncleaned columns in internal audit tables.

missing_codes

Optional vector of values in score to recode as missing (NA) prior to summarizing.

include_person_facet

Logical; whether to include individual person exposure rows in element tables.

include_agreement

Logical; whether to compute pairwise rater overlap and exact agreement summaries (default TRUE).

rater_facet

Optional character string identifying the rater facet for overlap summaries.

context_facets

Optional character vector of non-rater context facets defining rating units.

agreement_top_n

Optional integer limiting displayed pairwise overlap rows.

expected_design

Optional score-free roster data.frame of planned facet cells used to distinguish planned omissions from unassigned cells.

min_linking_persons

Minimum shared persons treated as adequate pairwise rater linkage (default 2L).

category_policy

Optional category-gap handling policy ("preserve" or "collapse").

repeated_ratings

Policy for duplicate person-by-facet cells ("review" or "independent").

comparisons

Optional subgroup comparison specification.

spec

Optional named specification list shared with fit_mfrm.

Value

An S3 object of class "mfrm_data_description" supporting print() and summary(), containing design counts, category distributions, element exposure summaries, rater overlap tables, and structural missingness checks.

See Also

check_mfrm_connectivity, interrater_agreement, fit_mfrm

Examples

ratings <- load_mfrmr_data("example_operational")
desc <- describe_mfrm_data(
  ratings,
  person = "Person",
  facets = c("Rater", "Criterion"),
  score = "Score"
)
summary(desc)$overview

Screen Element Parameter Displacement and Anchor Drift Across Waves

Description

Compares common facet element location estimates across two or more separately calibrated administration waves against a designated reference wave, flagging elements with large absolute displacement (|Drift| > drift_threshold) or standardized displacement (|z| > flag_se_ratio).

Usage

detect_anchor_drift(
  fits, facets = NULL, drift_threshold = 0.5, flag_se_ratio = 2,
  reference = 1L, include_person = FALSE)

Arguments

fits

Named or unnamed list of two or more fitted fit_mfrm objects representing administration waves.

facets

Optional character vector restricting drift screening to selected facets.

drift_threshold

Absolute logit displacement threshold for flagging (default 0.5).

flag_se_ratio

Standardized |Drift| / SE threshold for flagging (default 2).

reference

Name or integer index of the reference wave in fits (default 1L).

include_person

Logical; whether to include common persons (default FALSE).

Details

Estimates must already share a meaningful scale, model and origin. This screen does not estimate an equating transformation. The standard error is the square root of the sum of the two marginal variances and assumes independent wave estimates; repeated persons or overlapping ratings can violate that assumption. When either calibration is not ready for inference, displacement is retained but standard errors, tests and flags are unavailable. With include_person = TRUE, common persons are included unless excluded by facets.

Value

An S3 object of class "mfrm_anchor_drift" containing table (per-element EstRef, EstWave, Drift, SE, z, pValue, Flagged, and Status) and reference.

See Also

anchor_to_baseline, fit_mfrm_drift

Examples

ratings <- load_mfrmr_data("example_core")
f1 <- fit_mfrm(subset(ratings, Group == "A"), "Person", c("Rater", "Criterion"), "Score")
f2 <- fit_mfrm(subset(ratings, Group == "B"), "Person", c("Rater", "Criterion"), "Score")

drift_chk <- detect_anchor_drift(list(Wave1 = f1, Wave2 = f2), facets = "Rater")
drift_chk$table

Compute Element Fit Diagnostics, Reliability, Separation, and Unexpected Cells

Description

Summarizes facet- and person-level measurement quality from a fitted Many-Facet model, including Infit and Outfit mean-square (MnSq) and standardized (ZSTD) fit statistics, ModelSE- vs RealSE-based separation, reliability, Strata, homogeneity chi-square tests, and standardized unexpected response cells (|StdResidual| >= 2).

Usage

diagnose_mfrm(
  fit,
  residual_pca = c("none", "overall", "facet", "both"),
  pca_max_factors = 10L)

Arguments

fit

A fitted model object returned by fit_mfrm.

residual_pca

Optional residual principal-components mode ("none", "overall", "facet", or "both").

pca_max_factors

Maximum number of residual PCA factors extracted when residual_pca != "none".

Details

Unified diagnostics include readiness, independently of optimizer convergence. When unready, homogeneity tests are withheld (NA) and plots omit interval bars; descriptive estimates and fit statistics remain available. Summary/print output and plot notes retain the reasons, including after saving and reloading the diagnostic object. Numerical readiness is not a guarantee of interval coverage or fit-screening accuracy.

Residual PCA averages standardized residuals for each Person and selected facet level or joint context. Results are exploratory. Missing or non-positive semidefinite pairwise correlations are reported as unavailable. For example, use plot(diagnose_mfrm(fit, residual_pca = "facet"), facet = "Criterion", type = "residual_pca") to see the first contrast.

For primary EAP person scores, model reliability is v/(v+s), where v is the sample variance of finite EAP estimates (denominator n-1) and s is the mean squared posterior SD for the same persons. Model separation is \sqrt{v/s}. This describes posterior score separation conditional on the fitted calibration; it is not repeated-sample classification accuracy. RealReliability substitutes the fit-inflated RealSE and is a descriptive extension of that formula. For WLE/JML person scores and facet estimates, true-score variance is estimated as \max(0,v-s) and reliability as \max(0,v-s)/v. ReliabilityBasis identifies which construction is used. Undefined quantities remain NA.

Value

An S3 diagnostic bundle of class "mfrm_diagnostics" containing reliability (per-facet ModelReliability, RealReliability, ModelSeparation, RealSeparation, Strata, and HomogeneityChiSq), measures (element-level Estimate, ModelSE, RealSE, FairM, Infit, InfitZSTD, Outfit, OutfitZSTD), and unexpected (flagged rating rows sorted by |StdResidual|).

See Also

fit_mfrm, compute_person_fit_indices, fair_average_table, plot.mfrm_fit

Examples

ratings <- load_mfrmr_data("example_operational")
fit <- fit_mfrm(ratings, person = "Person", facets = c("Rater", "Criterion"), score = "Score")
diag <- diagnose_mfrm(fit)

# Inspect reliability/separation per facet and top unexpected rating rows
diag$reliability
head(diag$unexpected, 5)
summary(diag)

Legacy synthetic MFRM datasets inspired by Eckes and Jin (2021)

Description

Synthetic many-facet rating datasets in long format. All datasets include one row per observed rating.

Format

A data.frame with 5 columns:

Study

Study label ("Study1" or "Study2").

Person

Person/respondent identifier.

Rater

Rater identifier.

Criterion

Criterion facet label.

Score

Observed category score.

Details

Available data objects:

Naming convention:

Use load_mfrmr_data() for programmatic selection by key.

Data dimensions

Dataset Rows Persons Raters Criteria
study1 1842 307 18 3
study2 3287 206 12 9
combined 5129 307 18 12
study1_itercal 1842 307 18 3
study2_itercal 3341 206 12 9
combined_itercal 5183 307 18 12

Score range: 1–4 (four-category rating scale).

For the combined rows, Persons and Raters count unique raw labels. Treating the two Study labels as distinct namespaces would instead give 513 person labels and 30 rater labels, but would leave two unlinked components.

Provenance and limits

These are legacy synthetic datasets whose stored responses reproduce the dimensions described above. The exact response-generation code and random seed are not available, so the objects must not be used as parameter-recovery evidence or as evidence for a particular generating distribution. The separately stored ⁠_itercal⁠ objects can differ in observed rows as well as scores; they are legacy variants, not empirical calibration standards or a controlled one-parameter recalibration.

Combined-data caution

The combined objects reuse P001–P206 and R01–R12 across the two study labels. A combined analysis is meaningful only when those labels encode an intended cross-study identity and an explicit anchor or linking design establishes a common scale. Prefixing Person and Rater by Study removes accidental label collisions, but it creates disconnected study components and does not by itself establish a common scale. Analyze the studies separately unless the linking design has been specified and reviewed. The combined datasets are not beginner workflow examples or direct-fit examples.

Interpreting output

The study-specific datasets are in long format and can be passed to fit_mfrm() after confirming column-role mapping. The combined objects require a reviewed identity and anchor/linking design before a joint fit; row-binding or prefixing identifiers alone does not create a common scale.

Typical workflow

  1. Inspect available datasets with load_mfrmr_data("list").

  2. Load one dataset using load_mfrmr_data().

  3. Fit and diagnose with fit_mfrm() and diagnose_mfrm().

Source

Simulated for this package with design settings informed by Eckes and Jin (2021). The Eckes & Jin (2021) Method section reports the following design parameters that motivated the synthetic versions shipped here: Study 1 had 307 examinees (149 males, 158 females), 18 raters (4 males, 14 females), and 3 criteria (global impression, task fulfillment, linguistic realization) on a 4-category rating scale (TDN levels rescored 1-4); Study 2 had 206 examinees (66 males, 140 females), 12 raters (1 male, 11 females), and 9 criteria on the same 4-category scale. The packaged datasets reproduce these (examinees, raters, criteria, categories) shapes but use simulated responses, so they are not the real TestDaF data.

References

Eckes, T., & Jin, K.-Y. (2021). Measuring rater centrality effects in writing assessment: A Bayesian facets modeling approach. Psychological Test and Assessment Modeling, 63(1), 65–94.

Examples

data("ej2021_study1", package = "mfrmr")
head(ej2021_study1)
table(ej2021_study1$Study)

Estimate 2-Way and All-Pairs Facet Bias with FACETS 4.5.3 RajuSA-Welch Contrasts

Description

Computes fast C++ fixed-measure 2-way local bias tables (FACETS Table 13) and pairwise contrasts (Table 14) for one facet pair or interaction_facets = "all", defaulting to the FACETS 4.5.2/4.5.3 RajuSA-Welch integer-truncated Welch-Satterthwaite degrees of freedom (von Davier, 2025; Raju, 1990), or fits a joint C++ interaction model with omnibus likelihood-ratio test when method = "joint".

Usage

estimate_bias(
  fit, facet_a = NULL, facet_b = NULL,
  interaction_facets = NULL, method = c("local", "joint"),
  df_method = c("facets", "classical"), p_adjust = "holm")

Arguments

fit

A fitted model object returned by fit_mfrm.

facet_a

Optional character string naming the first interaction facet.

facet_b

Optional character string naming the second interaction facet.

interaction_facets

Character vector of two facet names, or "all" to screen all 2-way non-person facet pairs.

method

"local" (fixed-calibration post-hoc bias and pairwise contrasts) or "joint" (simultaneous C++ main-effect + sum-to-zero interaction refit with omnibus LRT).

df_method

Degrees-of-freedom convention for pairwise contrasts: "facets" (FACETS 4.5.3 RajuSA-Welch integer truncation with df >= 1 floor) or "classical" (untruncated Welch-Satterthwaite).

p_adjust

Multiple-testing adjustment method passed to p.adjust (default "holm").

Details

Local GPCM calculations retain the fitted observation discrimination products and the chosen full-predictor or ability-only formula. Their cell curvature SEs condition on the calibration and person estimates; pairwise SEs combine these conditional cell errors. They do not propagate calibration uncertainty or guarantee finite-sample coverage. RajuSA-Welch labels identify the contrast/df convention, not independent validation of every GPCM extension.

Joint refits append only the declared zero-margin interaction to the source encoding, retaining weights, anchors/constraints, population covariates, discrimination specification and numerical controls. An already included interaction or an empirically shrunk source is rejected. The omnibus LRT is returned only when the common nested-likelihood checks used by anova() are satisfied; otherwise lrt is NULL and comparison_basis explains the restriction.

InferenceStatus and InferenceReason accompany the screening rows. Unready calibrations retain descriptive estimates but return NA for interval SEs and p-values. All-unavailable screen counts are NA, not zero. Numerical readiness is not a guarantee of coverage or diagnostic accuracy. Older saved calibrations require refitting with the current fit_mfrm().

Value

An S3 object of class c("mfrm_bias", "mfrm_bundle") containing table (cell-level bias estimates, BiasSE, t, df, pValue, pAdj), pairwise (pairwise context contrasts with TestType, df, dfUnrounded, pAdj), summary, and (when method = "joint") lrt and joint_fit.

See Also

fit_mfrm, analyze_dff, plot.mfrm_fit

Examples

# Screen planted Rater x Criterion interaction (R04 x Accuracy) in example_bias
ratings <- load_mfrmr_data("example_bias")
fit <- fit_mfrm(ratings, person = "Person", facets = c("Rater", "Criterion"), score = "Score")

bias <- estimate_bias(fit, interaction_facets = c("Rater", "Criterion"), df_method = "facets")
head(bias$table[order(-abs(bias$table$t)),
                c("LevelA", "LevelB", "ObsExpAvg", "BiasSize", "BiasSE", "t", "pAdj")], 5)
plot(bias, type = "forest")

Compute Reference-Standardized Fair(M) and Zero-Reference Fair(Z) Expected Scores

Description

Translates latent logit parameter estimates for persons and non-person facets back onto the original rubric score scale by computing model-expected average ratings against a cohort-mean reference context (FairM) and a zero-logit reference context (FairZ), alongside raw observed averages (ObsAvg).

Usage

fair_average_table(fit, diagnostics = NULL, facets = NULL, umean = 0,
  uscale = 1, fair_se = FALSE, ci_level = 0.95, reference_plan = NULL)

Arguments

fit

A fitted model object returned by fit_mfrm.

diagnostics

Optional precomputed diagnose_mfrm object from the same calibration.

facets

Optional character vector filtering which facets (including "Person") to return.

umean

Additive origin shift applied to reported logit measures umean + uscale * Estimate (default 0).

uscale

Multiplicative scale factor applied to reported logit measures and SE (default 1).

fair_se

Logical; request uncertainty. Supply a common reference_plan.

ci_level

Confidence level in (0, 1) when intervals are requested (default 0.95).

reference_plan

Optional common rating plan data.frame containing exactly all fitted base facet columns plus optional Weight. Levels must be known, cells unique and weights finite and strictly positive. Weights are normalized to sum to one.

Details

Printing shows the common-plan reference_scores, including conditional intervals when requested, before the observed-design Fair(M) tables. Observed-design Fair(M) uses finite facet-level means, an observation-weighted geometric reference discrimination for GMFRM, and each person's weighted step-group mix. A geometric-mean-one identification constraint is not itself a reference-panel definition. Use an explicit reference_plan to compare people or models against the same specified rating plan.

confint(x, level = 0.95) returns these conditional person-score intervals for a fair-average table with a reference plan. These intervals hold calibration parameters fixed; they do not propagate estimated-anchor or calibration uncertainty. Legacy refit-bootstrap and joint-delta arguments are not supported by this method.

For the unified engine, reference_scores$Estimate is the weighted mean model-expected rating under the same supplied plan for every person, conditional on that person's primary ability estimate. It is on the original rubric scale (Units = "original_score"). The plan preserves the fitted locations, steps, interactions and slopes; its scores can therefore differ from FairM/FairZ. An EAP plug-in score is not the posterior mean of the transformed score. With fair_se = TRUE, the unified engine transforms the endpoints of a normal interval for the primary person measure under the supplied plan. For EAP these are conditional normal posterior approximations. Calibration and plan weights are held fixed. The point estimate remains a plug-in expected score. Unavailable bounds remain NA with an uncertainty status. The SE column in the facet table stays on the latent measure scale.

Value

An S3 object of class "mfrm_fair_average" containing stacked (combined data.frame with Facet, Level, ObsCount, ObsAvg, ExpAvg, FairM, FairZ, Measure, and SE) and raw_by_facet (named list of per-facet data.frames). When a plan is supplied, also returns reference_plan with NormalizedWeight, and reference_scores with one person per row.

See Also

fit_mfrm, diagnose_mfrm

Examples

# Compare raw observed averages (ObsAvg) against rater-adjusted Fair(M) on incomplete panels
ratings <- load_mfrmr_data("example_operational")
fit <- fit_mfrm(ratings, person = "Person", facets = c("Rater", "Criterion"), score = "Score")

fair <- fair_average_table(fit, facets = c("Person", "Rater"))
head(fair$raw_by_facet$Person, 5)
fair$raw_by_facet$Rater

# Put every person on the same weighted panel (original score scale).
plan <- data.frame(Rater = c("R01", "R04"),
                   Criterion = c("Content", "Language"), Weight = c(1, 3))
head(fair_average_table(fit, reference_plan = plan)$reference_scores)

Estimate Many-Facet Ordered-Response Measurement Models (RSM, PCM, and GMFRM)

Description

Primary estimation entry point for Rating Scale ("RSM"), Partial Credit ("PCM"), and Generalized Many-Facet Rasch Models (GMFRM, selected with model = "GPCM") across Marginal ("MML"), Joint ("JML"), Jeffreys-penalized Joint ("JML_jeffreys"), and Conditional ("CML") Maximum Likelihood in C++. Supports element and group-mean anchors, fixed or shared step_constraints, declarative category_support for mixed binary/polytomous rubrics, explanatory facet_formulas with element covariates, joint facet_interactions, empirical Bayes or Laplace facet_shrinkage, Warm's (1989) WLE scoring, and automatic pre-estimation connectivity and identifiability checks.

Usage

fit_mfrm(
  data, person = NULL, facets = NULL, score = NULL,
  model = c("RSM", "PCM", "GPCM"),
  method = c("MML", "JML", "JMLE", "JML_jeffreys", "CML"),
  step_facet = NULL, slope_facet = NULL, rating_min = NULL,
  rating_max = NULL, weight = NULL, anchors = NULL, group_anchors = NULL,
  population_formula = NULL, person_data = NULL, facet_interactions = NULL,
  step_constraints = NULL, category_support = NULL, facet_formulas = NULL,
  facet_data = NULL, person_score = c("auto", "EAP", "WLE"),
  warn_connectivity = TRUE, spec = NULL, control = list(), ...)

Arguments

data

A data.frame of observed ratings in long format (one row per observed rating; missing assignments are absent rows rather than zeros).

person

Character string naming the person (examinee/target) identifier column.

facets

Character vector naming one or more non-person facet columns (e.g., c("Rater", "Criterion")). By default, non-person facets carry negative sign (Sign = -1) so larger logit estimates represent higher rater severity or higher task/criterion difficulty.

score

Character string naming the integer or numeric rubric score column. Convert factor labels to numeric rubric values before using the unified engine.

model

"GMFRM" is accepted as an alias for "GPCM"; fitted objects retain the code "GPCM". Measurement model family: "RSM" (shared step thresholds across elements), "PCM" (facet-specific step thresholds governed by step_facet), or "GPCM" (GMFRM with facet-specific discrimination and steps governed by slope_facet and step_facet).

method

Estimation method: "MML" (Gauss-Hermite or Laplace-adaptive marginal ML), "JML" / "JMLE" (joint ML), "JML_jeffreys" (Jeffreys/Firth-penalized JML with finite extreme-score estimates and Block-Schur standard errors), or "CML" (conditional ML conditioning on person total scores for "RSM" and "PCM").

step_facet

Character string naming the facet in facets that owns category step thresholds when model is "PCM" or "GPCM". For a GMFRM with common category steps on a common rubric, use step_facet = "Common".

slope_facet

Character vector of length 1 or 2 naming the facet(s) in facets with element-specific discrimination slopes when model = "GPCM".

rating_min

Optional integer lower bound of the rubric scale. Inferred from observed scores if NULL.

rating_max

Optional integer upper bound of the rubric scale. Inferred from observed scores if NULL.

weight

Optional character string naming a nonnegative observation case-weight column in data.

anchors

Optional data.frame with columns Facet, Level, and Anchor fixing individual facet elements to known logit values (see make_anchor_table).

group_anchors

Optional data.frame with columns Facet, Level, Group, and GroupValue constraining subset means of facet elements.

population_formula

Optional one-sided latent-regression formula (e.g., ~ Group) for person ability means under method = "MML".

person_data

Optional data.frame of person-level covariates with one row per person ID when population_formula is supplied.

facet_interactions

Optional list of length-2 character vectors (e.g., list(c("Rater", "Criterion"))) estimating sum-to-zero 2-way interaction terms jointly with main effects.

step_constraints

Optional data.frame with columns Level, From, To, and Value or Group fixing or tying step transitions across levels while preserving within-ladder sum-to-zero identification.

category_support

Optional data.frame with columns Level, Min, and Max declaring inclusive per-level category bounds on the original rubric scale for mixed binary/polytomous rubrics.

facet_formulas

Optional named list of one-sided covariate formulas (e.g., list(Rater = ~ Experience)) decomposing facet locations via explanatory linear predictors.

facet_data

Optional named list of element-level covariate data.frames corresponding to facet_formulas, with one row per element ID in each table.

person_score

Primary person ability estimator stored in fit$person$Estimate: "auto" ("EAP" for MML, "WLE" for CML, "JML" for JML), "EAP", or "WLE" (Warm, 1989).

warn_connectivity

Logical; if TRUE (default), audits multi-facet graph connectivity, design rank, and interior category support prior to optimization and emits a warning if disconnected subsets or rank deficiencies are detected.

spec

Optional named list of advanced model specification settings, including slope_reference (reference facet constrained to geometric mean 1 when two facets have discrimination parameters), slope_type ("full_predictor" or "ability_only"), gpcm_mml_identification ("free_population", "fixed_standard_normal", or "unconstrained_slopes"), noncenter_facet, positive_facets, dummy_facets, and centering_scope ("remainder" or "facet").

control

Optional named list of numerical and regularization controls, including quad_points (default 31), mml_integration ("fixed", "adaptive", or "auto"), facet_shrinkage ("none", "empirical_bayes", or "laplace"), facet_prior_sd, slope_prior_sd, xtreme, whexact, maxit, and reltol.

...

Additional supported specification or control arguments, supplied by name. In particular, missing_codes recodes specified values before retaining complete rating rows: an explicit vector applies to the score and identifier columns; TRUE or "default" applies the default codes (99, 999, -1, N, NA, n/a, period, blank) to scores only.

Details

Use the named main arguments for the data and model, spec for advanced model assumptions, and control for numerical settings. Additional named arguments in ... are retained for compatibility; do not specify the same setting in both places.

Non-unit observation weights leave point estimates available but withhold inferential reporting because the supported weight interpretation has not been validated. A deficit in the constrained facet-location design after projecting out centered person-location contrasts is also flagged: MML comparisons then rely on population assumptions when effective anchors do not resolve the deficit. This conditional location check is not a proof of global identifiability for all nonlinear slope or threshold structures.

All estimators return the same mfrm_fit schema and work with mfrm_workflow(fit = ...). The implementation is selected internally; there is no engine-selection argument. Refit saved objects from older versions using their original data and model specification. Relabelling their class does not convert the underlying parameter and covariance layout.

With mml_integration = "auto", fixed quadrature fits at q and 2q+1 points are compared. The finer fit is returned. Relative free-parameter changes, absolute expected-score changes, and log-likelihood changes per rating are checked against 1e-4, 1e-4, and 1e-6, respectively. The results and selected order are retained in quadrature_check. A failed check withholds inferential reporting; increase quad_points and inspect stability. Agreement at these two orders is a sensitivity check, not a bound on integration error, global-optimum guarantee, or coverage validation.

The Generalized Many-Facet Rasch Model (GMFRM) is a unidimensional adjacent-category model that estimates discrimination. The name follows Uto and Ueno (2020), who use GMFRM for an extension of the many-facet Rasch model. In the ordinary many-facet Rasch model, discrimination is held constant. In this package, GMFRM covers a many-facet generalized partial credit model (GPCM; Muraki, 1992) with facet-specific category steps and a rating-scale form (many-facet RS-GPCM) with common category steps. These descriptions refer to the fitted step structure. The response equation depends on the step ownership and slope placement selected for the analysis.

Reports name the facets that carry discrimination. When two facets carry discrimination, their slopes are multiplied. Report the step facet, slope placement, scale identification, and estimation method when describing the fitted model. summary(fit)$model_label gives the display label for a fitted model; the model code is "GPCM".

Converged reports the optimizer stopping condition. Separately, summary$InferenceReady and readiness$reason_codes report failed connectivity, convergence, finite-parameter, or positive-definite information checks. For unified RSM and PCM MML, the population location terms must be identifiable together with the constrained facet effects. A rank-deficient joint design cannot identify these effects separately. Recheck the rating assignments, fixed reference values and population formula. For unpenalized RSM/PCM MML, boundary_audit uses the required dependency lpSolve to seek a structural direction that improves every observed category probability without changing person ability. A certified direction implies no finite structural MLE and makes inference unavailable. Failure to find this sufficient condition is not a general proof of existence; GPCM boundaries and all population-boundary directions are not covered by this particular test. An unsuccessful numerical boundary check keeps inference unavailable. These checks do not establish finite-sample coverage.

Person and facet fit statistics, expected averages, FairM/FairZ, and local-bias diagnostics use the primary person score. Selecting MML person_score = "WLE" therefore changes these derived quantities as well as person$Estimate; the EAP and posterior SD remain available in separate columns.

Value

An object of class "mfrm_fit" containing:

Supports summary(), plot(), predict(), coef(), vcov(), confint(), anova(), logLik(), AIC(), BIC(), fitted(), and residuals().

References

Muraki, E. (1992). A generalized partial credit model: Application of an EM algorithm. Applied Psychological Measurement, 16(2), 159–176. doi:10.1177/014662169201600206.

Uto, M., and Ueno, M. (2020). A generalized many-facet Rasch model and its Bayesian estimation using Hamiltonian Monte Carlo. Behaviormetrika, 47, 469–496. doi:10.1007/s41237-020-00115-7.

See Also

mfrm_analysis, check_mfrm_connectivity, diagnose_mfrm, estimate_bias, analyze_dff, plot.mfrm_fit

Examples

# Load bundled 4-rater x 4-criterion analytic rubric ratings (1 row = 1 rating)
ratings <- load_mfrmr_data("example_core")

# 1. Rating Scale Model (RSM) via MML with Warm's WLE person scoring
fit_rsm <- fit_mfrm(
  ratings,
  person = "Person",
  facets = c("Rater", "Criterion"),
  score = "Score",
  model = "RSM",
  method = "MML",
  person_score = "WLE"
)
fit_rsm$facets[, c("Facet", "Level", "Estimate", "RealSE", "FairM", "InfitMnSq")]

# 2. GMFRM with criterion-specific discrimination
fit_gpcm <- fit_mfrm(
  ratings,
  person = "Person",
  facets = c("Rater", "Criterion"),
  score = "Score",
  model = "GPCM",
  step_facet = "Criterion",
  slope_facet = "Criterion",
  control = list(quad_points = 21L)
)
fit_gpcm$slopes[, c("Facet", "Level", "Estimate", "ModelSE")]
predict(fit_gpcm, newdata = data.frame(theta = 0, Rater = "R01", Criterion = "Content"))

Estimate Dynamic Multi-Wave and Markov Rater Severity Drift Models

Description

Estimates non-Bayesian dynamic rater-severity drift across ordered scoring waves, sessions, or days without MCMC sampling (generalized from Uto, 2023). Integrates person abilities by normal quadrature, computes analytical Louis (1982) observed information for inner parameters, and estimates rater-specific random-walk drift standard deviations by Laplace-marginalized Empirical Bayes with Kass-Steffey (1989) hyperparameter variance propagation (TotalSE vs ConditionalSE).

Usage

fit_mfrm_drift(
  data, person, rater, time, score, facets = character(),
  score_levels = NULL, model = c("PCM", "RSM"),
  drift_mode = c("markov_hetero", "markov_homo", "independent", "static"),
  eb_method = c("em_laplace", "full_laplace"), mu_sigma = -2,
  delta_sigma = 1, beta1_sd = 1, step_sd = 1, person_sd = 1,
  logistic_scale = 1, quad_points = 81L, maxit = 60L, tol = 1e-06,
  missing = c("fail", "omit"), drift_threshold = 0.3, flag_se_ratio = 2)

Arguments

data

A data.frame of observed ratings across ordered waves or occasions.

person

Character string naming the person identifier column.

rater

Character string naming the rater identifier column whose severity may drift over time.

time

Character string naming the ordered scoring wave, session, or day column.

score

Character string naming the ordered rubric score column.

facets

Optional character vector of additional time-invariant non-person facets (e.g., "Criterion").

score_levels

Optional sorted numeric/integer vector declaring the full ordered rubric categories.

model

Category threshold structure: "PCM" (rater-specific step thresholds) or "RSM" (shared step thresholds).

drift_mode

Temporal severity specification: "markov_hetero" (rater-specific Markov drift SDs), "markov_homo" (common Markov drift SD), "independent" (unsmoothed per-wave severities), or "static" (time-invariant baseline).

eb_method

Hyperparameter optimization method: "em_laplace" (default) or "full_laplace".

mu_sigma

Prior mean for log-drift standard deviations (default -2).

delta_sigma

Prior SD for log-drift standard deviations (default 1).

beta1_sd

Prior SD for initial Wave-1 rater severities (default 1).

step_sd

Weak regularizing prior SD on step parameters (default 1).

person_sd

Standard deviation of the normal person ability distribution (default 1).

logistic_scale

Multiplicative scale constant (default 1; use 1.7 for normal-ogive scaling).

quad_points

Number of normal quadrature grid points for person integration (default 81L).

maxit

Maximum outer optimization iterations (default 60L).

tol

Relative convergence tolerance (default 1e-06).

missing

Missing-value handling: "fail" or "omit".

drift_threshold

Absolute logit change threshold used to flag substantive wave-to-wave drift (default 0.3).

flag_se_ratio

Standardized |Drift| / TotalSE ratio threshold for flagging drift contrasts (default 2).

Value

An S3 object of class "mfrm_drift" supporting summary(), plot(), confint(), coef(), vcov(), predict(), and as.data.frame(x, component = "severity") (returning rater-by-wave severity estimates, ConditionalSE, TotalSE, and drift flags).

See Also

fit_mfrm, detect_anchor_drift, plot.mfrm_fit

Examples

ratings <- load_mfrmr_data("example_core")
ratings$Wave <- ifelse(as.integer(factor(ratings$Person)) <= 24L, "Day1", "Day2")

drift_fit <- fit_mfrm_drift(
  ratings,
  person = "Person",
  rater = "Rater",
  time = "Wave",
  score = "Score",
  facets = "Criterion",
  model = "RSM"
)
as.data.frame(drift_fit, component = "severity")
plot(drift_fit, type = "trajectory")

Format a Tidy Many-Facet Summary Table with Optional kableExtra or flextable

Description

Extracts a tidy summary table from a tidymfrm workflow via tidy() and formats it as GitHub-flavored Markdown, HTML (kableExtra), or Word/Office (flextable).

Usage

format_mfrm_table(
  x,
  component = c("raters", "facets", "persons", "steps", "slopes", "g_study", "d_study",
    "dff", "drift"),
  engine = c("markdown", "kableExtra", "flextable"),
  digits = 3L
)

Arguments

x

A tidymfrm workflow object.

component

Component to format: "raters", "facets", "persons", "steps", "slopes", "g_study", "d_study", "dff", or "drift".

engine

Table engine: "markdown" (zero extra dependencies), "kableExtra" (requires optional knitr and kableExtra), or "flextable" (requires optional flextable).

digits

Number of decimal places for numeric columns (default 3L).

Value

A Markdown string, kableExtra object, or flextable object.

Examples

# Saved JML calibration of example_core; see fit_mfrm() for estimation.
saved <- readRDS(system.file("examples", "core-jml.rds", package = "mfrmr"))
ratings <- load_mfrmr_data(saved$dataset)
wf <- mfrm_workflow(ratings, "Person", c("Rater", "Criterion"), "Score",
                    fit = saved$fit) |>
  step_mfrm_diagnose()
cat(format_mfrm_table(wf, component = "raters", engine = "markdown"))

Glance at a Single-Row Summary of a Many-Facet Workflow or Fit

Description

Returns a one-row tibble summarizing graph connectivity, model convergence and inference readiness, information criteria, latent EAP reliability, observed-score G and Phi, and flagged rater counts.

Usage

glance(x, ...)

## S3 method for class 'tidymfrm'
glance(x, ...)

## S3 method for class 'mfrm_fit'
glance(x, ...)

Arguments

x

A tidymfrm or mfrm_fit object.

...

Additional arguments (unused).

Value

A single-row tibble::tibble(). model is the API code and model_label gives the display name, including the facets carrying discrimination for a GMFRM.

Examples

# Saved JML calibration of example_core; see fit_mfrm() for estimation.
saved <- readRDS(system.file("examples", "core-jml.rds", package = "mfrmr"))
ratings <- load_mfrmr_data(saved$dataset)
wf <- mfrm_workflow(ratings, "Person", c("Rater", "Criterion"), "Score",
                    fit = saved$fit)
glance(wf)

Compute Exact, Weighted Kappa, Gwet AC2, Krippendorff Alpha, and ICC Agreement

Description

Consolidates exact and adjacent agreement, pairwise weighted kappa, Gwet's ordinal AC_2, Krippendorff's \alpha, and two-way random intraclass correlation (ICC(2,1) and ICC(2,k)) from raw rating tables or fitted mfrm_fit objects.

Usage

interrater_agreement(
  data, person = "Person", rater = "Rater", score = "Score",
  context_facets = NULL, unit = NULL, categories = NULL,
  metric = c("all", "exact", "kappa", "gwet_ac2", "krippendorff_alpha", "icc"),
  weights = c("quadratic", "linear", "unweighted"), model_expected = FALSE
)

Arguments

data

A data.frame or fitted mfrm_fit object of observed ratings.

person

Character string naming the person identifier column.

rater

Character string naming the rater identifier column.

score

Character string naming the numeric rating column.

context_facets

Optional character vector of additional facets identifying rating units.

unit

Optional character vector specifying the full unit identifier columns (e.g., c("Person", "Task")), overriding person and context_facets.

categories

Optional numeric vector of declared rubric score categories (e.g., 0:3).

metric

Agreement family: "all", "exact", "kappa", "gwet_ac2", "krippendorff_alpha", or "icc".

model_expected

Logical. For a unified-engine fit, also compute observed and expected rates and model-based exact kappa on the same usable pairs.

weights

Weighting scheme: "quadratic", "linear", or "unweighted".

Details

Model expectation is the product of the two fitted category probability vectors, conditional on each fitted person's primary score and independent ratings. Complete unit-rater pairs with valid probabilities contribute equally. The model table records pair counts and availability. The ordinary weighted kappa uses marginal category frequencies.

Each unit-rater combination must have at most one observed rating. Duplicate combinations are rejected to prevent row-order-dependent overwriting. For repeated occasions, include the occasion column in unit or context_facets so that the comparison refers to the intended rating occasion.

Value

A structured mfrmr S3 object or data.frame containing parameter estimates, standard errors, and diagnostic summaries.

Examples

ratings <- load_mfrmr_data("example_core")
interrater_agreement(ratings, person = "Person", rater = "Rater",
                     score = "Score", context_facets = "Criterion")

Load Bundled Synthetic Many-Facet Example Datasets

Description

Returns one of the synthetic many-facet rating datasets bundled with mfrmr as a ready-to-use data.frame for learning, testing, and reproducible examples.

Usage

load_mfrmr_data(name = "example_core", details = FALSE)

Arguments

name

Dataset key, or "list" for the available keys. The default is "example_core".

details

With name = "list", return an annotated catalogue containing counts, intended uses and design notes.

Value

A data frame for the selected dataset, a character vector of keys, or a catalogue data frame. The rating datasets contain person/facet identifiers and observed scores. The example_gtheory_crossed and example_gtheory_nested tables contain separate Content and Organization outcomes. The example_agreement table identifies units by Person and Task. The example_operational_design table is a planned roster without scores. Inspect column roles before fitting; these different table types are not interchangeable inputs to fit_mfrm().

See Also

mfrmr_example_data, ej2021_data, describe_mfrm_data

Examples

load_mfrmr_data("list", details = TRUE)
ratings <- load_mfrmr_data("example_operational")
head(ratings)
table(ratings$Rater, ratings$Score)

Extract Direct Calibration Anchor Tables from a Fitted Model

Description

Extracts converged facet element location estimates (and optionally person estimates) from a baseline fit_mfrm object in the data.frame(Facet, Level, Anchor) format accepted by the anchors argument of subsequent fit_mfrm calibrations.

Usage

make_anchor_table(
  fit, facets = NULL, include_person = FALSE, digits = NULL,
  readiness_policy = c("error", "review"))

Arguments

fit

A fitted baseline model object returned by fit_mfrm.

facets

Optional character vector of non-person facet names to include; defaults to all non-person facets.

include_person

Logical; if TRUE, also exports finite person ability estimates as Facet = "Person" rows.

digits

Optional integer rounding precision applied to Anchor values.

readiness_policy

"error" (rejects non-converged or unready legacy calibrations) or "review".

Value

A data.frame (or tibble) with columns Facet, Level, and Anchor.

See Also

anchor_to_baseline, detect_anchor_drift, fit_mfrm

Examples

ratings <- load_mfrmr_data("example_core")
fit_base <- fit_mfrm(ratings, person = "Person", facets = c("Rater", "Criterion"), score = "Score")

anchors <- make_anchor_table(fit_base, facets = "Criterion")
anchors

One-Stop End-to-End Many-Facet Measurement, Generalizability, and Audit

Description

Executes the complete three-pillar performance-assessment workflow in a single call:

  1. Connectivity & Many-Facet Measurement: Verifies multi-facet graph connectivity and fits RSM, PCM, or a Generalized Many-Facet Rasch Model (GMFRM, selected with model = "GPCM") via MML, JML, JML_jeffreys, or CML in C++ (EAP and Warm's WLE, optional dynamic Markov rater drift via occasion, step_constraints, category_support, and explanatory facet_formulas).

  2. G-Study & D-Study Planning: Decomposes observed rating variance (urGENOVA Henderson Method 1 across crossed, nested, and multivariate composite designs) and identifies minimal designs meeting target G and \Phi.

  3. Rater Diagnostics, Fair(M), Real SE, Bias, & DFF Screening: Flags noisy/central/severe raters, computes RajuSA-Welch pairwise bias, extracts unexpected ratings, and optionally screens group-level DFF and cutoffs.

Usage

mfrm_analysis(
  data,
  person,
  facets,
  score,
  model = c("RSM", "PCM", "GPCM"),
  method = c("MML", "JML", "JML_jeffreys", "CML"),
  step_facet = NULL,
  slope_facet = NULL,
  slope_reference = NULL,
  slope_type = c("full_predictor", "ability_only"),
  slope_prior_sd = NULL,
  occasion = NULL,
  person_score = c("auto", "EAP", "WLE"),
  rater_facet = NULL,
  rating_min = NULL,
  rating_max = NULL,
  compare_methods = NULL,
  population_formula = NULL,
  person_data = NULL,
  step_constraints = NULL,
  category_support = NULL,
  facet_formulas = NULL,
  facet_data = NULL,
  quad_points = 31L,
  mml_integration = c("fixed", "adaptive"),
  xtreme = 0.3,
  warn_connectivity = TRUE,
  nesting = NULL,
  g_scores = NULL,
  g_weights = NULL,
  d_study_grid = NULL,
  target_g = 0.8,
  target_phi = 0.8,
  mnsq_range = c(0.7, 1.3),
  zstd_limit = 2,
  bias_df_method = c("facets", "classical"),
  dff_group = NULL,
  dff_method = c("mml_lrt", "cml_lrt", "raju_welch", "mh", "logistic"),
  cut_scores = NULL,
  bootstrap = 0L,
  threads = 1L,
  gpcm_mml_identification = NULL,
  g_facets = NULL,
  expected_design = NULL,
  rater_panels = NULL,
  g_data = NULL
)

tidymfrm(
  data,
  person,
  facets,
  score,
  model = c("RSM", "PCM", "GPCM"),
  method = c("MML", "JML", "JML_jeffreys", "CML"),
  step_facet = NULL,
  slope_facet = NULL,
  slope_reference = NULL,
  slope_type = c("full_predictor", "ability_only"),
  slope_prior_sd = NULL,
  occasion = NULL,
  person_score = c("auto", "EAP", "WLE"),
  rater_facet = NULL,
  rating_min = NULL,
  rating_max = NULL,
  compare_methods = NULL,
  population_formula = NULL,
  person_data = NULL,
  step_constraints = NULL,
  category_support = NULL,
  facet_formulas = NULL,
  facet_data = NULL,
  quad_points = 31L,
  mml_integration = c("fixed", "adaptive"),
  xtreme = 0.3,
  warn_connectivity = TRUE,
  nesting = NULL,
  g_scores = NULL,
  g_weights = NULL,
  d_study_grid = NULL,
  target_g = 0.8,
  target_phi = 0.8,
  mnsq_range = c(0.7, 1.3),
  zstd_limit = 2,
  bias_df_method = c("facets", "classical"),
  dff_group = NULL,
  dff_method = c("mml_lrt", "cml_lrt", "raju_welch", "mh", "logistic"),
  cut_scores = NULL,
  bootstrap = 0L,
  threads = 1L,
  gpcm_mml_identification = NULL,
  g_facets = NULL,
  expected_design = NULL,
  rater_panels = NULL,
  g_data = NULL
)

Arguments

data

A data.frame of observed ratings.

person

Character string naming the person identifier column.

facets

Character vector of non-person facet column names (e.g., c("Rater", "Criterion")).

score

Character string naming the numeric rating column.

model

"RSM", "PCM", or "GPCM".

method

Primary estimation method: "MML", "JML", "JML_jeffreys", or "CML".

step_facet

Facet owning category thresholds when model is "PCM" or "GPCM". For a GMFRM with common steps on a common rubric, use "Common".

slope_facet

Facet(s) owning discrimination slopes when model = "GPCM".

slope_reference

Reference slope facet constrained to geometric mean 1 when two facets have discrimination parameters.

slope_type

GPCM parameterization: "full_predictor" or "ability_only".

slope_prior_sd

Optional log-normal prior SD regularizing GPCM log-slopes.

occasion

Optional character string naming the rating occasion/wave column for Markov rater drift modeling.

person_score

"auto", "EAP", or "WLE".

rater_facet

Optional character string naming the rater facet; inferred automatically if NULL.

rating_min, rating_max

Optional integer rubric bounds.

rater_panels

Optional named character vector assigning rater IDs to panels for effective resistance.

g_data

Optional separate rating table for the G-Study, such as one row per person and rater with scores in multiple columns. The measurement fit uses data.

expected_design

Optional score-free roster of planned rating cells. The workflow reports planned cells without observed scores and observed cells outside the roster.

compare_methods

Optional character vector of additional estimators (e.g., c("MML", "JML_jeffreys", "CML")) to cross-validate sensitivity.

population_formula

Optional latent-regression formula for MML.

person_data

Optional person-level covariate table with one row per person ID.

step_constraints

Optional step-constraint declarations (data.frame).

category_support

Optional per-level category support bounds (data.frame).

facet_formulas, facet_data

Optional explanatory facet covariate formulas and tables with one row per element ID.

quad_points

Quadrature points for MML (default 31L).

mml_integration

"fixed" or "adaptive".

xtreme

Extreme-score adjustment for JML (default 0.3 for FACETS compatibility).

warn_connectivity

Logical; if TRUE (default), emits a warning() before estimation if disconnected rating subsets or empty interior categories are detected.

nesting

Optional named character vector c(Child = "Parent") declaring nested facets.

g_facets

Optional facet vector for G-Study (defaults to all workflow facets). Supply a subset explicitly if the workflow has more than four facets.

g_scores

Optional character vector of score columns for multivariate G-Study.

g_weights

Optional nonnegative composite weights matching g_scores.

d_study_grid

Optional candidate design grid data.frame.

target_g

Target generalizability coefficient G (default 0.80).

target_phi

Target dependability index \Phi (default 0.80).

mnsq_range

Acceptable ⁠Infit MnSq⁠ interval for rater screening (default c(0.70, 1.30)).

zstd_limit

Absolute ZSTD screening threshold (default 2.0).

bias_df_method

Degrees-of-freedom convention for 2-way pairwise bias screening: "facets" (FACETS 4.5.3 RajuSA-Welch / von Davier 2025) or "classical".

dff_group

Optional person-group column name in data for parallel C++ split-rater DFF screening ("mml_lrt").

dff_method

DFF estimator when dff_group is supplied ("mml_lrt", "cml_lrt", "raju_welch", "mh", or "logistic").

cut_scores

Optional finite numeric Fair(M) cutoffs on the rubric scale. The inverse averages expected category scores using each person's retained rating weights and step-group mix, with mean facet locations and the geometric reference discrimination used by mfrmr. CutLogit is NA when mixtures imply different thresholds; CutLogitMin/CutLogitMax give their range.

bootstrap

Number of conditional parametric bootstrap replications (0L to skip). The calibrated response probabilities provide the draws, and each draw is refitted with the same model and estimation settings. The table gives the requested and usable refit counts per facet level. Bootstrap SEs and percentile intervals require at least two usable refits.

threads

Number of C++ worker threads for bootstrap (default 1L).

gpcm_mml_identification

Optional scale identification for GPCM MML. Use "fixed_standard_normal" when comparing against MML RSM/PCM fits with a fixed standard-normal population. NULL uses the mfrmr default.

Details

Use vignette("mfrmr-workflow", package = "mfrmr") for a first analysis and a guide to familiar FACETS outputs. If the G-Study design yields unavailable variance components, the workflow warns, retains the calibration and rating diagnostics, and stores the reason in summary(wf)$gtheory_reason. Supply g_facets to declare a subset for planning when the full design contains more than four non-person facets. The connectivity summary uses the category support of the fitted calibration.

Value

A completed tidymfrm object supporting summary(), plot(), predict(), coef(), vcov(), confint(), tidy(), glance(), augment(), and render_mfrm_report().

Examples

utils::data("mfrmr_example_core", package = "mfrmr")
wf <- mfrm_analysis(
  mfrmr_example_core,
  person = "Person",
  facets = c("Rater", "Criterion"),
  score = "Score",
  method = "MML",
  cut_scores = c(2.5, 3.0)
)
summary(wf)$rater_diagnostics
predict(wf, newdata = data.frame(theta = 0, Rater = "R01", Criterion = "Content"))

Multi-Threaded C++ Batch MFRM Estimator for Monte Carlo and Bootstrap Studies

Description

Executes tens to thousands of Many-Facet model calibrations, person scorings, and fit diagnostics in parallel across native C++ std::thread workers without R interpreter or garbage-collection contention. Accepts either a shared template data.frame paired with a replicated score_matrix (nrow(data) x R) or a list of heterogeneous rating data.frames.

Usage

mfrm_batch_fit(
  data, person, facets, score = "score", score_matrix = NULL,
  model = c("RSM", "PCM", "GPCM"),
  method = c("MML", "JML", "JML_jeffreys", "CML"),
  step_facet = NULL, slope_facet = NULL, slope_reference = NULL,
  slope_type = c("full_predictor", "ability_only"),
  gpcm_mml_identification = c("free_population",
    "fixed_standard_normal", "unconstrained_slopes"),
  person_score = c("auto", "EAP", "WLE"),
  rating_min = NULL, rating_max = NULL, anchors = NULL,
  group_anchors = NULL, dummy_facets = NULL,
  population_formula = NULL, person_data = NULL, step_constraints = NULL,
  category_support = NULL, facet_formulas = NULL, facet_data = NULL,
  slope_prior_sd = NULL, quad_points = 31L,
  mml_integration = c("fixed", "adaptive"), xtreme = 0,
  whexact = FALSE, bias_facets = NULL, maxit = 400L, reltol = 1e-10,
  threads = 1L, return_fits = TRUE)

Arguments

data

A template data.frame (when score_matrix is supplied) or a list of data.frames of observed ratings.

person

Character string naming the person identifier column.

facets

Character vector of non-person facet column names.

score

Character string naming the numeric rating column.

score_matrix

Optional integer/numeric matrix (nrow(data) x R) of replicated rating vectors sharing data's complete Person and facet identifiers. Scores must be finite integers within the declared support. Each returned fit retains the ratings from its own column.

model

"GMFRM" is accepted as an alias for "GPCM"; fitted objects retain the code "GPCM". Measurement model family ("RSM", "PCM", or "GPCM").

method

Estimation method ("MML", "JML", "JML_jeffreys", or "CML").

step_facet

Facet owning thresholds when model is "PCM" or "GPCM".

slope_facet

Facet(s) owning discrimination slopes when model = "GPCM".

slope_reference

Reference slope facet constrained to geometric mean 1 in 2-family GPCM.

slope_type

GPCM parameterization: "full_predictor" or "ability_only".

gpcm_mml_identification

Scale identification rule for GPCM MML estimation.

person_score

Primary person ability estimator ("auto", "EAP", or "WLE").

rating_min

Minimum integer rubric score.

rating_max

Maximum integer rubric score.

anchors

Optional element anchor table.

group_anchors

Optional group-mean anchor table.

dummy_facets

Optional dummy facets fixed at 0.

population_formula

Optional latent-regression formula for MML.

person_data

Optional person covariate data.frame (or list of data.frames).

step_constraints

Optional step-constraint declarations.

category_support

Optional per-level category support bounds.

facet_formulas

Optional explanatory facet covariate formulas.

facet_data

Optional covariate tables for explanatory facets.

slope_prior_sd

Optional log-normal prior SD regularizing GPCM log-slopes.

quad_points

Gauss-Hermite quadrature points for MML (default 31L).

mml_integration

Integration mode ("fixed" or "adaptive").

xtreme

Extreme-score adjustment for JML (default 0).

whexact

Logical flag for exact Wilson-Hilferty ZSTD (default FALSE).

bias_facets

Optional length-2 character vector for 2-way local bias.

maxit

Maximum optimization iterations (default 400L).

reltol

Relative convergence tolerance (default 1e-10).

threads

Number of C++ worker threads (default 1L). When the CRAN check environment variable _R_CHECK_LIMIT_CORES_ is enabled, requests are capped at two workers.

return_fits

Logical; if TRUE, returns the list of mfrm_fit objects; if FALSE, returns a compact per-replication summary data.frame.

Value

A list of mfrm_fit objects (when return_fits = TRUE) or a data.frame of replication convergence, iteration counts, and log-likelihoods (when return_fits = FALSE), with attribute "elapsed_sec".

See Also

fit_mfrm

Examples

ratings <- load_mfrmr_data("example_core")
fit <- fit_mfrm(ratings, "Person", c("Rater", "Criterion"), "Score", method = "CML")

# Simulate 4 parametric bootstrap replications from fitted category probabilities
probs <- fitted(fit, type = "probs")
cats <- as.integer(colnames(probs))
set.seed(123)
sim_mat <- replicate(4L, vapply(seq_len(nrow(probs)), function(i) {
  sample(cats, 1L, prob = probs[i, ])
}, integer(1)))

mfrm_batch_fit(
  ratings,
  person = "Person",
  facets = c("Rater", "Criterion"),
  score = "Score",
  score_matrix = sim_mat,
  method = "CML",
  rating_min = 1,
  rating_max = 4,
  threads = 1L,
  return_fits = FALSE
)

Project Decision-Study Generalizability (G), Dependability (Phi), and SEM

Description

Projects universe-score variance, relative error variance, absolute error variance, relative and absolute SEM, generalizability coefficient (G), and dependability index (\Phi) across candidate facet sample sizes (design_grid) from an estimated mfrm_g_study or fit_mfrm object.

Usage

mfrm_d_study(
  x, design_grid = NULL, ...)

Arguments

x

An estimated G-Study object returned by mfrm_g_study (or a fitted fit_mfrm object).

design_grid

Optional data.frame specifying positive integer sample sizes, with one column per facet (e.g., expand.grid(Rater = 1:4, Criterion = 2:5)). For nested facets, counts are per parent level. For Henderson, NULL returns the default grid around observed harmonic facet counts. For balanced complete ANOVA/MINQUE designs it projects the observed counts; incomplete or unequal designs require an explicit future grid.

...

Additional arguments forwarded to methods (such as weights for "anova"/"minque0" multivariate G-Study objects).

Details

For urgenova, GStatus/PhiStatus identify availability. Zero total variance makes the coefficient undefined (NA), not zero; its MeetsG80/MeetsPhi80 flag is also NA. Negative universe or projected error variance likewise makes the associated coefficient unavailable. A zero universe variance with positive error variance is a defined coefficient of zero. Negative error variance yields NA SEM. Default and explicit plans use the same calculations, including for saved fits.

Value

A data.frame (for method = "urgenova" G-Studies) or "mfrm_multivariate_d_study" object reporting candidate facet counts, TotalRatingsPerPerson, UniverseVar, RelErrorVar, AbsErrorVar, RelSEM, AbsSEM, G, and Phi.

See Also

mfrm_g_study, plot.mfrm_fit

Examples

ratings <- load_mfrmr_data("example_core")
gt <- mfrm_g_study(
  ratings,
  scores = "Score",
  person = "Person",
  facets = c("Rater", "Criterion"),
  method = "urgenova"
)

# Compare 1-to-3 raters crossed with 2 or 4 criteria
mfrm_d_study(gt, design_grid = expand.grid(Rater = 1:3, Criterion = c(2, 4)))

Estimate Univariate and Multivariate Generalizability Study Variance Components

Description

Estimates variance and covariance components for balanced or unbalanced crossed and nested rating designs using Henderson Method 1 (method = "urgenova"), ANOVA, or MINQUE(0).

Usage

mfrm_g_study(
  data, scores = NULL, person = "Person", rater = "Rater", task = "Task",
  method = c("anova", "minque0", "urgenova"), missing = c("error", "omit"),
  facets = NULL, nesting = NULL, score = NULL, weights = NULL,
  d_study_grid = NULL, truncate_negative = TRUE)

Arguments

data

A data.frame of observed ratings.

scores

Character vector naming one or more score columns.

person

Character string naming the person identifier column.

rater

Character string naming the rater column when facets = NULL.

task

Character string naming the task column when facets = NULL.

method

Variance-component estimator ("anova", "minque0", or "urgenova").

missing

Missing-value policy ("error" or "omit").

facets

Character vector of non-person facet column names.

nesting

Optional named character vector c(Child = "Parent") declaring nested facets.

score

Alias for scores in univariate designs.

weights

Optional nonnegative composite weights matching scores. Weights are used as supplied: c(1, 1) forms a sum, while c(.5, .5) forms an average. Named weights are matched to score names; unnamed weights follow score order. The default is an equal-weight average. Requires explicit method = "urgenova"; weights never change the selected estimator. For ANOVA or MINQUE(0), supply composite weights to mfrm_d_study() after fitting the separate scores.

d_study_grid

Optional candidate D-Study design grid data.frame, with one column per facet and positive integer counts only. Nested-facet counts are per parent level.

truncate_negative

Logical; whether to clamp negative variance estimates at zero.

Details

Henderson Method 1 solves the expected mean-product equations for the declared crossed or nested random-effects design. A rank-deficient coefficient matrix is rejected: the data cannot distinguish the requested variance components. For urgenova, unidentified components and too few complete observations signal an error of class "mfrm_gstudy_unavailable". Negative raw estimates are retained in RawEstimate; truncate_negative controls their use in projected point estimates. For urgenova, zero total variance or negative universe/projected error variance gives an unavailable G/Phi (NA), with the reason in GStatus/PhiStatus; see mfrm_d_study.

The urgenova sampling covariance uses the Gaussian quadratic-form identity \operatorname{Cov}(y'Ay,y'By)=2\operatorname{tr}(AVBV) with the actual assignment pattern, including imbalance and replication. The working covariance V substitutes nonnegative component estimates (negative raw estimates are zeroed for this calculation). This is a plug-in covariance, not an exact finite-sample distribution or a model-free uncertainty estimate. confint() uses Satterthwaite chi-square approximations for positive components and logit delta intervals for G/Phi; boundary coefficients may have unavailable intervals (NA). The approximation is particularly limited near zero components and in sparse designs. As a conservative reporting guard, positive components with Satterthwaite degrees of freedom below 1 have both endpoints set to NA. This cutoff is not a coverage guarantee for other components. The named status attribute of the interval matrix records unstable_satterthwaite_df, the approximation used, or numerical unavailability. tidy(gt) and workflow reports carry these statuses and 95% component intervals. MLS intervals for the balanced ANOVA representation use different mean-product information and are not substituted for this unbalanced Henderson approximation.

Value

An mfrm_gtheory object for every estimator, with method_code, design, raw score covariance matrices in components, composite variance_components, g_study_summary, and a d_study table. Method-specific numerical ingredients and unavailable summaries are recorded explicitly. Incomplete ANOVA/MINQUE designs require a future design_grid; observed pool sizes are not silently interpreted as planned replication. Use summary(g)$component_diagnostics to inspect covariance definiteness. For Henderson, vc_vcov describes the supplied composite. For ANOVA/MINQUE, vcov(g, score = ..., assumption = "normal") selects score or composite sampling uncertainty. Balanced ANOVA supports confint(g, method = "mls", assumption = "normal"); this interval construction is not applied to unbalanced Henderson estimates. tidy(g) reports covariance entries for ANOVA/MINQUE; Henderson's composite table additionally includes interval status.

Examples

ratings <- load_mfrmr_data("example_core")
gt <- mfrm_g_study(ratings, scores = "Score", person = "Person",
                   facets = c("Rater", "Criterion"), method = "urgenova")
mfrm_d_study(gt)

Initialize a Pipeable Many-Facet Assessment Workflow

Description

Creates a tidymfrm workflow specification and immediately executes a fast C++ graph connectivity and category-support audit via mfrmr::check_mfrm_connectivity(). Pipe into step_mfrm_measure(), step_mfrm_gtheory(), step_mfrm_diagnose(), and render_mfrm_report(), or run everything in one call with mfrm_analysis().

Usage

mfrm_workflow(
  data,
  person,
  facets,
  score,
  rater_facet = NULL,
  occasion = NULL,
  rating_min = NULL,
  rating_max = NULL,
  fit = NULL,
  expected_design = NULL,
  rater_panels = NULL
)

Arguments

data

A data.frame of observed ratings.

person

Character string naming the person identifier column.

facets

Character vector of non-person facet column names (e.g., c("Rater", "Criterion")).

score

Character string naming the numeric rating column.

rater_facet

Optional character string naming the rater facet; inferred automatically if NULL.

occasion

Optional character string naming the rating occasion/wave column for Markov rater drift modeling.

rating_min, rating_max

Optional integer rubric bounds.

fit

Optional mfrm_fit calibration from fit_mfrm(), or its linked result from anchor_to_baseline. All supported estimators use the same result schema. Older saved calibrations must be refitted from their original data and specification. Supply the same rating columns and retained rows in their original order. Continue with step_mfrm_gtheory() or step_mfrm_diagnose() directly.

rater_panels

Optional named character vector assigning rater IDs to panels for effective resistance.

expected_design

Optional score-free roster of planned rating cells.

Value

A tidymfrm workflow object.

Examples

utils::data("mfrmr_example_core", package = "mfrmr")
wf0 <- mfrm_workflow(mfrmr_example_core, "Person", c("Rater", "Criterion"), "Score")
wf0$connectivity$connected

Standard S3 Extractor, Prediction, Inference, and Comparison Methods for mfrmr Objects

Description

Standard R S3 methods (predict, coef, vcov, confint, anova, fitted, residuals, logLik, AIC, BIC, nobs, summary, print, and as.data.frame) for objects returned by mfrmr. In particular, predict() evaluates expected scores, category probability matrices, linear predictors, Fair(M), or new-examinee WLE scores under arbitrary user-supplied newdata conditions.

Usage

## S3 method for class 'mfrm_fit'
predict(object, newdata = NULL,
  type = c("response", "probs", "prob", "link", "fair", "wle", "eap"),
  person_data = NULL, facet_data = NULL, se.fit = FALSE, ...)
## S3 method for class 'mfrm_fit'
coef(object,
  type = c("all", "facets", "locations", "steps", "slopes", "person", "persons",
    "explanatory", "interactions", "population", "free"), ...)
## S3 method for class 'mfrm_fit'
vcov(object,
  component = c("design", "facets", "steps", "slopes", "explanatory", "population"),
  se_type = c("model", "sandwich"), facet = NULL, ...)
## S3 method for class 'mfrm_fit'
confint(object, parm = NULL, level = 0.95,
  component = c("facets", "steps", "slopes", "person", "explanatory",
    "interactions", "population", "free"),
  se_type = c("model", "real", "sandwich", "profile"), ...)
## S3 method for class 'mfrm_fit'
anova(object, ..., nested = TRUE)
## S3 method for class 'mfrm_gtheory'
confint(object, parm = NULL, level = 0.95, ...)

Arguments

nested

Logical; request nested-model likelihood-ratio inference after eligibility checks.

object

A fitted measurement model or G-Study object.

newdata

Rating conditions containing the fitted base facet columns. An explicit numeric theta column sets ability (Theta is an alias when it is not a model facet; conflicting columns are rejected); otherwise known person IDs use the primary fitted score. Unknown persons use the fitted population mean if available, or zero. NULL uses retained rating rows.

type

For prediction: "response" returns expected rubric scores, "probs" (alias "prob") category probabilities, "link" the unscaled ability-plus-facet predictor, "fair" stored person FairM, and "eap"/"wle" person score tables. EAP scores are retrieved from the fit with newdata = NULL. New-data WLE requires a Person ID and a finite integer score within the fitted category support on each row. For coef(), selects a parameter table; "free" returns the identified free coordinates.

person_data, facet_data

Optional covariate tables for unseen persons or explanatory facet levels, using the fitted model's column definitions.

se.fit

For "response" or "link", return a list with fit and conditional structural delta-method se.fit.

component

Parameter block. vcov(..., component = "design") returns the full free-coordinate covariance, including estimated population coordinates. For G-Study intervals, "coefficients" selects G/Phi.

se_type

"model" uses inverse information; "sandwich" uses person-clustered covariance for MML (model covariance otherwise). "real" uses fit-inflated SEs where available. "profile" profiles selected free structural coordinates.

facet

Optional facet name for covariance extraction.

parm

Optional parameter names or indices selecting interval rows.

level

Confidence level in (0,1).

...

Additional fitted models for anova(); otherwise method-specific arguments.

Details

Prediction uncertainty. Response/link SEs use the full covariance of free structural coordinates, including cross-facet covariances, estimated steps, interactions, explanatory coefficients, and GPCM log-slopes as applicable. Ability is held fixed at the supplied or plug-in value: person-score uncertainty, uncertainty in a predicted population mean, and future rating variance are excluded. These are SEs of conditional model predictions, not prediction intervals for individual ratings. An unusable calibration gives NA SEs. "link" is the unscaled predictor; its gradient excludes steps and slopes.

Measurement-model intervals. Model and sandwich intervals are local normal approximations; slope intervals are formed on log-slopes then exponentiated. For primary EAP scores the person SE is posterior SD conditional on calibration, so the normal interval is an approximate conditional posterior summary, not a calibration-inclusive frequentist confidence interval. Fit-inflated "real" intervals are descriptive. Numerically ineligible calibrations are rejected. For WLE, person intervals use conditional score uncertainty with calibration parameters treated as estimated constants. They do not propagate calibration uncertainty. MML sandwich SEs cluster scores by person; they still require independent persons and enough informative clusters for the target parameter. A large total number of ratings does not compensate for a facet level observed on very few persons. Sandwich SEs do not repair biased point estimates or guarantee small-sample coverage. Inspect interval availability separately from the coverage properties established for the intended model and assignment.

Nested likelihood comparisons. anova() requires the same retained responses, person/facet assignments, weights, category support and numerical integration settings, unpenalized MML or CML, converged eligible fits, and nested identified parameter spaces. It rejects materially decreasing optimized likelihoods instead of reporting a zero statistic. A failed check leaves lrt = NULL and an unavailable comparison_basis$lrt_status. The chi-square reference remains an asymptotic regular-interior approximation; passing computational checks does not guarantee small-sample calibration. G-Study covariance and interval assumptions are described in mfrm_g_study.

Value

Standard S3 return values: numeric vectors or matrices for predict, coef, vcov, confint, fitted, and residuals; logLik / scalar criteria for logLik, AIC, BIC, and nobs; mfrm_comparison tables for anova; and structured summaries for summary and print.

Examples

ratings <- load_mfrmr_data("example_core")
fit_rsm <- fit_mfrm(ratings, "Person", c("Rater", "Criterion"), "Score", model = "RSM")
fit_pcm <- fit_mfrm(ratings, "Person", c("Rater", "Criterion"), "Score",
                    model = "PCM", step_facet = "Criterion")

coef(fit_rsm, type = "facets")
confint(fit_rsm, component = "facets", se_type = "real")
vcov(fit_rsm, facet = "Rater")
predict(fit_rsm, newdata = data.frame(theta = 0, Rater = "R01", Criterion = "Content"))
anova(fit_rsm, fit_pcm)

Synthetic ratings illustrating agreement, offsets and missing scores

Description

Ready-to-load data from the rating-agreement tutorial. Six Persons complete two Tasks, with up to three Raters on each response. Load with data("mfrmr_example_agreement", package = "mfrmr").

Format

A data frame with 35 rows and four columns: Person, Task, Rater, and Score. Each row is one rater's rating of one Person's response to one Task. Scores use the declared categories 0–3.

Details

Rater R2 always scores one category above R1, so their rankings agree but their scores differ. R3 has two deliberately different scores, one missing score (P06/T2) and one absent row (P02/T2). There are 34 observed scores. Missing ratings are not zero scores; an absent row alone does not identify whether a rating was planned. Use unit = c("Person", "Task") to match responses. unit = "Person" would mix two different responses.

These are constructed teaching data, not empirical records, expert standards or evidence of a method's performance in a population.

Source

Existing data from the rating-agreement tutorial. The deterministic construction is retained in data-raw/make-teaching-data.R in the source repository.

See Also

interrater_agreement(), load_mfrmr_data()

Examples

data("mfrmr_example_agreement", package = "mfrmr")
ratings <- mfrmr_example_agreement
head(ratings)
with(ratings, table(Rater, Score, useNA = "ifany"))
agreement <- interrater_agreement(ratings, rater = "Rater",
  unit = c("Person", "Task"), score = "Score", categories = 0:3)
agreement$table
# Each pair uses its own shared responses; inspect its denominator as well.

Synthetic many-facet rating examples

Description

Compact synthetic many-facet datasets sized to exercise the documented workflow. Their dimensions are not evidence of sample-size adequacy for an applied study.

Format

A data.frame with 6 columns:

Study

Example dataset label ("OperationalExample", "ExampleCore", or "ExampleBias").

Person

Person/respondent identifier.

Rater

Rater identifier.

Criterion

Criterion facet label.

Score

Observed category score on a four-category scale (1–4).

Group

Balanced grouping label ("A" / "B"). It is neutral in the operational and core examples; the bias example has the planted group structure described below.

Details

Available data objects:

mfrmr_example_operational is the primary applied teaching example. It has a connected but incomplete two-rater assignment, moderately unequal rater workloads, and six planned criterion-level omissions. Scores are sampled directly from stated RSM category probabilities. The six unobserved ratings are absent rows in the long data rather than NA scores. Each group contains 24 persons, and three omissions in each group leave 141 observed rows for Group A and 141 for Group B. The balanced Group variable has no effect in the generating model; random observed differences may still occur.

mfrmr_example_core is an idealized complete crossing generated from a single latent trait plus rater and criterion main effects. It is useful as a fast deterministic example, but it is not representative of routine incomplete operational assignment.

mfrmr_example_bias instead uses a balanced partial two-rater assignment. Group A and B latent means are -0.1 and 0.1 logits, respectively, with a common SD of 0.9. It also contains:

This lets differential-functioning and bias-analysis help pages demonstrate non-null findings.

Data dimensions

Dataset Rows Persons Raters Criteria Groups
example_operational 282 48 6 3 2
example_core 768 48 4 4 2
example_bias 384 48 4 4 2

Suggested usage

All three objects can be loaded either with load_mfrmr_data() or directly with data(), for example data("mfrmr_example_operational", package = "mfrmr").

Source

Synthetic documentation data generated from rating-scale Rasch facet designs with fixed seeds. Generator scripts are maintained under ⁠data-raw/⁠ for this release in the public source repository. These are synthetic examples, not empirical records.

Examples

data("mfrmr_example_operational", package = "mfrmr")
table(mfrmr_example_operational$Score)
table(mfrmr_example_operational$Group)

Planned assignment roster for the operational example

Description

A score-free roster declaring all Person x Rater x Criterion cells planned for mfrmr_example_operational. Pass it to the expected_design argument of describe_mfrm_data() to distinguish the six expected-but-unobserved cells from combinations that were never assigned.

Format

A data.frame with 288 rows and 5 columns:

Study

Example dataset label ("OperationalExample").

Person

Person/respondent identifier.

Rater

Planned rater identifier.

Criterion

Planned criterion label.

Group

Balanced grouping label ("A" / "B").

Details

The roster contains 288 planned cells. The observed mfrmr_example_operational table contains 282 rows, so an explicit design comparison identifies six planned omissions. Extra roster columns such as Study and Group are ignored unless they are named as model facets.

Source

Synthetic assignment roster generated with the operational example by data-raw/make-operational-example.R. It contains no empirical records and no fabricated scores.

Examples

data("mfrmr_example_operational", package = "mfrmr")
data("mfrmr_example_operational_design", package = "mfrmr")
review <- describe_mfrm_data(
  mfrmr_example_operational,
  person = "Person",
  facets = c("Rater", "Criterion"),
  score = "Score",
  expected_design = mfrmr_example_operational_design
)
summary(review)$structural_missingness

Synthetic crossed and nested data for learning G theory

Description

Existing tutorial examples supplied as ready-to-load tables. Load one with data("mfrmr_example_gtheory_crossed", package = "mfrmr"), then assign it to a shorter name such as ratings. No simulation code is needed to run the G-study or D-study examples.

Format

Two data frames with five columns: Person, Rater, Task, Content, and Organization. Each row is one Person-by-Rater-by-Task rating cell; the last two columns are continuous numeric scores. mfrmr_example_gtheory_crossed has 1,920 rows (40 Persons, eight common raters and six common tasks). mfrmr_example_gtheory_nested has 540 rows (30 Persons, six tasks and three raters per task).

Details

In the crossed example, the same rater ID denotes the same rater on every task. In the nested example, R1, R2, R3 are local labels: the pair Task and Rater identifies a rater, giving 18 raters in total. Declare nesting = c(Rater = "Task") for that example. Persons are crossed with all tasks and rater teams in both examples.

The scores were constructed from independent normal random effects for every source in the respective design. The nested example correlates the two score components within each source. These are fictional unbounded continuous scores, not ordered rubric categories or MFRM ability estimates. Their design and sample sizes demonstrate the functions; they do not establish that an assessment's assumptions or estimation precision are adequate.

Source

The existing crossed G-theory tutorial (seed 24) and nested G-study help example (seed 2027). Their unchanged generation recipes are retained in data-raw/make-teaching-data.R in the source repository.

See Also

mfrm_g_study(), mfrm_d_study(), load_mfrmr_data()

Examples

data("mfrmr_example_gtheory_crossed", package = "mfrmr")
ratings <- mfrmr_example_gtheory_crossed
head(ratings)
g <- mfrm_g_study(ratings, scores = c("Content", "Organization"),
  person = "Person", rater = "Rater", task = "Task")
g$component_diagnostics
# Inspect component estimates before projecting future plans.
d <- mfrm_d_study(g,
  design_grid = data.frame(Raters = c(2, 4), Tasks = 3),
  weights = c(Content = .5, Organization = .5))
summary(d)

Color-Vision-Safe ggplot2 Visualizations for Many-Facet Models and Diagnostics

Description

Unified ggplot2 plot() methods for fitted MFRM models, diagnostics, G/D-Studies, pairwise RajuSA-Welch bias tables, DFF screens, test information curves, and rater drift trajectories. Every multi-group aesthetic pairs color ("okabe_ito", "viridis", or strict R == G == B "monochrome") with distinct point shape and linetype encodings. Canvas titles and footnotes are omitted by default and stored in attr(p, "mfrm_notes").

Usage

## S3 method for class 'mfrm_bias'
plot(
  x, type = c("forest", "pairwise"), top_n = 20L,
  palette = c("okabe_ito", "viridis", "monochrome"), base_size = 11, ...)

## S3 method for class 'mfrm_diagnostics'
plot(
  x, facet = NULL, palette = c("okabe_ito", "viridis", "monochrome"),
  base_size = 11, ..., type = c("pathway", "residual_pca"))

## S3 method for class 'mfrm_dff'
plot(
  x, top_n = 25L, palette = c("okabe_ito", "viridis", "monochrome"),
  base_size = 11, ...)

## S3 method for class 'mfrm_drift'
plot(
  x, type = c("trajectory", "contrasts"),
  palette = c("okabe_ito", "viridis", "monochrome"), base_size = 11, ...)

## S3 method for class 'mfrm_fit'
plot(
  x,
  type = c("wright", "pathway", "steps", "category_curves", "persons",
    "raters", "person_fit", "residual_qq", "slopes", "qc"),
  palette = c("okabe_ito", "viridis", "monochrome"), facet = NULL,
  base_size = 11, ..., fit_statistic = c("infit", "outfit", "both"))

## S3 method for class 'mfrm_gtheory'
plot(
  x, type = NULL,
  palette = c("okabe_ito", "viridis", "monochrome"), base_size = 11, ...)

## S3 method for class 'mfrm_information'
plot(
  x, type = c("information", "ccc"),
  palette = c("okabe_ito", "viridis", "monochrome"), base_size = 11, ...)

## S3 method for class 'mfrm_multivariate_d_study'
plot(
  x, palette = c("okabe_ito", "viridis", "monochrome"), base_size = 11, ...)



Arguments

fit_statistic

Horizontal mean-square statistic for a pathway plot. Use "both" for separate Infit and Outfit panels on the same scale.

x

An mfrmr model, diagnostic, bias, DFF, information, drift, G/D-Study object.

type

Character string selecting the visualization panel: for diagnostic objects, "pathway" or "residual_pca" (first residual contrast); for fitted models, "wright", "pathway", "steps", "category_curves", "persons", "raters", "person_fit", "residual_qq", "slopes" (GPCM), or "qc"; for G-Studies, "dstudy" or "variance" (NULL chooses D-Study for Henderson and component variance for ANOVA/MINQUE); for bias, "forest" or "pairwise"; for information, "information" or "ccc"; for drift, "trajectory" or "contrasts".

top_n

Maximum number of ranked bias cells or DFF elements to display.

palette

Color-vision-safe palette: "okabe_ito" (default), "viridis", or strict "monochrome" grayscale.

base_size

Base font size in points (default 11).

...

Additional plotting options.

facet

Optional facet name filter for element pathway and rater diagnostic plots.

Details

The "person_fit" panel plots Outfit against the reported person-fit index from compute_person_fit_indices(): conditional l_z^* when available, otherwise l_z. Its two-sided flags agree with summary() of that result. These are screening references, not calibrated significance tests.

For unified-engine fits, slope bars use the same log-scale 95 percent model intervals as confint(x, component = "slopes"). Person and facet diagnostic bars use descriptive Real-SE intervals. When the calibration fails inference readiness, these interval bars are withheld while finite descriptive points are retained; attr(p, "mfrm_notes") records the reasons. Neither visible bars nor a ready status establish nominal finite-sample coverage.

Value

A ggplot object with diagnostic and scale notes attached in attr(p, "mfrm_notes").

Examples

# Saved JML calibration of example_core; see fit_mfrm() for estimation.
saved <- readRDS(system.file("examples", "core-jml.rds", package = "mfrmr"))
fit <- saved$fit
p1 <- plot(fit, type = "wright", palette = "okabe_ito")
p2 <- plot(fit, type = "category_curves", palette = "viridis")
p3 <- plot(fit, type = "residual_qq", palette = "monochrome")
attr(p1, "mfrm_notes")

Plot End-to-End Many-Facet Measurement, Generalizability, and Rater Diagnostics

Description

Produces clean, publication-ready, color-vision-safe ggplot2 figures from a mfrm_analysis() workflow object. Every multi-group aesthetic pairs colour ("okabe_ito", "viridis", or "monochrome") with distinct point shape and linetype encodings. By default, plot titles and footnotes are omitted from the canvas and stored in attr(p, "mfrm_notes").

Usage

## S3 method for class 'tidymfrm'
plot(
  x,
  type = c("wright", "raters", "steps", "category_curves", "dstudy", "persons",
    "person_fit", "residual_qq", "slopes", "drift", "qc", "dashboard", "dstudy_frontier",
    "gstudy", "pathway"),
  palette = c("okabe_ito", "viridis", "monochrome"),
  base_size = 11,
  draw = TRUE,
  ...,
  newdata = NULL
)

Arguments

x

A tidymfrm object.

type

Plot type:

  • "pathway": Facet measures against Infit or Outfit. Pass fit_statistic = "both" for two panels and facet = "Rater" to select raters.

  • "wright": Multi-facet Wright map aligning person distribution, facet locations, and step thresholds.

  • "raters": Rater severity vs ⁠Infit MnSq⁠ diagnostic map with 95% ⁠Real SE⁠ intervals.

  • "steps" / "category_curves": Category characteristic curves (CCCs) and Andrich step thresholds.

  • "dstudy": D-Study generalizability (G) and dependability (\Phi) curves across sample sizes.

  • "dstudy_frontier": Best point projection achievable at or below each evaluated rating count, with separate G and Phi targets.

  • "gstudy": Observed-plan coefficients by subscore and for the weighted composite.

  • "persons": Person logit ability vs rubric-scale Fair(M) with 95% ⁠Real SE⁠ intervals and cut-score lines.

  • "person_fit": Person ⁠Infit MnSq⁠ vs ⁠Outfit MnSq⁠ scatter with ZSTD screening contours.

  • "residual_qq": Normal Q-Q plot of standardized Pearson observation residuals.

  • "slopes": Forest plot of GPCM discrimination slopes (model = "GPCM").

  • "drift": Dynamic Markov rater severity trajectories across rating waves (occasion).

  • "qc": Four-panel model quality-control summary.

  • "dashboard": Four-panel workflow overview combining "wright", "raters", "steps", and "dstudy" (or "persons").

palette

Color palette: "okabe_ito" (default), "viridis", or "monochrome" (strict ⁠R == G == B⁠ grayscale with distinct shapes and linetypes).

base_size

Base font size in pts (default 11).

draw

Logical; if TRUE (default), renders on the active graphics device; if FALSE, returns the ggplot (or dashboard) without drawing.

...

Additional arguments passed to underlying graphics::plot() methods.

newdata

For type = "category_curves" or "steps", a data frame with all model facet columns and one row per rating context. With GPCM, the default is the first retained context. Predictions span ability -4 to 4.

Value

A ggplot object (with attr(, "mfrm_notes")), or for type = "dashboard", a tidymfrm_dashboard named list of four ggplot panels.

Examples

# Saved JML calibration of example_core; see fit_mfrm() for estimation.
saved <- readRDS(system.file("examples", "core-jml.rds", package = "mfrmr"))
ratings <- load_mfrmr_data(saved$dataset)
wf <- mfrm_workflow(ratings, "Person", c("Rater", "Criterion"), "Score",
                    fit = saved$fit) |>
  step_mfrm_diagnose()
p_wright <- plot(wf, type = "wright", palette = "okabe_ito", draw = FALSE)
p_vir <- plot(wf, type = "raters", palette = "viridis", draw = FALSE)
p_mono <- plot(wf, type = "steps", palette = "monochrome", draw = FALSE)
attr(p_wright, "mfrm_notes")

Render Reproducible APA-Style & Individual Rater Feedback Reports

Description

Generates a structured Markdown, standalone HTML, or Word (docx) report synthesizing multi-facet connectivity, Many-Facet Rasch and Generalized Partial Credit Measurement (RSM/PCM/GPCM and optional Markov rater drift), observed-score Generalizability and Decision Studies (G-Study/D-Study), rater diagnostics (Fair(M), ModelSE vs RealSE, Infit/Outfit), optional RajuSA-Welch pairwise bias, DFF, and cut-score sensitivity tables, and individual rater calibration feedback cards. The opening summary shows calibration readiness, D-Study plans at equal rating counts and the availability of rater screening. In the unexpected ratings table, InputRow is the one-based row of the supplied data frame.

Usage

render_mfrm_report(
  x,
  format = c("markdown", "html", "docx"),
  file = NULL,
  title = "Many-Facet Measurement, Generalizability, and Rater Audit Report",
  include_rater_cards = TRUE,
  max_unexpected = 10L,
  digits = 3L,
  rater = NULL,
  criterion_facet = NULL,
  reference_plan = NULL,
  fair_level = 0.95
)

Arguments

x

A tidymfrm workflow object from mfrm_analysis() or mfrm_workflow().

format

Output format: "markdown" (default), "html", or "docx" (requires optional officer package in Suggests).

file

Optional file path (use tempfile(tmpdir = tempdir(), ...) in examples and tests). Required when format = "docx".

title

Report heading string.

include_rater_cards

Logical; if TRUE (default), appends individual actionable calibration feedback cards for each rater.

max_unexpected

Maximum number of unexpected rating rows (⁠|StdResidual| >= 2⁠) to list (default 10L).

rater

Optional rater ID. Produce a focused feedback report for this rater.

criterion_facet

Optional non-rater facet identifying criteria for within-criterion residual/expected-score correlations and matched residual associations. These descriptive correlations do not by themselves diagnose central tendency or halo. The residual-correlation null baseline depends on the fitted model and rating design; neither zero nor a fixed negative correction is a calibrated cutoff.

reference_plan

Optional common rating plan for original-scale person Fair Average intervals in the assessment report. See fair_average_table.

fair_level

Level of the conditional normal approximation for common-plan scores.

digits

Rounding digits for formatted numeric tables (default 3L).

Details

The assessment report includes estimator and scoring settings, agreement and its conditional model expectation, reliability and homogeneity screens, anchor displacement, observed design connectivity and available multivariate G-Study results. The homogeneity test uses diagonal ModelSE variances and is a screen. Group displacement is a conditional one-step common location shift with other measures fixed. The method notes describe the assumptions for each result. summary(wf, reference_plan = ..., fair_level = ...) exposes the metadata and these tables for programmatic use.

A focused rater report describes severity rank in a connected panel, rubric scores, fit, compression of scores toward the middle, matched criterion residual correlations and the largest unexpected ratings. The last two statistics use the matched contexts stated by the report. Residual correlations are withheld when the corresponding observed scores do not vary. Review the source rating records before interpreting a screening result.

Value

Character string containing the formatted Markdown/HTML report, or the output .docx file path (invisibly when file is supplied).

Examples

# Saved JML calibration of example_core; see fit_mfrm() for estimation.
saved <- readRDS(system.file("examples", "core-jml.rds", package = "mfrmr"))
ratings <- load_mfrmr_data(saved$dataset)
wf <- mfrm_workflow(ratings, "Person", c("Rater", "Criterion"), "Score",
                    fit = saved$fit) |>
  step_mfrm_diagnose()
md <- render_mfrm_report(wf, format = "markdown")
tmp_html <- tempfile(tmpdir = tempdir(), fileext = ".html")
render_mfrm_report(wf, format = "html", file = tmp_html)
unlink(tmp_html)

Step 3: Diagnose Raters, Fair(M), Real SE, Bias (RajuSA-Welch), and DFF

Description

Computes rater diagnostic flags (Infit/Outfit MnSq and ZSTD, Fair(M), ModelSE vs RealSE), extracts unexpected rating cells (⁠|StdResidual| >= 2.0⁠), estimates RajuSA-Welch pairwise bias, and optionally screens group-level DFF and cut-score classification sensitivity.

Usage

step_mfrm_diagnose(
  wf,
  mnsq_range = c(0.7, 1.3),
  zstd_limit = 2,
  bias_df_method = c("facets", "classical"),
  dff_group = NULL,
  dff_method = c("mml_lrt", "cml_lrt", "raju_welch", "mh", "logistic"),
  cut_scores = NULL,
  threads = 1L
)

Arguments

wf

A tidymfrm workflow object with a fitted ⁠$fit⁠.

mnsq_range

Acceptable ⁠Infit MnSq⁠ interval for rater screening (default c(0.70, 1.30)).

zstd_limit

Absolute ZSTD screening threshold (default 2.0).

bias_df_method

Degrees-of-freedom convention for 2-way pairwise bias screening: "facets" (FACETS 4.5.3 RajuSA-Welch / von Davier 2025) or "classical".

dff_group

Optional person-group column name in data for parallel C++ split-rater DFF screening ("mml_lrt").

dff_method

DFF estimator when dff_group is supplied ("mml_lrt", "cml_lrt", "raju_welch", "mh", or "logistic").

cut_scores

Optional finite numeric Fair(M) cutoffs on the rubric scale. The inverse averages expected category scores using each person's retained rating weights and step-group mix, with mean facet locations and the geometric reference discrimination used by mfrmr. CutLogit is NA when mixtures imply different thresholds; CutLogitMin/CutLogitMax give their range.

threads

Number of C++ worker threads for split-rater DFF refits (default 1L).

Details

Rater screens and intervals are withheld when calibration is not numerically ready; ⁠Review required⁠ is distinct from Acceptable. Cutoff sensitivity uses a normal approximation conditional on the fitted calibration, not a confidence statement about true pass status. It does not include calibration uncertainty or guarantee coverage under misspecification. Available_ModelSE/Available_RealSE count persons contributing to each borderline count. A wholly unavailable count is NA, not zero. Cutoffs at or outside a person's attainable open Fair(M) range have no finite logit inverse. PassCount and PassRatePct remain descriptive, with denominator PassAvailable. See mfrmr::analyze_dff() for refit restrictions.

Value

Updated tidymfrm workflow object with ⁠$diagnostics⁠.

Examples

utils::data("mfrmr_example_core", package = "mfrmr")
wf <- mfrm_workflow(mfrmr_example_core, "Person", c("Rater", "Criterion"), "Score") |>
  step_mfrm_measure(model = "RSM", method = "MML") |>
  step_mfrm_diagnose(cut_scores = c(2.5, 3.0))
tidy(wf, component = "raters")

Step 2: Run Generalizability (G-Study) and Decision (D-Study) Planning

Description

Decomposes observed rating variance via C++ urGENOVA (supporting crossed, nested nesting, and multivariate composite g_scores / g_weights designs) and evaluates candidate D-Study designs against target_g and target_phi.

Usage

step_mfrm_gtheory(
  wf,
  g_facets = NULL,
  nesting = NULL,
  g_scores = NULL,
  g_weights = NULL,
  d_study_grid = NULL,
  target_g = 0.8,
  target_phi = 0.8,
  g_data = NULL
)

Arguments

wf

A tidymfrm workflow object.

g_facets

Optional facet vector for G-Study (defaults to all facets in wf). Supply a subset explicitly if the workflow has more than four facets.

nesting

Optional named character vector c(Child = "Parent") declaring nested facets.

g_scores

Optional character vector of score columns for multivariate G-Study.

g_weights

Optional nonnegative composite weights matching g_scores.

d_study_grid

Optional candidate design grid data.frame.

target_g

Target generalizability coefficient G (default 0.80).

g_data

Optional separate table on which to fit the G-Study. Reported G-Study row counts refer to this input when supplied.

target_phi

Target dependability index \Phi (default 0.80).

Details

A connected rating design can support calibration while failing to identify separate G-Study variance components. Keep the calibrated workflow in a named object before running this step. If planning fails, use that object with step_mfrm_diagnose() and render_mfrm_report() to review the ratings while you check the assignment and nesting assumptions. The G-Study uses rows complete for its selected identifiers and scores. The report gives the number of rows included and omitted.

Value

Updated tidymfrm workflow object with ⁠$gtheory⁠.

Examples

utils::data("mfrmr_example_core", package = "mfrmr")
wf <- mfrm_workflow(mfrmr_example_core, "Person", c("Rater", "Criterion"), "Score") |>
  step_mfrm_gtheory(target_g = 0.80, target_phi = 0.75)
tidy(wf, component = "g_study")

Step 1: Estimate Many-Facet Rasch or Generalized Partial Credit Model

Description

Fits RSM, PCM, or a Generalized Many-Facet Rasch Model (GMFRM, selected with model = "GPCM") via fit_mfrm on the C++ engine, with optional dynamic Markov rater drift (occasion), multi-method sensitivity comparison (compare_methods), and parametric bootstrap (bootstrap). Re-estimation clears the previous calibration's diagnostics and comparisons. Run step_mfrm_diagnose() again to attach diagnostics for the new calibration.

Usage

step_mfrm_measure(
  wf,
  model = c("RSM", "PCM", "GPCM"),
  method = c("MML", "JML", "JML_jeffreys", "CML"),
  step_facet = NULL,
  slope_facet = NULL,
  slope_reference = NULL,
  slope_type = c("full_predictor", "ability_only"),
  slope_prior_sd = NULL,
  occasion = NULL,
  person_score = c("auto", "EAP", "WLE"),
  compare_methods = NULL,
  population_formula = NULL,
  person_data = NULL,
  step_constraints = NULL,
  category_support = NULL,
  facet_formulas = NULL,
  facet_data = NULL,
  quad_points = 31L,
  mml_integration = c("fixed", "adaptive"),
  xtreme = 0.3,
  warn_connectivity = TRUE,
  bootstrap = 0L,
  threads = 1L,
  gpcm_mml_identification = NULL
)

Arguments

wf

A tidymfrm workflow object from mfrm_workflow().

model

"GMFRM" is accepted as an alias for "GPCM"; fitted objects retain the code "GPCM". "RSM", "PCM", or "GPCM".

method

Primary estimation method: "MML", "JML", "JML_jeffreys", or "CML".

step_facet

Facet owning category thresholds when model is "PCM" or "GPCM". For a GMFRM with common steps on a common rubric, use "Common".

slope_facet

Facet(s) owning discrimination slopes when model = "GPCM".

slope_reference

Reference slope facet constrained to geometric mean 1 when two facets have discrimination parameters.

slope_type

GPCM parameterization: "full_predictor" or "ability_only".

slope_prior_sd

Optional log-normal prior SD regularizing GPCM log-slopes.

occasion

Optional rating occasion/wave column name to run dynamic Markov rater drift modeling.

person_score

"auto", "EAP", or "WLE".

compare_methods

Optional character vector of additional estimators (e.g., c("MML", "JML_jeffreys", "CML")) to cross-validate sensitivity.

population_formula

Optional latent-regression formula for MML.

person_data

Optional person-level covariate table.

step_constraints

Optional step-constraint declarations (data.frame).

category_support

Optional per-level category support bounds (data.frame).

facet_formulas, facet_data

Optional explanatory facet covariate formulas and data.

quad_points

Quadrature points for MML (default 31L).

mml_integration

"fixed" or "adaptive".

xtreme

Extreme-score adjustment for JML (default 0.3 for FACETS compatibility).

warn_connectivity

Logical; if TRUE (default), emits a warning() before estimation if disconnected rating subsets or empty interior categories are detected.

bootstrap

Number of conditional parametric bootstrap replications (0L to skip). The calibrated response probabilities provide the draws, and each draw is refitted with the same model and estimation settings. The table gives the requested and usable refit counts per facet level. Bootstrap SEs and percentile intervals require at least two usable refits.

threads

Number of C++ worker threads for bootstrap (default 1L).

gpcm_mml_identification

Optional scale identification for GPCM MML. Use "fixed_standard_normal" when comparing against MML RSM/PCM fits with a fixed standard-normal population. NULL uses the mfrmr default.

Value

Updated tidymfrm workflow object with ⁠$fit⁠ (and optional ⁠$drift⁠, ⁠$method_comparison⁠, and ⁠$bootstrap⁠).

Examples

utils::data("mfrmr_example_core", package = "mfrmr")
wf <- mfrm_workflow(mfrmr_example_core, "Person", c("Rater", "Criterion"), "Score") |>
  step_mfrm_measure(model = "GPCM", method = "MML", slope_facet = "Rater")
tidy(wf, component = "slopes")

Tidy a Many-Facet Model or Workflow Object

Description

Extracts tidy tibble summaries of parameters, rater diagnostics, persons, thresholds, GPCM discrimination slopes, dynamic rater drift, or generalizability studies.

Usage

tidy(x, ...)

## S3 method for class 'tidymfrm'
tidy(
  x,
  component = c("raters", "facets", "persons", "steps", "slopes", "g_study", "d_study",
    "dff", "drift"),
  conf.level = 0.95,
  use_real_se = TRUE,
  ...
)

## S3 method for class 'mfrm_fit'
tidy(
  x,
  component = c("facets", "persons", "steps", "slopes"),
  conf.level = 0.95,
  use_real_se = TRUE,
  ...
)

## S3 method for class 'mfrm_gtheory'
tidy(x, component = c("g_study", "d_study"), conf.level = 0.95, ...)

Arguments

x

A tidymfrm, mfrm_fit, or mfrm_gtheory object.

...

Additional arguments (unused).

component

Component to extract: "raters", "facets", "persons", "steps", "slopes", "g_study", "d_study", "dff", or "drift".

conf.level

Confidence level for Wald intervals (default 0.95).

use_real_se

Logical; if TRUE (default), constructs conf.low and conf.high using RealSE (inflated for misfit) rather than ModelSE.

Details

Intervals use the public mfrmr::confint() contract, including exponentiated log-slope intervals for GPCM. When calibration is not ready, interval endpoints are NA; inference_status and inference_reason explain why. Point estimates and SE columns remain descriptive outputs. G-Study tables include conf.low, conf.high, and interval_status; see mfrm_g_study for the approximation and the reporting guard for degrees of freedom below one.

Value

A tibble::tibble().

Examples

# Saved JML calibration of example_core; see fit_mfrm() for estimation.
saved <- readRDS(system.file("examples", "core-jml.rds", package = "mfrmr"))
ratings <- load_mfrmr_data(saved$dataset)
wf <- mfrm_workflow(ratings, "Person", c("Rater", "Criterion"), "Score",
                    fit = saved$fit) |>
  step_mfrm_diagnose()
tidy(wf, component = "raters")
glance(wf)
head(augment(wf))

Standard S3 Methods for tidymfrm Workflow Objects

Description

Standard S3 methods (anova, predict, coef, vcov, confint, summary, and print) for tidymfrm workflow objects.

Usage

## S3 method for class 'tidymfrm'
anova(object, ...)

Arguments

object

A calibrated tidymfrm workflow.

...

For anova(), additional calibrated tidymfrm workflows.

Details

anova() compares separately fitted models using the underlying mfrmr likelihood and nesting checks. Compare fits with the same retained ratings, weights, likelihood method, population and integration settings. Inspect comparison_basis when lrt is unavailable. Information criteria are interpretable as differences only for comparable likelihoods. compare_methods in step_mfrm_measure() addresses sensitivity to the estimator within a specified model.

Value

Standard S3 return values delegated from the underlying fitted mfrmr model or workflow summary.

Examples

utils::data("mfrmr_example_core", package = "mfrmr")
wf <- mfrm_workflow(mfrmr_example_core, "Person", c("Rater", "Criterion"), "Score") |>
  step_mfrm_measure()
coef(wf)
confint(wf)
head(predict(wf, type = "response"))

mirror server hosted at Truenetwork, Russian Federation.