| Title: | Methods-development R bindings for the magmaan C++ SEM library |
|---|---|
| Description: | Thin Rcpp wrappers exposing magmaan's C++ functions for methods development and research, including frontier methods. The opinionated one-call package for ordinary users is 'magmaan', which builds on this one. Self-contained: the C++ core (plus the vendored PORT and QUADPACK routines) is compiled from sources vendored under cpp/src/ and linked against a system NLopt, so the package installs without CMake or a prebuilt library. Not CRAN-bound. |
| Authors: | Jonas Moss [aut, cre] |
| Maintainer: | Jonas Moss <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.2 |
| Built: | 2026-10-27 16:09:16 UTC |
| Source: | https://github.com/JonasMoss/magmaan |
Composes exact empirical first-stage influence with the local correlation ML residual metric for global tests, or observed sensitivity and exact parameter restrictions for nested tests. Reports All, SB and PEBA4 references. Ordinary inference remains unavailable.
association_ml_global_test(fit, ordinal_stats) association_ml_nested_test(fit_alt, fit_null, ordinal_stats)association_ml_global_test(fit, ordinal_stats) association_ml_nested_test(fit_alt, fit_null, ordinal_stats)
fit, fit_alt, fit_null
|
Association ML fitted models; alternative first. |
ordinal_stats |
Common complete all-ordinal Stage-1 statistics with raw rows. |
A list with availability and a typed reason, statistic, degrees of freedom, spectrum, three references and reconstruction matrices. Zero degrees of freedom has reason zero_df and undefined p-values. Moment nesting, penalties, boundaries and unsupported Stage-1 channels are refused.
Lab-only evaluation-point inference for the Gaussian discrepancy on estimated polychoric correlations. Uses empirical-Jacobian first-stage rows, observed sensitivity including correlation-map curvature, and fixed-allocation group sampling. Ordinary inference remains unavailable.
association_ml_ij(fit, ordinal_stats)association_ml_ij(fit, ordinal_stats)
fit |
An all-ordinal association-ML fit in DELTA coordinates. |
ordinal_stats |
The complete-row Stage-1 statistics used for fitting. |
Requires complete all-ordinal rows, saturated thresholds, fixed response scales, linear association constraints, an identified model, positive observed sensitivity and interior primitive covariance matrices. Missing rows, mixed indicators, nonlinear constraints, covariance boundaries and penalties are unsupported. Sensitivity is computed by central differences of the analytic score; no global, nested or modification-index reference law is supplied.
A list with available; unavailable results include reason
and optionally detail. Available results contain the objective
value, active score, observed H, meat B,
coordinate map K, group target derivatives D,
vcov_active, full vcov, and group lists
influence_active and influence. Influence rows are unscaled:
summing their cross-products and dividing by total sample size squared
reconstructs the covariance. Full rows include saturated thresholds and their
cross-covariance with association parameters.
One-dimensional score tests using observed sensitivity for nuisance projection and exact empirical Stage-1 influence for the score variance.
association_ml_modification_indices(fit, ordinal_stats, absent = TRUE) association_ml_score_tests(fit, ordinal_stats)association_ml_modification_indices(fit, ordinal_stats, absent = TRUE) association_ml_score_tests(fit, ordinal_stats)
fit |
An all-ordinal association-ML lab fit with complete raw rows. |
ordinal_stats |
The same Stage-1 statistics and integer rows used to fit. |
absent |
Enumerate absent loadings, covariances and structural regressions among equation variables in addition to fixed rows. |
The robust statistic is N times the squared efficient score divided by
its empirical meat, referenced to chi-square with one degree of freedom. EPC
uses the observed Schur sensitivity. The unscaled mi uses that same
sensitivity. Equality rows index the original affine constraint system; EPC
is the coefficient along its normalized release direction, with
epc_full giving the full parameter displacement. Fixed-row EPC is in
the candidate parameter's units. No joint multi-direction release is exposed.
Threshold, mean and response-scale releases, singular information, covariance
boundaries, penalties, missing data and mixed indicators remain unavailable.
Ordinary association inference remains guarded pending policy calibration.
A list with available, metric = "observed" and rows.
Each row retains availability or a typed reason. Available rows contain
statistic, df, p_value, epc, epc_full,
mi and diagnostic score, sensitivity, meat and coordinate matrices.
Constructs parameter bounds in model free-parameter order. Sample-based bounds use the supplied data summaries.
bounds_loading(model, data)bounds_loading(model, data)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
A list of lower and upper parameter-bound vectors.
Constructs parameter bounds in model free-parameter order. Sample-based bounds use the supplied data summaries.
bounds_pos_var(model)bounds_pos_var(model)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
A list of lower and upper parameter-bound vectors.
Constructs parameter bounds in model free-parameter order. Sample-based bounds use the supplied data summaries.
bounds_standard(model, data)bounds_standard(model, data)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
A list of lower and upper parameter-bound vectors.
Constructs parameter bounds in model free-parameter order. Sample-based bounds use the supplied data summaries.
bounds_variance(model)bounds_variance(model)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
A list of lower and upper parameter-bound vectors.
Constructs parameter bounds in model free-parameter order. Sample-based bounds use the supplied data summaries.
bounds_wide(model, data)bounds_wide(model, data)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
A list of lower and upper parameter-bound vectors.
The exact leave-one-out engine: for each selected case, drop its row, rebuild
the sample statistics, and refit (warm-started from the full-sample solution).
Mirror of semfindr::lavaan_rerun(). Continuous ML/ULS/GLS.
case_rerun(fit, data = NULL, to_rerun = NULL, warm_start = TRUE)case_rerun(fit, data = NULL, to_rerun = NULL, warm_start = TRUE)
fit |
A fitted |
data |
Optional original data frame. Required for multiple-group fits;
for single-group fits, defaults to the raw data on |
to_rerun |
Integer case indices to refit; default all cases. |
warm_start |
Seed each refit from the full-sample estimates (faster, and
keeps refits on the same optimum). Default |
Single-group fits work directly from the raw data the fit carries. For
multiple-group fits, pass the original data frame (the per-group raw blocks
on the fit have lost the original row order needed to map a global case index
to its group); case ids are then the data-frame rows, as in semfindr.
A magmaan_case_rerun list: rerun (per-case refit fits, NULL when
a refit fails or is inadmissible), fit, selected, case_id, converged.
Computes composite weights and uncertainty from a fit and an explicitly supplied parameter covariance.
composite_weights(fit, vcov)composite_weights(fit, vcov)
fit |
A fitted magmaan model. |
vcov |
Explicit covariance matrix of free parameters, in theta order. |
Native composite-weight results.
Evaluates := expressions and their delta-method uncertainty using an explicit parameter covariance.
compute_defined(model, fit, vcov)compute_defined(model, fit, vcov)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
fit |
A fitted magmaan model. |
vcov |
Explicit covariance matrix of free parameters, in theta order. |
A table of defined parameters and uncertainty summaries.
The scalar rung explicitly frees every non-reference-group latent mean. This is required when observed intercepts are constrained equal: the scalar model is not an affine parameter subset of the metric model, so its robust difference test uses the delta restriction map.
continuous_invariance( model, data, group = NULL, steps = c("configural", "metric", "scalar"), estimator = c("ML", "FIML"), group_labels = NULL, optimizer = "nlopt-lbfgs", control = NULL, bounds = NULL )continuous_invariance( model, data, group = NULL, steps = c("configural", "metric", "scalar"), estimator = c("ML", "FIML"), group_labels = NULL, optimizer = "nlopt-lbfgs", control = NULL, bounds = NULL )
model |
A lavaan-style syntax string or a |
data |
A data frame containing the grouping column and continuous observed variables. |
group |
Name of the grouping column. When |
steps |
Requested rungs from |
estimator |
|
group_labels |
Optional group ordering. Defaults to data order (or the supplied model spec's ordering). |
optimizer, control, bounds
|
Fitting controls forwarded to |
A magmaan_continuous_invariance list with fitted models, robust
nested tests, and the constructed specifications.
Composes standard, scaled and robust fit-index families in C++, including a matching independence baseline, noncentral chi-square intervals and close-fit p-values. Estimates are retained.
convention_fit_measures(fit, convention)convention_fit_measures(fit, convention)
fit |
A fitted magmaanlab model retaining observations or ordinal stats. |
convention |
A named lavaan inference bundle. |
A data frame with index, estimate and reason columns and a lavaan_compat attribute. Incompatible bundles error. FIML ML/MLR use saturated H1 EM parameter tolerance 1e-10.
Thin adapters to C++ compatibility composers. A convention changes the
reported inference without changing fitting. Components outside the checked
model/data slice return an unavailable reason. Complete mixed DWLS supports
"WLSMV": expected-bread NACOV covariance, scaled-shifted global and
Satorra-2000 delta nested tests. Missing mixed observations and other mixed
bundles are unsupported. Delta/theta reporting is point-gated; grouped/theta
retained endpoints have limited validation due to optimizer stopping differences.
convention_inference(fit, convention) convention_nested(fit_H1, fit_H0, convention)convention_inference(fit, convention) convention_nested(fit_H1, fit_H0, convention)
fit |
A fitted |
convention |
A lavaan bundle: |
fit_H1, fit_H0
|
Alternative and restricted fits to the same data. |
A list with covariance and test results, component availability and convergence metadata. Nested inference returns one difference test.
Provides a small reproducible convergence-study design. The catalog lists published design names and defaults; generators return data and model information without running a calibration study.
convergence_sim(design = convergence_sim_catalog()$design, ...)convergence_sim(design = convergence_sim_catalog()$design, ...)
design |
Design name from convergence_sim_catalog. |
... |
Additional options forwarded to model construction or the underlying named operation. |
The design catalog, or generated data and model metadata for the selected design.
Provides a small reproducible convergence-study design. The catalog lists published design names and defaults; generators return data and model information without running a calibration study.
convergence_sim_catalog()convergence_sim_catalog()
The design catalog, or generated data and model metadata for the selected design.
Provides a small reproducible convergence-study design. The catalog lists published design names and defaults; generators return data and model information without running a calibration study.
convergence_sim_dejonckere_crossloading(n = 20L, variant = c("2025", "2022"), fit_model = c("correct", "omit_lambda8", "omit_lambda8_lambda9", "omit_all_crossloadings"), beta = NULL, seed = NULL)convergence_sim_dejonckere_crossloading(n = 20L, variant = c("2025", "2022"), fit_model = c("correct", "omit_lambda8", "omit_lambda8_lambda9", "omit_all_crossloadings"), beta = NULL, seed = NULL)
n |
Number of observations to generate. |
variant |
Published design version, 2025 or 2022. |
fit_model |
Crossloading specification to fit: correct or one of the omission variants shown in usage. |
beta |
Latent regression coefficient or coefficient vector; NULL uses the design default. |
seed |
Optional random-number seed. |
The design catalog, or generated data and model metadata for the selected design.
Provides a small reproducible convergence-study design. The catalog lists published design names and defaults; generators return data and model information without running a calibration study.
convergence_sim_dejonckere_msst(n = 10L, state_loadings = c(1, 0.5, 1.3), trait_loadings = c(1, 0.5, 1.3), measurement_error = c(0.6, 0.25, 0.7), trait_var = 0.6, state_residual_var = c(0.6, 0.25, 0.7), seed = NULL)convergence_sim_dejonckere_msst(n = 10L, state_loadings = c(1, 0.5, 1.3), trait_loadings = c(1, 0.5, 1.3), measurement_error = c(0.6, 0.25, 0.7), trait_var = 0.6, state_residual_var = c(0.6, 0.25, 0.7), seed = NULL)
n |
Number of observations to generate. |
state_loadings |
State-factor loading vector. |
trait_loadings |
Trait-factor loading vector. |
measurement_error |
Indicator measurement-error variance vector. |
trait_var |
Trait-factor variance. |
state_residual_var |
State-factor residual variance vector. |
seed |
Optional random-number seed. |
The design catalog, or generated data and model metadata for the selected design.
Provides a small reproducible convergence-study design. The catalog lists published design names and defaults; generators return data and model information without running a calibration study.
convergence_sim_dejonckere_shrinkage(n = 20L, study = c("study1", "study2"), indicators = NULL, beta = NULL, seed = NULL)convergence_sim_dejonckere_shrinkage(n = 20L, study = c("study1", "study2"), indicators = NULL, beta = NULL, seed = NULL)
n |
Number of observations to generate. |
study |
Shrinkage design: study1 or study2. |
indicators |
Number of indicators per factor; NULL uses the study default. |
beta |
Latent regression coefficient or coefficient vector; NULL uses the design default. |
seed |
Optional random-number seed. |
The design catalog, or generated data and model metadata for the selected design.
Provides a small reproducible convergence-study design. The catalog lists published design names and defaults; generators return data and model information without running a calibration study.
convergence_sim_dejonckere_simple(n = 20L, variant = c("2025", "2022"), beta = NULL, seed = NULL)convergence_sim_dejonckere_simple(n = 20L, variant = c("2025", "2022"), beta = NULL, seed = NULL)
n |
Number of observations to generate. |
variant |
Published design version, 2025 or 2022. |
beta |
Latent regression coefficient or coefficient vector; NULL uses the design default. |
seed |
Optional random-number seed. |
The design catalog, or generated data and model metadata for the selected design.
Provides a small reproducible convergence-study design. The catalog lists published design names and defaults; generators return data and model information without running a calibration study.
convergence_sim_ludtke_cfa(n = 30L, rho = 0.3, loading = 0.5, seed = NULL)convergence_sim_ludtke_cfa(n = 30L, rho = 0.3, loading = 0.5, seed = NULL)
n |
Number of observations to generate. |
rho |
Latent factor correlation. |
loading |
Common standardized factor loading. |
seed |
Optional random-number seed. |
The design catalog, or generated data and model metadata for the selected design.
Converts observations into native sample moments or raw-data input for the corresponding fitting route.
df_to_data(x, model, group = NULL, missing = c("listwise", "error"), scaling = c("n", "n-1"))df_to_data(x, model, group = NULL, missing = c("listwise", "error"), scaling = c("n", "n-1"))
x |
Input data frame; for mi_screen, a modification-index or score-test results table. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
group |
Grouping-variable name or group identifiers, as appropriate for the data. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
scaling |
Sample covariance divisor: n or n minus one. |
A prepared data list with observed-variable and group ordering.
Converts observations into native sample moments or raw-data input for the corresponding fitting route.
df_to_fcsem_data(x, model, missing = c("listwise", "error"), scaling = c("n", "n-1"))df_to_fcsem_data(x, model, missing = c("listwise", "error"), scaling = c("n", "n-1"))
x |
Input data frame; for mi_screen, a modification-index or score-test results table. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
scaling |
Sample covariance divisor: n or n minus one. |
A prepared data list with observed-variable and group ordering.
Converts observations into native sample moments or raw-data input for the corresponding fitting route.
df_to_fiml_data(x, model, group = NULL)df_to_fiml_data(x, model, group = NULL)
x |
Input data frame; for mi_screen, a modification-index or score-test results table. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
group |
Grouping-variable name or group identifiers, as appropriate for the data. |
A prepared data list with observed-variable and group ordering.
Translate explicit EQS covariance-model sections into the shared magmaan model. Estimation and inference use magmaan, not the EQS application.
eqs_model(syntax, observed_names = NULL)eqs_model(syntax, observed_names = NULL)
syntax |
One string containing |
observed_names |
Optional names in EQS data-column order. |
This initial subset supports single-group continuous covariance models.
Every equation has one distinct error variable with a fixed unit coefficient:
E for observed variables and D for factors. Every factor must
have an observed indicator. Error numbering need not match equation numbering.
A coefficient followed by * is free; a preceding number supplies its
start. A coefficient without * is fixed (implicit coefficient one).
Missing independent variances are free and missing covariances are zero.
Identification follows explicit EQS specifications; no marker loading or
single-indicator residual fix is added. Free parameters without supplied starts
use magmaan's start policy, not EQS's internal start algorithm.
Job files, /MODEL, /LABELS, constraints, means (V999),
multiple groups, shared errors, nonunit error paths and error/predictor or
E/D covariances are rejected. Observed indicators participating
in structural regressions are also outside this subset; separate observed
predictors and purely observed path models are supported.
Supply data and estimator separately.
Scientific exponents must have a sign, e.g. 1e-3, to distinguish
1E1, which is a unit coefficient on error E1.
A magmaan_model_spec for fit_model() and prepare_model().
eqs_source retains the original input;
syntax is its explicit lavaan projection for rebuilding and refitting.
model <- eqs_model(" /EQUATIONS V1 = *F1 + E1; V2 = .7*F1 + E2; V3 = .8*F1 + E3; /VARIANCES F1 = 1; E1-E3 = .5*; ", observed_names = c("x1", "x2", "x3"))model <- eqs_model(" /EQUATIONS V1 = *F1 + E1; V2 = .7*F1 + E2; V3 = .8*F1 + E3; /VARIANCES F1 = 1; E1-E3 = .5*; ", observed_names = c("x1", "x2", "x3"))
Summarizes parameter changes from case_rerun under the selected standard-error convention.
est_change(rerun_out, parameters = NULL, se = c("standard", "robust.sem", "robust.huber.white"))est_change(rerun_out, parameters = NULL, se = c("standard", "robust.sem", "robust.huber.white"))
rerun_out |
Case-rerun result from case_rerun. |
parameters |
Optional parameter indices or names to retain. |
se |
Standard-error convention. fit_model is estimate-only and accepts only "none"; SAM and est_change expose the choices shown in their signatures. |
A parameter-change results table.
The SE/type defaults standardize SAM or case-change diagnostics. They do not assert a generic misspecification-robust inference law; explicit robust or estimated-weight choices remain available within their supported scope.
The one-step approximation of est_change() without refitting: the
approximate raw change Δ ≈ (N/(N-1))·V·s_i standardized by the full-sample
SE, plus an approximate generalized Cook's distance
gcd_approx = Δ' V_sel^{-1} Δ.
est_change_approx( fit, parameters = NULL, type = c("standard", "estimated.weight") )est_change_approx( fit, parameters = NULL, type = c("standard", "estimated.weight") )
fit |
A fitted |
parameters |
Optional parameter selector; default all free parameters. |
type |
|
This deliberately uses the correct finite-sample scaling, which differs
from semfindr::est_change_approx() (v0.2.0) by two known constant factors:
semfindr applies N/(N-1) twice to DFTHETAS (one too many — the factor is
already in the raw one-step change) and applies it only once inside gCD (one
too few). With matched columns, est_change_approx(magmaan) relates to
semfindr by dftheta_magmaan = dftheta_semfindr · (N-1)/N and
gcd_magmaan = gcd_semfindr · N/(N-1). Both factors are O(1/N) and immaterial
relative to the one-step error, but they have no first-principles basis (see
the influence-function derivation; tracked as an upstream-PR item). The raw
est_change_raw_approx() is unaffected (semfindr is correct there).
A matrix with one column per selected parameter plus gcd_approx,
one row per case.
The SE/type defaults standardize SAM or case-change diagnostics. They do not assert a generic misspecification-robust inference law; explicit robust or estimated-weight choices remain available within their supported scope.
For each case, (estimate with all cases) - (estimate without this case).
With standardized = FALSE (default) these are raw coefficient changes;
with standardized = TRUE they are changes in the standardized (std.all)
solution. The change is NOT divided by a standard error (see est_change()).
Mirror of semfindr::est_change_raw().
est_change_raw(rerun_out, parameters = NULL, standardized = FALSE)est_change_raw(rerun_out, parameters = NULL, standardized = FALSE)
rerun_out |
Output of |
parameters |
Optional selector (lavaan-syntax names and/or operators
|
standardized |
Use the standardized (std.all) solution. Default |
A matrix, one row per case, one column per selected parameter, rownames = case ids.
The SE/type defaults standardize SAM or case-change diagnostics. They do not assert a generic misspecification-robust inference law; explicit robust or estimated-weight choices remain available within their supported scope.
(N/(N-1))·V·s_i per case, the one-step approximation of est_change_raw()
without refitting. Mirror of semfindr::est_change_raw_approx().
est_change_raw_approx( fit, parameters = NULL, type = c("standard", "estimated.weight") )est_change_raw_approx( fit, parameters = NULL, type = c("standard", "estimated.weight") )
fit |
A fitted |
parameters |
Optional parameter selector; default all free parameters. |
type |
|
With type = "estimated.weight" this is the misspecification-robust
("complete-sandwich") one-step change for a moment-quadratic fit whose weight
is estimated from the data (continuous GLS/WLS, ordinal DWLS/WLSMV; ULS is
fixed-weight and so unchanged): the per-case influence carries the
data-dependent-weight term that semfindr / Pek & MacCallum drop by treating
the estimator weight as fixed. That term is O_p(N^{-1}) under a correct
model but O_p(N^{-1/2}) under misspecification (Hall-Inoue order promotion),
so the two regimes agree at the null and diverge under misfit; it is the
casewise dual of the estimated-weight standard error. The result then carries
two attributes: "naive" (the fixed-weight one-step change) and
"weight_diagnostic" (their difference, the per-case Δ'W'_d term). There is
no semfindr counterpart; this is a frontier extension.
Both regimes support single- and multiple-group fits; multiple-group rows are
block-stacked (g{b}_{row} ids, group-suffixed columns).
A matrix, one row per case, one column per selected parameter (plus
the "naive" / "weight_diagnostic" attributes when
type = "estimated.weight").
The SE/type defaults standardize SAM or case-change diagnostics. They do not assert a generic misspecification-robust inference law; explicit robust or estimated-weight choices remain available within their supported scope.
Computes precision diagnostics for factor scores from a fit and complete raw observations.
factor_score_precision(fit, data)factor_score_precision(fit, data)
fit |
A fitted magmaan model. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
Native factor-score precision diagnostics.
Computes factor scores from raw observations. The default is regression for continuous fits and EBM for ordinal fits; explicit choices include regression, bartlett, EBM, ML and EAP.
factor_scores(fit, data, method = NULL)factor_scores(fit, data, method = NULL)
fit |
A fitted magmaan model. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
method |
Method selector; see the available choices in the usage signature and details. |
Factor-score estimates returned by the native scoring operation.
Constructs, fits or summarizes the native factor-component SEM representation. These objects use their own fitting route.
fcsem_fit_measures(fit)fcsem_fit_measures(fit)
fit |
A fitted magmaan model. |
A factor-component model specification, fitted model or named post-fit summary, according to the operation.
Constructs, fits or summarizes the native factor-component SEM representation. These objects use their own fitting route.
fcsem_model_spec(syntax, ...)fcsem_model_spec(syntax, ...)
syntax |
A single model-syntax string. |
... |
Additional options forwarded to model construction or the underlying named operation. |
A factor-component model specification, fitted model or named post-fit summary, according to the operation.
Constructs, fits or summarizes the native factor-component SEM representation. These objects use their own fitting route.
fcsem_standard_errors(fit)fcsem_standard_errors(fit)
fit |
A fitted magmaan model. |
A factor-component model specification, fitted model or named post-fit summary, according to the operation.
Constructs, fits or summarizes the native factor-component SEM representation. These objects use their own fitting route.
fcsem_standardized_rows(fit, vcov = NULL)fcsem_standardized_rows(fit, vcov = NULL)
fit |
A fitted magmaan model. |
vcov |
Explicit covariance matrix of free parameters, in theta order. |
A factor-component model specification, fitted model or named post-fit summary, according to the operation.
Lab-only Wald intervals for continuous complete-data ML and FIML,
including independent groups, random x and affine equality constraints.
Points agree with policy_fit_measures(). The variance candidate has not
been adopted or coverage-calibrated.
fit_index_intervals_misspec(fit, level = 0.90)fit_index_intervals_misspec(fit, level = 0.90)
fit |
A fitted magmaanlab model retaining raw observations. |
level |
Confidence level strictly between zero and one, default 0.90. |
The casewise likelihood contrast gives the first-order user discrepancy
variance V1. The second-order V2 is , where
uses saturated observed
information, constraint-reduced model observed information, the implied-moment
Jacobian and the saturated score outer product. Covariance-only ML includes
its profiled group-mean nuisance parameters.
wald_f maps a Wald interval for the corrected discrepancy to RMSEA.
wald_sqrt uses its square-root coordinate and requires a positive
corrected discrepancy. CFI and TLI use the joint user/baseline first-order delta
method plus V2 for the user discrepancy; their intervals coincide for both
variants. CFI endpoints are clipped to [0,1]; TLI endpoints are unbounded.
RMSEA lower bounds are clipped at zero. Ordinal, ML2S, other estimators,
clustered, penalized and failed fits return typed unavailable intervals.
A data frame with index, variant, estimate, lower, upper, V1, V2 and reason. V1/V2 are always on the user discrepancy scale, before mapping to an index. The details attribute includes casewise and fit discrepancies, their corrected point, Takeuchi and quadratic traces, sample size and level. Unavailable intervals have NA bounds and explicit reasons.
Convenience wrapper over the existing fit-measure primitives. By default it
reports the standard ML chi-square, df, p-value, baseline chi-square, and
ordinary fit measures. Categorical models report the native n F statistic;
lavaan's (n - G) F standard reporting is available through
convention_inference(). Passing fmg = TRUE or a character vector of FMG test
labels adds an $fmg diagnostic table from fmg_tests().
fit_measures(fit, baseline = NULL, fmg = NULL, robust = NULL, data = NULL)fit_measures(fit, baseline = NULL, fmg = NULL, robust = NULL, data = NULL)
fit |
A fitted magmaan model. |
baseline |
Optional baseline result from |
fmg |
|
robust |
Optional scalar list with lavaan-style scaled user and baseline test fields. Automatic robust estimator dispatch is not yet wired. |
data |
Optional complete raw data used only when FMG is requested and
the fit does not carry |
For each case, (fit measure with all cases) - (fit measure without this case) for each requested measure. Mirror of
semfindr::fit_measures_change().
fit_measures_change( rerun_out, fit_measures = c("chisq", "cfi", "rmsea", "tli") )fit_measures_change( rerun_out, fit_measures = c("chisq", "cfi", "rmsea", "tli") )
rerun_out |
Output of |
fit_measures |
Names of fit measures (as returned by |
A matrix, one row per case, one column per measure, rownames = case ids.
Estimated-weight (categorical DWLS) misspecification inference for the absolute and incremental fit indices RMSEA, CRMR, SRMR, CFI and TLI, each with a confidence interval that propagates the sampling variability of the estimated polychoric weight (the gamma channel). The single consolidated surface over the per-index entry points. Single- and multi-group all-ordinal DWLS fits only. Exact residual inference includes pooled weights and cross-group parameter influence; the OPG default keeps its legacy blockwise approximation. Residual point fields in this consolidated table remain uncorrected.
fit_measures_misspec( fit, ordinal_stats = NULL, estimated_weight = TRUE, conf_level = 0.9, eig_tol = 1e-10, first_stage = c("opg", "exact") )fit_measures_misspec( fit, ordinal_stats = NULL, estimated_weight = TRUE, conf_level = 0.9, eig_tol = 1e-10, first_stage = c("opg", "exact") )
fit |
A fitted all-ordinal DWLS magmaan object. |
ordinal_stats |
The categorical sample statistics used for the fit, with
|
estimated_weight |
|
conf_level |
Two-sided confidence level for the intervals. |
eig_tol |
Eigenvalue tolerance for the profile-contrast spectrum. |
first_stage |
OPG (default lab convention) or exact empirical sampling influence. Exact requires complete raw data or supplied exact rows; fitting weights remain the NACOV weights used for estimation. |
CFI carries a trustworthy interval and is largely robust to weight estimation;
TLI's point is calibrated but its interval is conservative and unreliable at
strong misfit (the generalized-df ratio is ill-conditioned). See
cfi_tli_misspec_inference.tex.
A named list: rmsea/crmr/srmr/cfi/tli with .ci.lower and
.ci.upper, the exact-fit rmsea.pvalue and crmr.pvalue, the user and
baseline chisq/df, conf.level, estimated.weight, and warnings.
Exact discrepancy points also include the known N-divisor bias of the continuous covariance moments. Polychoric/polyserial bias remains omitted. Exact residual inference uses the full pooled influence map; OPG retains its legacy blockwise approximation and defaults. The consolidated residual point fields remain uncorrected.
fit_measures_misspec_mixed_ordinal( fit, mixed_stats = NULL, estimated_weight = TRUE, conf_level = 0.9, eig_tol = 1e-10, first_stage = c("opg", "exact") )fit_measures_misspec_mixed_ordinal( fit, mixed_stats = NULL, estimated_weight = TRUE, conf_level = 0.9, eig_tol = 1e-10, first_stage = c("opg", "exact") )
fit |
A mixed continuous/ordinal DWLS fit returned by the core mixed ordinal fitting helpers. |
mixed_stats |
The mixed continuous/ordinal sample statistics used for the
fit, with |
estimated_weight |
|
conf_level |
Two-sided confidence level for the intervals. |
eig_tol |
Eigenvalue tolerance for the profile-contrast spectrum. |
first_stage |
OPG (default lab convention) or exact empirical sampling influence. Exact requires complete raw data or supplied exact rows; fitting weights remain the NACOV weights used for estimation. |
A named list with the same fields as fit_measures_misspec().
The user statistic is the residual goodness-of-fit T on df degrees of
freedom under the chosen discrepancy, referred to an independence-model
baseline under the SAME discrepancy. Naive indices treat T as central
chi-square; robust indices use the Satorra-Bentler scaling scale_c (user) and
the baseline scaling (independence model) to correct the mixture reference.
logl/unrestricted.logl/aic/bic/bic2 are reported as NA: these are
likelihood information criteria and are not defined for the closed-form
non-ML estimator.
fit_measures_noniterative( fit, discrepancy = c("ntml", "uls"), gamma = c("nt", "empirical"), data = NULL, baseline = NULL, fmg = NULL )fit_measures_noniterative( fit, discrepancy = c("ntml", "uls"), gamma = c("nt", "empirical"), data = NULL, baseline = NULL, fmg = NULL )
fit |
A fit from |
discrepancy |
|
gamma |
|
data |
Raw data, required when |
baseline |
Optional precomputed |
fmg |
Optional passthrough to |
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
Constructs, fits or summarizes the native factor-component SEM representation. These objects use their own fitting route.
fit_ml_fcsem(model, data, missing = c("listwise", "error"), control = NULL)fit_ml_fcsem(model, data, missing = c("listwise", "error"), control = NULL)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
A factor-component model specification, fitted model or named post-fit summary, according to the operation.
Fits the requested objective and returns estimates and diagnostics. Inference is composed explicitly after fitting.
fit_model(model, data, estimator = "ML", groups = NULL, ..., cluster = NULL, ordered = NULL, parameterization = "delta", missing = c("listwise", "error", "pairwise"), pd_gamma = c("overlap", "nominal"), se = "none", test = "none", W = NULL, optimizer = NULL, control = NULL, bounds = NULL, stage2_weight = "nt", dls_a = 0.5, stage1_regularization = NULL, psd = FALSE, covariance = NULL, barrier = NULL, weight = NULL, options = NULL)fit_model(model, data, estimator = "ML", groups = NULL, ..., cluster = NULL, ordered = NULL, parameterization = "delta", missing = c("listwise", "error", "pairwise"), pd_gamma = c("overlap", "nominal"), se = "none", test = "none", W = NULL, optimizer = NULL, control = NULL, bounds = NULL, stage2_weight = "nt", dls_a = 0.5, stage1_regularization = NULL, psd = FALSE, covariance = NULL, barrier = NULL, weight = NULL, options = NULL)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
estimator |
Estimation objective. Supported objectives depend on the data kind and fitting route. |
groups |
Grouping-variable name used when constructing a model from syntax. |
... |
Additional options forwarded to model construction or the underlying named operation. |
cluster |
Cluster-variable name or cluster identifiers for two-level fitting. |
ordered |
Names of ordinal observed variables. |
parameterization |
Ordinal model parameterization; currently delta. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
pd_gamma |
Pairwise fourth-moment covariance convention: overlap or nominal. |
se |
Standard-error convention. fit_model is estimate-only and accepts only "none"; SAM and est_change expose the choices shown in their signatures. |
test |
Test convention. fit_model is estimate-only and accepts only "none". |
W |
Fixed fitting-weight matrix, or a per-group list in model moment order. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits,
tolerances and optional starts. |
bounds |
Lower and upper parameter-bound vectors or a named bounds preset; NULL leaves the route default. |
stage2_weight |
Two-stage fitting weight selector, such as nt or adf. |
dls_a |
DLS mixing scalar in [0, 1]: zero is normal theory and one is ADF. |
stage1_regularization |
Optional Stage-1 regularization specification for ML2S. |
psd |
Whether to constrain model covariance blocks to be positive semidefinite. |
covariance |
Covariance-domain policy: unrestricted, psd or barrier. |
barrier |
Barrier options with target and non-negative weight. |
weight |
Weight selector or explicit fitting weight as required by the route. |
options |
Named fitting-options list: preset, starts, optimizer, convergence and marker. The lavaan-0.7.2 preset selects all four components. marker = "default" keeps requested markers; marker = "lavaan-0.7.2" applies the weak-marker rule for continuous ML, FIML and ordinal/mixed DWLS and retries the original model if the switched fit is rejected. The fit retains the actual model and fitting$marker_switch (lv, old, new, signed r_old and r_new rounded to three decimals, reverted). The rule reads each route's saturated H1 covariance. Conditional-x residual H1 and composite adaptation are unsupported. Nested inference and refit_from_null explicitly refuse switched marker coordinates. Components may also be supplied in control$fitting_options. |
A magmaan_fit list with parameter estimates, fitting options, convergence and admissibility diagnostics.
Dataframe helpers, prepared data and fitted lab objects retain a read-only
deletion record. Its policy identifies listwise, error, FIML or
pairwise row handling; known indicates whether supplied-row counts are
available. per_group contains group, rows_supplied,
rows_used, rows_deleted, and exclusive reason counts
missing_model_values, missing_group_label,
unknown_group_label, and missing_cluster_id.
Reasons take precedence in that order: group labels, cluster IDs, model values.
Rows without an assignable group appear in a separate NA group row.
Single-level routes still refuse missing or unknown group labels; two-level
listwise preparation deletes missing group or cluster IDs. FIML and ML2S retain
incomplete rows without listwise deletion; existing native refusals remain.
Summary-only inputs without retained provenance report unknown supplied/deleted
counts, rather than claiming that no earlier deletion occurred.
Fit a non-iterative CFA estimator.
fit_noniterative_cfa( partable, sample_stats, estimator = "guttman_lavaan", composite = "auto", admissibility = "raw", margin = 1e-04, beta0 = 1, rate = 0.5, score_conditioning = "raw", score_floor0 = 1, score_rate = 0.5, h_conditioning = "raw", h_floor0 = 1, h_rate = 0.5 )fit_noniterative_cfa( partable, sample_stats, estimator = "guttman_lavaan", composite = "auto", admissibility = "raw", margin = 1e-04, beta0 = 1, rate = 0.5, score_conditioning = "raw", score_floor0 = 1, score_rate = 0.5, h_conditioning = "raw", h_floor0 = 1, h_rate = 0.5 )
partable |
A magmaan/lavaan parameter table. |
sample_stats |
A magmaan sample-statistics list (S, nobs, ...). |
estimator |
Non-iterative estimator. |
composite |
Composite weights used by the Guttman regression:
|
admissibility |
Communality admissibility policy: |
margin |
Symmetric communality-box margin. |
beta0 |
Base soft-clamp sharpness. |
rate |
Sample-size exponent used to resolve soft-clamp sharpness as
|
score_conditioning |
Score-covariance conditioning policy. |
score_floor0 |
Base normalized score-eigenvalue floor. |
score_rate |
Sample-size exponent resolving the floor as
|
h_conditioning |
Feasibility-only fixed-diagonal PSD repair for the
aligned H proxy: |
h_floor0 |
Base normalized H-eigenvalue floor. |
h_rate |
Sample-size exponent resolving the H floor as
|
A magmaan fit object (same shape as fit_model()), usable by the
inference helpers below and by partable inspection.
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
This is not the inference-side Omega projection returned by
noniterative_cfa_constrained(). It imposes the metric loading-shape
constraint inside the Sigma/H reconstruction itself: a common standardized
loading shape is estimated across groups and then converted back to the
marker chart represented by partable.
fit_noniterative_cfa_metric( partable, sample_stats, estimator = "guttman_aligned", composite = "auto", admissibility = "raw", margin = 1e-04, beta0 = 1, rate = 0.5, score_conditioning = "raw", score_floor0 = 1, score_rate = 0.5, h_conditioning = "raw", h_floor0 = 1, h_rate = 0.5 )fit_noniterative_cfa_metric( partable, sample_stats, estimator = "guttman_aligned", composite = "auto", admissibility = "raw", margin = 1e-04, beta0 = 1, rate = 0.5, score_conditioning = "raw", score_floor0 = 1, score_rate = 0.5, h_conditioning = "raw", h_floor0 = 1, h_rate = 0.5 )
partable |
A magmaan/lavaan parameter table. |
sample_stats |
A magmaan sample-statistics list (S, nobs, ...). |
estimator |
Non-iterative estimator. |
composite |
Composite weights used by the Guttman regression:
|
admissibility |
Communality admissibility policy: |
margin |
Symmetric communality-box margin. |
beta0 |
Base soft-clamp sharpness. |
rate |
Sample-size exponent used to resolve soft-clamp sharpness as
|
score_conditioning |
Score-covariance conditioning policy. |
score_floor0 |
Base normalized score-eigenvalue floor. |
score_rate |
Sample-size exponent resolving the floor as
|
h_conditioning |
Feasibility-only fixed-diagonal PSD repair for the
aligned H proxy: |
h_floor0 |
Base normalized H-eigenvalue floor. |
h_rate |
Sample-size exponent resolving the H floor as
|
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
Residual-variance equality constraints are imposed in the Guttman H communality step before the loadings are reconstructed. Loading-only linear equalities are then projected with a Sigma-only composite metric. Rows that mix residual and loading parameters, or rows involving factor variances, intercepts, or latent means, are rejected.
fit_noniterative_cfa_restricted( partable, sample_stats, estimator = "guttman_aligned", communality = "triad_wls", composite = "auto", admissibility = "raw", margin = 1e-04, beta0 = 1, rate = 0.5, score_conditioning = "raw", score_floor0 = 1, score_rate = 0.5, h_conditioning = "raw", h_floor0 = 1, h_rate = 0.5 )fit_noniterative_cfa_restricted( partable, sample_stats, estimator = "guttman_aligned", communality = "triad_wls", composite = "auto", admissibility = "raw", margin = 1e-04, beta0 = 1, rate = 0.5, score_conditioning = "raw", score_floor0 = 1, score_rate = 0.5, h_conditioning = "raw", h_floor0 = 1, h_rate = 0.5 )
partable |
A magmaan/lavaan parameter table. |
sample_stats |
A magmaan sample-statistics list (S, nobs, ...). |
estimator |
Non-iterative estimator. |
communality |
Least-squares-form communality rule for the residual/H
step: |
composite |
Composite weights used by the Guttman regression:
|
admissibility |
Communality admissibility policy: |
margin |
Symmetric communality-box margin. |
beta0 |
Base soft-clamp sharpness. |
rate |
Sample-size exponent used to resolve soft-clamp sharpness as
|
score_conditioning |
Score-covariance conditioning policy. |
score_floor0 |
Base normalized score-eigenvalue floor. |
score_rate |
Sample-size exponent resolving the floor as
|
h_conditioning |
Feasibility-only fixed-diagonal PSD repair for the
aligned H proxy: |
h_floor0 |
Base normalized H-eigenvalue floor. |
h_rate |
Sample-size exponent resolving the H floor as
|
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
Fits the native two-level model using cluster identifiers and optional group identifiers.
fit_twolevel(model, data, cluster, group = NULL, optimizer = "nlopt-lbfgs", control = NULL, bounds = NULL, missing = c("listwise", "error"))fit_twolevel(model, data, cluster, group = NULL, optimizer = "nlopt-lbfgs", control = NULL, bounds = NULL, missing = c("listwise", "error"))
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
cluster |
Cluster-variable name or cluster identifiers for two-level fitting. |
group |
Grouping-variable name or group identifiers, as appropriate for the data. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
bounds |
Lower and upper parameter-bound vectors or a named bounds preset; NULL leaves the route default. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
A two-level fitted-model result.
Applies the FMG eigenvalue-tail transforms to the Satorra-2000
restriction-map difference spectrum returned by robust_nested_lrt(). For
complete-data ML pairs an explicit _rls suffix uses the difference between
the two Browne RLS residual statistics, evaluated at the ML estimates, as the
asymptotically equivalent base statistic. An _ug suffix selects the
Browne/Du-Bentler finite-sample correction to the nested Gamma spectrum.
Unsuffixed tests and _ml retain the likelihood-ratio difference. FIML and
two-stage ML (ML2S) support only the biased Gamma and ML base.
fmg_nested( fit_H1, fit_H0, data = NULL, tests = NULL, A.method = c("exact", "delta"), weight = NULL, gamma = NULL )fmg_nested( fit_H1, fit_H0, data = NULL, tests = NULL, A.method = c("exact", "delta"), weight = NULL, gamma = NULL )
fit_H1 |
Less-restricted fitted model. |
fit_H0 |
More-restricted fitted model. |
data |
Raw complete data for complete-data ML or continuous LS pairs.
FIML and ML2S pairs use |
tests |
Character vector of semTests-style test names, or |
A.method |
|
weight |
Explicit fitting weight for continuous WLS. Continuous ULS and GLS rebuild their identity/normal-theory weights. |
gamma |
Continuous-LS Gamma source. |
A magmaan_fmg_tests data frame. Numerical diagnostics from the
nested-test backend are available in attr(x, "warnings").
This is an FMG/semTests replication-compatibility route. Its NT/fixed-weight conventions reproduce the documented comparator and are distinct from the generic nested policy in robust_nested_lrt().
The nested-model analogue of fmg_tests_ordinal(). The Satorra-2000 reduction
of the two polychoric least-squares fits yields a difference triple — the
unscaled LS difference statistic , the restriction rank
(df_diff), and the difference spectrum (the nested UGamma eigenvalues) —
and the same FMG eigenvalue-tail transforms are applied to it, exactly as
fmg_tests_ordinal() applies them to a single-model UGamma spectrum.
fmg_nested_ordinal( fit_H1, fit_H0, ordinal_stats, tests = NULL, weight = "", A.method = c("delta", "exact") ) fmg_nested_mixed_ordinal( fit_H1, fit_H0, mixed_stats, tests = NULL, weight = "", A.method = c("delta", "exact") )fmg_nested_ordinal( fit_H1, fit_H0, ordinal_stats, tests = NULL, weight = "", A.method = c("delta", "exact") ) fmg_nested_mixed_ordinal( fit_H1, fit_H0, mixed_stats, tests = NULL, weight = "", A.method = c("delta", "exact") )
fit_H1 |
Less-restricted (e.g. configural) ordinal least-squares fit. |
fit_H0 |
More-restricted (e.g. metric / |
ordinal_stats |
The categorical sample statistics used for both fits
(the object from |
tests, weight
|
As in |
A.method |
|
mixed_stats |
The mixed continuous/ordinal sample statistics used for
both fits (the object from |
A.method defaults to "delta": the configural-to-metric ordinal invariance
step is non-nested (Wu-Estabrook metric frees the group-2+ scale/intercepts
that configural fixes), so the exact parameter-nesting restriction does not
apply — the moment-Jacobian column-space (delta) restriction is what
lavaan's lavTestLRT(method = "satorra.2000") uses there. (robust_nested_lrt()
keeps the "exact" default for nested complete-data/FIML pairs.)
A magmaan_fmg_tests data frame, identical in shape to
fmg_tests_ordinal(). Numerical diagnostics from the nested-test backend
are available in attr(x, "warnings").
Back-compatible named-vector view over fmg_tests(). New code that needs
diagnostics should call fmg_tests() or fit_measures(..., fmg = tests).
fmg_pvalues( fit, data = NULL, tests = NULL, weight = NULL, gamma = c("empirical", "normal") )fmg_pvalues( fit, data = NULL, tests = NULL, weight = NULL, gamma = c("empirical", "normal") )
fit |
A fitted magmaan model. |
data |
Optional complete raw data. If omitted, |
tests |
Character vector of semTests-style test names. Recognised types:
|
weight |
Optional explicit continuous-WLS fitting weight, passed to
|
gamma |
Continuous-LS moment-covariance source, passed to |
A named numeric vector of p-values; names are the canonical test
labels (e.g. peba4_rls, sb_ug_rls), matching semTests::pvalues().
Computes FMG p-values and diagnostics for a complete-data ML or continuous
ULS/GLS/WLS fit, or a FIML (missing-data) fit. Complete-data fits must carry
complete raw data, as fits from fit_model(..., data.frame) do, or callers can
pass complete raw data explicitly.
fmg_tests( fit, tests = NULL, data = NULL, weight = NULL, gamma = c("empirical", "normal") )fmg_tests( fit, tests = NULL, data = NULL, weight = NULL, gamma = c("empirical", "normal") )
fit |
A fitted magmaan ML, continuous ULS/GLS/WLS, FIML, or ML2S model. |
tests |
Character vector of semTests-style test names, or |
data |
Optional complete raw data (complete-data fits only). Usually
unnecessary for new fits that retain |
weight |
The explicit fitting weight for a continuous WLS fit. Ignored for ML, ULS, and GLS. Magmaan fit objects do not retain caller-supplied WLS weights. |
gamma |
For continuous ULS/GLS/WLS fits, either |
FIML fits (fit_fiml() / fit_model(..., estimator = "FIML"), single- or
multi-group) are supported: the missing-data UGamma spectrum is computed
first-principles from the saturated-model EM ACOV and either saturated or
model-implied H1 information, with the FIML LRT as the base statistic. Under
FIML only the biased Gamma-hat and the ML base are defined, so _ug and
_rls are rejected (an unsuffixed base resolves to ML). This is a principled
construction, not a port of semTests' (unsound) FIML handling.
Two-stage ML (ML2S) fits (fit_ml2s() / fit_model(..., estimator = "ML2S"))
are supported the same way: the df-dimensional UGamma spectrum and the
Stage-2 ML base chi-square are taken from the two-stage inference already
attached to the fit (fit$ml2s). Unsuffixed tests use that ML base; an
explicit _rls suffix instead uses the full fitted-moment RLS residual
quadratic, including restricted means, with the same spectrum. As under
FIML, _ug is rejected.
A data frame with scalar diagnostics plus list-columns for the raw UGamma spectrum and the method-specific lambda vectors.
Applies the FMG eigenvalue-tail transforms to an ordinal (all-categorical) or
mixed continuous/ordinal least-squares fit (DWLS/WLS/ULS over polychoric and
polyserial moments). The UGamma spectrum, base chi-square, and df come from
the same polychoric-NACOV sandwich as robust_ordinal() /
robust_mixed_ordinal(), so the categorical stats are supplied explicitly the
same way. Single- and multi-group fits are supported.
fmg_tests_ordinal(fit, ordinal_stats, tests = NULL, weight = "") fmg_tests_mixed_ordinal(fit, mixed_stats, tests = NULL, weight = "")fmg_tests_ordinal(fit, ordinal_stats, tests = NULL, weight = "") fmg_tests_mixed_ordinal(fit, mixed_stats, tests = NULL, weight = "")
fit |
A fitted magmaan ordinal (or mixed-ordinal) least-squares model. |
ordinal_stats, mixed_stats
|
The categorical sample statistics built by
|
tests |
Character vector of semTests-style test names, or |
weight |
Estimation weight ( |
An ordinal LS fit has one base statistic, the LS chi-square
; there is no ML/RLS split and no Du-Bentler unbiased
Gamma, so test names suffixed _ml or _ug are rejected. As on the
complete-data and FIML paths, the pEBA/pOLS/PALL transforms are magmaan
constructions with no external oracle.
A magmaan_fmg_tests data frame, identical in shape to fmg_tests().
Fits the named objective through an explicit experimental covariance-domain route. PSD variants constrain covariance blocks; multiinfo variants apply the selected barrier target. Inference remains a separate operation.
frontier_fit_fiml_multiinfo(model, data, eta = 1.25, weight = NULL, optimizer = "port", control = NULL, bounds = NULL, target = c("joint", "determinacy"))frontier_fit_fiml_multiinfo(model, data, eta = 1.25, weight = NULL, optimizer = "port", control = NULL, bounds = NULL, target = c("joint", "determinacy"))
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
eta |
Compatibility barrier parameter; used when weight is omitted. |
weight |
Weight selector or explicit fitting weight as required by the route. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
bounds |
Lower and upper parameter-bound vectors or a named bounds preset; NULL leaves the route default. |
target |
Barrier target: joint covariance or factor-score determinacy. |
A fitted-model list with parameter estimates and route diagnostics.
Fits the named objective through an explicit experimental covariance-domain route. PSD variants constrain covariance blocks; multiinfo variants apply the selected barrier target. Inference remains a separate operation.
frontier_fit_fiml_psd(model, data, optimizer = "nlopt-slsqp", control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, psd_factor = c("triangular", "square"))frontier_fit_fiml_psd(model, data, optimizer = "nlopt-slsqp", control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, psd_factor = c("triangular", "square"))
psd_factor |
Covariance factor: triangular (default) or square. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
start_eigen_floor |
Eigenvalue floor used to construct a feasible covariance start. |
feasibility_tol |
Numerical tolerance for covariance feasibility. |
A fitted-model list with parameter estimates and route diagnostics.
Fits the named objective through an explicit experimental covariance-domain route. PSD variants constrain covariance blocks; multiinfo variants apply the selected barrier target. Inference remains a separate operation.
frontier_fit_gls_psd(model, data, optimizer = "nlopt-slsqp", control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, missing = c("listwise", "error"), psd_factor = c("triangular", "square"))frontier_fit_gls_psd(model, data, optimizer = "nlopt-slsqp", control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, missing = c("listwise", "error"), psd_factor = c("triangular", "square"))
psd_factor |
Covariance factor: triangular (default) or square. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
start_eigen_floor |
Eigenvalue floor used to construct a feasible covariance start. |
feasibility_tol |
Numerical tolerance for covariance feasibility. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
A fitted-model list with parameter estimates and route diagnostics.
Fits the named objective through an explicit experimental covariance-domain route. PSD variants constrain covariance blocks; multiinfo variants apply the selected barrier target. Inference remains a separate operation.
frontier_fit_mixed_ordinal_psd(model, data, estimator = c("DWLS", "WLS", "ULS"), optimizer = "nlopt-slsqp", control = NULL, bounds = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, psd_factor = c("triangular", "square"))frontier_fit_mixed_ordinal_psd(model, data, estimator = c("DWLS", "WLS", "ULS"), optimizer = "nlopt-slsqp", control = NULL, bounds = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, psd_factor = c("triangular", "square"))
psd_factor |
Covariance factor: triangular (default) or square. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
estimator |
Estimation objective. Supported objectives depend on the data kind and fitting route. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
bounds |
Lower and upper parameter-bound vectors or a named bounds preset; NULL leaves the route default. |
start_eigen_floor |
Eigenvalue floor used to construct a feasible covariance start. |
feasibility_tol |
Numerical tolerance for covariance feasibility. |
A fitted-model list with parameter estimates and route diagnostics.
Fits the named objective through an explicit experimental covariance-domain route. PSD variants constrain covariance blocks; multiinfo variants apply the selected barrier target. Inference remains a separate operation.
frontier_fit_ml_multiinfo(model, data, eta = 1.25, weight = NULL, optimizer = "port", control = NULL, bounds = NULL, missing = c("listwise", "error"), target = c("joint", "determinacy"))frontier_fit_ml_multiinfo(model, data, eta = 1.25, weight = NULL, optimizer = "port", control = NULL, bounds = NULL, missing = c("listwise", "error"), target = c("joint", "determinacy"))
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
eta |
Compatibility barrier parameter; used when weight is omitted. |
weight |
Weight selector or explicit fitting weight as required by the route. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
bounds |
Lower and upper parameter-bound vectors or a named bounds preset; NULL leaves the route default. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
target |
Barrier target: joint covariance or factor-score determinacy. |
A fitted-model list with parameter estimates and route diagnostics.
Fits the named objective through an explicit experimental covariance-domain route. PSD variants constrain covariance blocks; multiinfo variants apply the selected barrier target. Inference remains a separate operation.
frontier_fit_ml_psd(model, data, optimizer = "nlopt-slsqp", control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, missing = c("listwise", "error"), preconditioning = c("diagonal", "none"), psd_factor = c("triangular", "square"))frontier_fit_ml_psd(model, data, optimizer = "nlopt-slsqp", control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, missing = c("listwise", "error"), preconditioning = c("diagonal", "none"), psd_factor = c("triangular", "square"))
psd_factor |
Covariance factor: triangular (default) or square. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
start_eigen_floor |
Eigenvalue floor used to construct a feasible covariance start. |
feasibility_tol |
Numerical tolerance for covariance feasibility. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
preconditioning |
Optimizer-coordinate preconditioning: none or diagonal. |
A fitted-model list with parameter estimates and route diagnostics.
Fits ordinary complete-data normal-theory ML first, accepting it only when both the common fit verdict and covariance admissibility pass. Otherwise tries PSD-constrained ML once. The selection policy is implemented in C++.
frontier_fit_ml_psd_fallback(model, data, ordinary_optimizer = "nlopt-lbfgs", psd_optimizer = "nlopt-slsqp", ordinary_control = NULL, psd_control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, missing = c("listwise", "error"), preconditioning = c("diagonal", "none"), psd_factor = c("triangular", "square"))frontier_fit_ml_psd_fallback(model, data, ordinary_optimizer = "nlopt-lbfgs", psd_optimizer = "nlopt-slsqp", ordinary_control = NULL, psd_control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, missing = c("listwise", "error"), preconditioning = c("diagonal", "none"), psd_factor = c("triangular", "square"))
psd_factor |
Covariance factor: triangular (default) or square. |
model |
A model specification or model syntax string. |
data |
Sample statistics or a raw data frame. |
ordinary_optimizer |
Ordinary ML optimizer; defaults to NLopt L-BFGS. |
psd_optimizer |
PSD optimizer; defaults to NLopt SLSQP. |
ordinary_control, psd_control
|
Separate optimizer control lists.
Select the initial start policy with |
start_eigen_floor |
Positive floor used to initialize PSD factors, not a lower bound on the fitted covariance eigenvalues. |
feasibility_tol |
PSD covariance-link feasibility tolerance. |
missing |
Raw-data missing-value policy. This is not a FIML route. |
preconditioning |
PSD diagonal information scaling, or none. |
A warm start transfers ordinary parameter estimates only, not optimizer memory. The ordinary return must have finite parameters and objective, a positive-definite implied covariance, and satisfied model equalities to be used as a start. It need not pass accuracy or primitive-covariance admissibility. The PSD initializer projects covariance-factor starts; link equalities may initially be violated and are enforced by the solver. After an ordinary error or unusable return, PSD uses the original start.
Both stages must pass their common numerical verdict and covariance admissibility before their result can be selected. This does not certify global optimality or add boundary-aware inference. Ordinary ML defaults are unchanged. Parsing, data preparation, and initial start-construction errors occur before the fitting policy and raise R errors as usual.
A list with fit (the accepted ordinary or PSD fit, otherwise NULL),
converged, fallback_used, fallback_reason, and
warm_start_used. The reason is "none",
"ordinary-error", "ordinary-rejected", or
"ordinary-inadmissible"; a failed accuracy verdict takes precedence
over inadmissibility when both fail.
ordinary and psd retain each attempt as a list with
fit and error, one of which is NULL. An error records
kind, detail, iterations, and f_value from the
core error value. The entire psd entry is NULL when skipped.
Rejected returned estimates remain accessible even when fit is NULL.
s <- list(S = list(matrix(c(1, .7, .7, .7, 1, .3, .7, .3, 1), 3)), nobs = 300L) result <- frontier_fit_ml_psd_fallback("f =~ x1 + x2 + x3", s) result$fallback_reason result$warm_start_useds <- list(S = list(matrix(c(1, .7, .7, .7, 1, .3, .7, .3, 1), 3)), nobs = 300L) result <- frontier_fit_ml_psd_fallback("f =~ x1 + x2 + x3", s) result$fallback_reason result$warm_start_used
Fits the named objective through an explicit experimental covariance-domain route. PSD variants constrain covariance blocks; multiinfo variants apply the selected barrier target. Inference remains a separate operation.
frontier_fit_ml2s_psd(model, data, optimizer = "nlopt-slsqp", control = NULL, h_step = 1e-04, stage1 = NULL, stage1_regularization = NULL, stage2_weight = "nt", dls_a = 0.5, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, psd_factor = c("triangular", "square"))frontier_fit_ml2s_psd(model, data, optimizer = "nlopt-slsqp", control = NULL, h_step = 1e-04, stage1 = NULL, stage1_regularization = NULL, stage2_weight = "nt", dls_a = 0.5, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, psd_factor = c("triangular", "square"))
psd_factor |
Covariance factor: triangular (default) or square. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
h_step |
Finite-difference step for the two-stage derivative calculation. |
stage1 |
Optional precomputed Stage-1 fit for ML2S. |
stage1_regularization |
Optional Stage-1 regularization specification for ML2S. |
stage2_weight |
Two-stage fitting weight selector, such as nt or adf. |
dls_a |
DLS mixing scalar in [0, 1]: zero is normal theory and one is ADF. |
start_eigen_floor |
Eigenvalue floor used to construct a feasible covariance start. |
feasibility_tol |
Numerical tolerance for covariance feasibility. |
A fitted-model list with parameter estimates and route diagnostics.
Fits the named objective through an explicit experimental covariance-domain route. PSD variants constrain covariance blocks; multiinfo variants apply the selected barrier target. Inference remains a separate operation.
frontier_fit_ordinal_psd(model, data, estimator = c("DWLS", "WLS", "ULS"), optimizer = "nlopt-slsqp", control = NULL, bounds = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, psd_factor = c("triangular", "square"))frontier_fit_ordinal_psd(model, data, estimator = c("DWLS", "WLS", "ULS"), optimizer = "nlopt-slsqp", control = NULL, bounds = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, psd_factor = c("triangular", "square"))
psd_factor |
Covariance factor: triangular (default) or square. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
estimator |
Estimation objective. Supported objectives depend on the data kind and fitting route. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
bounds |
Lower and upper parameter-bound vectors or a named bounds preset; NULL leaves the route default. |
start_eigen_floor |
Eigenvalue floor used to construct a feasible covariance start. |
feasibility_tol |
Numerical tolerance for covariance feasibility. |
A fitted-model list with parameter estimates and route diagnostics.
Fits in sphere coordinates with an explicit metric and pinning penalty, then optionally polishes in ordinary parameter coordinates. Inference remains a separate operation.
frontier_fit_sphere(model, data, estimator = "ML", groups = NULL, ..., cluster = NULL, ordered = NULL, parameterization = "delta", psd = FALSE, missing = c("listwise", "error"), W = NULL, optimizer = NULL, control = NULL, bounds = NULL, metric = c("unit_free", "raw"), pin_weight = 1, pole_tol = 1e-06, polish = TRUE, start = c("canonical", "user"), start_eigen_floor = 1e-06, feasibility_tol = 1e-06, preconditioning = c("none", "diagonal"), psd_factor = c("triangular", "square"))frontier_fit_sphere(model, data, estimator = "ML", groups = NULL, ..., cluster = NULL, ordered = NULL, parameterization = "delta", psd = FALSE, missing = c("listwise", "error"), W = NULL, optimizer = NULL, control = NULL, bounds = NULL, metric = c("unit_free", "raw"), pin_weight = 1, pole_tol = 1e-06, polish = TRUE, start = c("canonical", "user"), start_eigen_floor = 1e-06, feasibility_tol = 1e-06, preconditioning = c("none", "diagonal"), psd_factor = c("triangular", "square"))
psd_factor |
Covariance factor: triangular (default) or square. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
estimator |
Estimation objective. Supported objectives depend on the data kind and fitting route. |
groups |
Grouping-variable name used when constructing a model from syntax. |
... |
Additional options forwarded to model construction or the underlying named operation. |
cluster |
Cluster-variable name or cluster identifiers for two-level fitting. |
ordered |
Names of ordinal observed variables. |
parameterization |
Ordinal model parameterization; currently delta. |
psd |
Whether to constrain model covariance blocks to be positive semidefinite. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
W |
Fixed fitting-weight matrix, or a per-group list in model moment order. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
bounds |
Lower and upper parameter-bound vectors or a named bounds preset; NULL leaves the route default. |
metric |
Sphere-coordinate metric: unit_free or raw. |
pin_weight |
Non-negative weight for the sphere pinning penalty. |
pole_tol |
Tolerance for detecting a sphere-coordinate pole. |
polish |
Whether to polish the sphere solution in ordinary parameter coordinates. |
start |
Start source: canonical construction or user hints. |
start_eigen_floor |
Eigenvalue floor used to construct a feasible covariance start. |
feasibility_tol |
Numerical tolerance for covariance feasibility. |
preconditioning |
Optimizer-coordinate preconditioning: none or diagonal. |
A fitted-model list with parameter estimates and route diagnostics.
Fits the named objective through an explicit experimental covariance-domain route. PSD variants constrain covariance blocks; multiinfo variants apply the selected barrier target. Inference remains a separate operation.
frontier_fit_uls_psd(model, data, optimizer = "nlopt-slsqp", control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, missing = c("listwise", "error"), psd_factor = c("triangular", "square"))frontier_fit_uls_psd(model, data, optimizer = "nlopt-slsqp", control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, missing = c("listwise", "error"), psd_factor = c("triangular", "square"))
psd_factor |
Covariance factor: triangular (default) or square. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
start_eigen_floor |
Eigenvalue floor used to construct a feasible covariance start. |
feasibility_tol |
Numerical tolerance for covariance feasibility. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
A fitted-model list with parameter estimates and route diagnostics.
Fits the named objective through an explicit experimental covariance-domain route. PSD variants constrain covariance blocks; multiinfo variants apply the selected barrier target. Inference remains a separate operation.
frontier_fit_wls_psd(model, data, W, optimizer = "nlopt-slsqp", control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, missing = c("listwise", "error"), psd_factor = c("triangular", "square"))frontier_fit_wls_psd(model, data, W, optimizer = "nlopt-slsqp", control = NULL, start_eigen_floor = 1e-06, feasibility_tol = 1e-06, missing = c("listwise", "error"), psd_factor = c("triangular", "square"))
psd_factor |
Covariance factor: triangular (default) or square. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
W |
Fixed fitting-weight matrix, or a per-group list in model moment order. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
start_eigen_floor |
Eigenvalue floor used to construct a feasible covariance start. |
feasibility_tol |
Numerical tolerance for covariance feasibility. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
A fitted-model list with parameter estimates and route diagnostics.
Computes the local Newton distance for complete-data ML in units of information-based standard errors. It is a quadratic approximation, not a global-optimality certificate. PSD fits can restrict the step to the active covariance face.
frontier_newton_accuracy(fit, budget = 0.01, psd = NULL)frontier_newton_accuracy(fit, budget = 0.01, psd = NULL)
fit |
A fitted magmaan model. |
budget |
Positive allowed Newton distance in information-based standard-error units. |
psd |
Whether to constrain model covariance blocks to be positive semidefinite. |
A diagnostic list with status, distance, predicted gain and whether the requested budget passed.
Projects a sphere-coordinate fitted model into the requested model identification.
frontier_reidentify(fit, model, ..., pole_tol = 1e-06)frontier_reidentify(fit, model, ..., pole_tol = 1e-06)
fit |
A fitted magmaan model. |
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
... |
Additional options forwarded to model construction or the underlying named operation. |
pole_tol |
Tolerance for detecting a sphere-coordinate pole. |
A fitted model in the requested identification with projection diagnostics.
Tests a fitted continuous ML, FIML, or normal-theory ML2S model against its
local saturated mean/covariance alternative. ML/FIML use direct saturated
likelihood scores. ML2S uses the Stage-2 saturated score for the observed
gate and propagates Stage-1 EM casewise moment influence through the fitted
normal-theory metric for multiplier calibration. In each case df is the
saturated moment dimension minus the tangent rank. This is the general
goodness-of-fit counterpart to
score_flip_test(), which instead releases specified affine restrictions.
global_score_flip_test( fit, data = NULL, n_flips = 999L, seed = 1, multiplier = c("rademacher", "mammen", "two-point", "gaussian", "centered-exponential"), two_point_skewness = 1, center_multiplier_scores = FALSE, multiplier_studentization = c("none", "weighted-meat"), sensitivity = c("expected", "observed", "observed-shrink-light", "observed-shrink-sqrt", "observed-h1"), metric = c("expected", "observed", "observed-h1") )global_score_flip_test( fit, data = NULL, n_flips = 999L, seed = 1, multiplier = c("rademacher", "mammen", "two-point", "gaussian", "centered-exponential"), two_point_skewness = 1, center_multiplier_scores = FALSE, multiplier_studentization = c("none", "weighted-meat"), sensitivity = c("expected", "observed", "observed-shrink-light", "observed-shrink-sqrt", "observed-h1"), metric = c("expected", "observed", "observed-h1") )
fit |
A fitted continuous ML, FIML, or normal-theory ML2S |
data |
Raw fitting data for complete-data ML. FIML and ML2S use
|
n_flips |
Number of random multiplier transformations. |
seed |
Non-negative deterministic integer seed. |
multiplier |
Multiplier distribution. Non-Rademacher resampling
requires |
two_point_skewness |
Non-negative third moment for
|
center_multiplier_scores |
Whether to center effective-score contributions within information strata before applying multipliers. |
multiplier_studentization |
Optional |
sensitivity |
Nuisance-projection bread. |
metric |
Score-quadratic and robust-spectrum bread. |
The default sensitivity is observed for FIML under MAR and expected for complete-data global goodness-of-fit under the correct-model null. Explicit sensitivity and metric choices remain available.
A magmaan_global_score_flip_test list containing the effective
multiplier result, asymptotic comparators, and saturated/tangent geometry
diagnostics.
Estimate the diagonal of the Guttman H matrix.
guttman_h( S, blocks, method = c("triad_ls", "extended_triad_ls", "triad_mean", "triad_pooled", "triad_wls", "triad_wls_joint", "ar", "rs", "gmm_block", "gmm_full", "anchor_triad_ls", "ilm", "anchor_ilm") )guttman_h( S, blocks, method = c("triad_ls", "extended_triad_ls", "triad_mean", "triad_pooled", "triad_wls", "triad_wls_joint", "ar", "rs", "gmm_block", "gmm_full", "anchor_triad_ls", "ilm", "anchor_ilm") )
S |
Observed covariance or correlation matrix. |
blocks |
One simple-structure factor/block label per observed variable. |
method |
Communality rule, named as |
A list with correlation-scale communalities h2, covariance-scale
diagonal h_diag, and H, equal to S with the diagonal replaced by
h_diag.
Extracts casewise contributions in group-block order from a prepared inference quadratic.
inference_rows(quadratic)inference_rows(quadratic)
quadratic |
Prepared quadratic from inference_quadratic. |
A matrix of casewise contributions.
Methods-development primitives exposed through magmaan_core.
Their ingredients must describe the component's null and sampling law.
infer_build_u_factor(fit, bread, moments = "structured") infer_build_u_factor_parts(partable, sample_stats, theta, bread, moments = "structured") infer_build_u_factor_pairwise(fit, X, bread, mask = NULL) infer_build_u_factor_fit(fit, bread, moments = "structured") infer_continuous_ls_robust(fit, raw_data = NULL, weight = NULL, bread = "observed", gamma = NULL, fixed_weight = FALSE) infer_continuous_ls_profile_lrt(fit_H1, fit_H0, X_per_group = NULL, weight = NULL, eig_tol = 1e-10, gamma = NULL) infer_ml_profile_lrt(fit_H1, fit_H0, X_per_group = NULL, eig_tol = 1e-10, gamma = NULL) measures_reliability_cov(S, gamma = NULL, n = 0L, raw_data = NULL) measures_reliability_omega_multidim(S, block, target = "total", weights = NULL, gamma = NULL, n = 0L, raw_data = NULL)infer_build_u_factor(fit, bread, moments = "structured") infer_build_u_factor_parts(partable, sample_stats, theta, bread, moments = "structured") infer_build_u_factor_pairwise(fit, X, bread, mask = NULL) infer_build_u_factor_fit(fit, bread, moments = "structured") infer_continuous_ls_robust(fit, raw_data = NULL, weight = NULL, bread = "observed", gamma = NULL, fixed_weight = FALSE) infer_continuous_ls_profile_lrt(fit_H1, fit_H0, X_per_group = NULL, weight = NULL, eig_tol = 1e-10, gamma = NULL) infer_ml_profile_lrt(fit_H1, fit_H0, X_per_group = NULL, eig_tol = 1e-10, gamma = NULL) measures_reliability_cov(S, gamma = NULL, n = 0L, raw_data = NULL) measures_reliability_omega_multidim(S, block, target = "total", weights = NULL, gamma = NULL, n = 0L, raw_data = NULL)
fit |
Fitted model. |
fit_H1, fit_H0
|
Less and more restricted fits for the profile LRT. |
X_per_group |
Raw observations in fitted group order, used when gamma is NULL. Omit when supplying Gamma. |
eig_tol |
Relative tolerance for profile-law eigenvalues. |
bread |
Required geometry for U factors: expected for complete-data global goodness-of-fit under the correct-model null; observed requests the explicit Hessian convention. U factors alone do not certify pseudo-true covariance or nested sampling laws. |
moments |
For U factors, |
partable, sample_stats, theta
|
Model, observed moments and fitted parameters. |
X, mask
|
Raw observations and optional observation mask.
Pass |
raw_data |
Raw fitting observations; a numeric matrix for reliability. |
weight |
Fitting weight, optionally retained on the fit. |
gamma |
For LS robust covariance, NULL retains empirical covariance from
raw_data; |
fixed_weight |
Explicitly request the caller-fixed-weight LS law.
For data-estimated nt/adf/dwls/dls recipes, use
|
S |
Observed covariance matrix in the same metric as Gamma. |
n |
Sample size; inferred from reliability raw_data if zero. |
block |
Integer item-to-factor allocation. |
target |
Total or hierarchical omega. |
weights |
Optional item weights. |
Scalar frontier_profile_lrt_* and interval primitives default
to the misspecification-scaled reference (MisspecScaled) when
reference = NULL, robust = FALSE. Supply raw data where required.
The explicit reference = "ordinary" and
reference = "robust_scaled" comparators remain available.
Explicit robust = TRUE with NULL reference retains RobustScaled.
Named Satorra, lavaan bundle and FMG/semTests replication APIs retain their
documented compatibility conventions. SAM and case-change SE/type options
standardize diagnostics and do not certify a generic inferential covariance.
Returns standardized residual matrices, residual SE and z statistics, SRMR and block summaries. Estimated-weight inference for continuous least squares requires raw observations.
lav_residuals(fit, estimated_weight = TRUE, data = NULL)lav_residuals(fit, estimated_weight = TRUE, data = NULL)
fit |
A fitted magmaan model. |
estimated_weight |
Whether to include estimated-weight influence in continuous least-squares residual inference; requires raw data. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
A list of residual matrices and block-level diagnostic summaries.
A named list of low-level native operations, organized by domain. Use the exported preparation, fitting and inference wrappers when they cover the required operation.
magmaan_coremagmaan_core
A list of callable native primitives.
Constructs, fits or summarizes the native factor-component SEM representation. These objects use their own fitting route.
magmaan_fcsem(model, data, ..., missing = c("listwise", "error"), control = NULL)magmaan_fcsem(model, data, ..., missing = c("listwise", "error"), control = NULL)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
... |
Additional options forwarded to model construction or the underlying named operation. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
A factor-component model specification, fitted model or named post-fit summary, according to the operation.
Model-free leverage measure: stats::mahalanobis(X, colMeans(X), stats::cov(X)) (N-1 covariance), needing no refit. Mirror of
semfindr::mahalanobis_rerun(). For multiple-group fits the distance is
computed within each group (its own mean/cov); pass the original data frame
to place the per-group distances back at the original rows (semfindr order).
mahalanobis_rerun(fit, data = NULL)mahalanobis_rerun(fit, data = NULL)
fit |
A |
data |
Optional original data frame (multiple-group fits, to recover the original row order). If omitted, multiple-group distances are returned in group-block order. |
A one-column matrix of Mahalanobis distances, rownames = case ids.
Adds multiplicity-adjusted p-values and a verdict based on significance and absolute effect size. Missing inputs produce missing verdicts.
mi_screen(x, p = NULL, effect = NULL, alpha = 0.05, effect_min = 0.1, adjust = "BH")mi_screen(x, p = NULL, effect = NULL, alpha = 0.05, effect_min = 0.1, adjust = "BH")
x |
Input data frame; for mi_screen, a modification-index or score-test results table. |
p |
Name of the p-value column; NULL selects a recognized robust column. |
effect |
Name of the effect-size column; NULL selects a recognized robust column. |
alpha |
Significance threshold after multiplicity adjustment. |
effect_min |
Minimum absolute effect size considered substantively large. |
adjust |
Multiplicity method passed to stats::p.adjust. |
The input table with adjusted p-values and verdict (free, trivial, underpowered or ok).
Constructs the model structure, names and start hints used by the lab fitting interfaces.
model_spec(syntax, ..., auto_var = TRUE, auto_cov_lv_x = TRUE, auto_cov_y = FALSE, orthogonal = FALSE, auto_fix_first = TRUE, marker = NULL, auto_fix_single = TRUE, std_lv = FALSE, effect_coding = FALSE, fixed_x = TRUE, meanstructure = "default", model_type = c("sem", "growth"), ordered = NULL, parameterization = "delta", group = NULL, group_labels = NULL, group_equal = NULL, group_partial = NULL)model_spec(syntax, ..., auto_var = TRUE, auto_cov_lv_x = TRUE, auto_cov_y = FALSE, orthogonal = FALSE, auto_fix_first = TRUE, marker = NULL, auto_fix_single = TRUE, std_lv = FALSE, effect_coding = FALSE, fixed_x = TRUE, meanstructure = "default", model_type = c("sem", "growth"), ordered = NULL, parameterization = "delta", group = NULL, group_labels = NULL, group_equal = NULL, group_partial = NULL)
syntax |
A single model-syntax string. |
... |
Additional options forwarded to model construction or the underlying named operation. |
auto_var |
Automatically add variances for model variables. |
auto_cov_lv_x |
Automatically add covariances among exogenous latent variables. |
auto_cov_y |
Automatically add covariances among dependent variables. |
orthogonal |
Fix covariances among latent variables to zero. |
auto_fix_first |
Use a marker loading to identify each latent variable. |
marker |
Named character vector mapping latent names to marker indicators. With auto_fix_first, select the first matching loading or fall back to the first loading; preserve row order and apply user modifiers normally. |
auto_fix_single |
Fix the residual variance of a single indicator to zero. |
std_lv |
Identify latent scales by unit latent variances. |
effect_coding |
Effect-code loadings or intercepts when supported. |
fixed_x |
Treat observed exogenous variables as fixed. |
meanstructure |
Whether to include intercepts and means; model_spec also accepts the default convention. |
model_type |
Model construction mode: sem or growth. |
ordered |
Names of ordinal observed variables. |
parameterization |
Ordinal model parameterization; currently delta. |
group |
Grouping-variable name or group identifiers, as appropriate for the data. |
group_labels |
Explicit group labels in block order. |
group_equal |
Parameter classes constrained equal across groups. |
group_partial |
Named exceptions to the group equality constraints. |
A model specification containing the projected parameter table and construction metadata.
Computes explicit release or restriction diagnostics. LR-type variants use the supplied observations for robust spectral inference. Unsupported candidate regimes are reported explicitly.
modification_indices(fit, data = NULL, ..., candidates = "all")modification_indices(fit, data = NULL, ..., candidates = "all")
fit |
A fitted magmaan model. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
... |
Additional options forwarded to model construction or the underlying named operation. |
candidates |
Candidate parameter rows to release or test: all or the named subset supported by the operation. |
A table of candidate parameter diagnostics.
Computes explicit release or restriction diagnostics. LR-type variants use the supplied observations for robust spectral inference. Unsupported candidate regimes are reported explicitly.
modification_indices_lrt(fit, data, candidates = c("all", "loadings", "covariances"), robust = TRUE, weight = NULL)modification_indices_lrt(fit, data, candidates = c("all", "loadings", "covariances"), robust = TRUE, weight = NULL)
fit |
A fitted magmaan model. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
candidates |
Candidate parameter rows to release or test: all or the named subset supported by the operation. |
robust |
Whether to compute robust LR-type diagnostics. |
weight |
Weight selector or explicit fitting weight as required by the route. |
A table of candidate parameter diagnostics.
Compute one-parameter modification indices or one-at-a-time equality-release tests, with a direction-specific sandwich correction.
modification_indices_robust(fit, data = NULL, weight = NULL, bread = "observed", moments = "auto", cov = "empirical", candidates = "all", include_loadings = TRUE, include_covariances = TRUE, information = "expected", estimated_weight = NULL, gamma = NULL) score_tests_robust(fit, data = NULL, weight = NULL, bread = "observed", moments = "auto", cov = "empirical", estimated_weight = TRUE, gamma = NULL)modification_indices_robust(fit, data = NULL, weight = NULL, bread = "observed", moments = "auto", cov = "empirical", candidates = "all", include_loadings = TRUE, include_covariances = TRUE, information = "expected", estimated_weight = NULL, gamma = NULL) score_tests_robust(fit, data = NULL, weight = NULL, bread = "observed", moments = "auto", cov = "empirical", estimated_weight = TRUE, gamma = NULL)
fit |
A fitted magmaanlab model. |
data |
Fitting observations as a data frame, matrix, or grouped raw-data
blocks. FIML uses retained observations when this is omitted; an explicit
FIML raw-data object may also carry a missingness mask. Two-stage (ML2S) fits
use their retained Stage-1 data and reject |
weight |
Fitting weight for continuous WLS-computed fits. Fits record
their weight in |
bread, information
|
Sandwich sensitivity and score-information choices.
For ML/FIML, bread selects nuisance sensitivity; the metric and EPCs use
expected information, with either information selector accepted. FIML requires
|
moments, cov
|
Continuous moment and covariance conventions.
|
candidates |
|
include_loadings, include_covariances
|
Whether to enumerate absent loading and covariance candidates. |
gamma |
Optional symmetric positive semidefinite caller NACOV: a matrix
for one group or a list of matrices in fitted group order. Continuous moments
are means first when fitted, then lower-triangle covariances by columns,
including the diagonal, in the model's observed-variable order. All-ordinal
moments are thresholds then lower-triangle polychorics by columns, excluding
the diagonal. Mixed moments are thresholds, negative continuous means,
continuous variances, then lower-triangle associations. Each block is the
unscaled per-group NACOV (N times the sampling covariance); ML's group n/N
weights are applied by the adapter. Dimensions, finite entries, symmetry and
PSD are validated (relative tolerance 1e-10 for symmetry and PSD).
Supplying this replaces the covariance meat and preserves the fitting weight.
It requires |
estimated_weight |
For modification indices, NULL selects FALSE for ML/FIML
and TRUE for estimators with a second-stage fitting weight. Include supported estimated-weight influence terms,
following the weight recipe the fit records (NT, ADF, DWLS, or DLS with its
mixing weight; ULS has none). Supplied weights have no recipe and ordinal NT
and DLS weights have no derived influence, so both fail with an
|
ML/FIML use expected information as the metric and bread, observed
nuisance sensitivity when bread="observed", and empirical score meat
(FIML uses observed-pattern scores). EPCs use the expected-information
projection. Negative observed release curvature does not prevent a robust
statistic. It needs no saturated-model
EM computation for these tests. Explicit data rebuild their missingness pack;
omitted data reuse the retained pack when available. Alternative FIML moment or
covariance recipes and supplied second-stage weights are rejected.
Continuous ULS/GLS/WLS support empirical covariance from fitting observations, or model-implied normal-theory covariance from structured or unstructured moments. WLS-computed fits (WLS, DWLS, DLS, supplied W) use the recorded fitting weight for either source; the correction reduces to the ordinary statistic only when that weight is the inverse of the chosen covariance. Browne-unbiased covariance is not implemented for continuous LS. Estimated-weight mode requires raw observations and empirical covariance; other covariance choices are rejected.
Two-stage (ML2S) fits report mi as the naive Stage-2 statistic on the
Stage-1 EM moments (attribute mi_type = "naive_stage2") and
mi.scaled with the Stage-1 moment covariance as meat. They use the
recorded Stage-2 weight, expected information and the default
bread, moments and cov; a DWLS, ADF or DLS Stage-2 weight
adds its data influence with estimated_weight = TRUE. The naive NT row
uses the structured information; lavaan's two-stage modindices() uses
the unstructured one and differs.
Identification-only releases are excluded. Ordinal and mixed-ordinal methods
use their retained categorical moment covariance and weight conventions; the
all-ordinal bread selects observed or expected nuisance sensitivity,
and mixed methods now honor the same selection. Complete mixed estimated-weight
MI/releases use exact empirical first-stage rows and mixed Gamma influence.
Expected mixed projection and caller-Gamma comparators retain NACOV.
All-ordinal moments and cov choices use the retained NACOV.
Generic modification_indices() and score_tests() compose empirical
robust inference. To request the historical unscaled comparator explicitly, use
cov = "model_implied", estimated_weight = FALSE, and the desired
bread/information. Continuous ULS/GLS/DWLS/WLS/DLS and all-ordinal
ULS/DWLS/WLS and complete mixed DWLS/WLS support observed-Hessian
nuisance sensitivity with estimated-weight
influence. Their quadratic metric stays expected and their reference law uses
the matching projected meat. Selecting expected bread or fixed weights requests
a comparator. At exact fit the observed and expected projections coincide and
the weight-influence correction vanishes. Observed-sensitivity ML2S score laws
remain unavailable.
Tables carry reason and detail; identified numerical
failures retain their candidate rows with NA values. A data frame with candidate names and groups, unscaled quadratic mi, EPCs,
mi.scaled, scaling.factor, and the robust pvalue.
Reads numeric individual or summary ASCII data using the C++ data plan. Relative paths are tried in the working directory, then beside the input file. Free format accepts blanks, tabs and commas, wrapped observations, and discards extra fields at the end of a completed observation's record. Fixed FORMAT supports Fw.d, Fw or w.d, X skips, Tn positions, record breaks and repeated groups. Implied decimals apply only without an explicit point. Missing flags compare after that scaling. A terminal DOS Ctrl-Z, optionally followed only by whitespace, denotes EOF. Embedded EOF markers and other control bytes are rejected; remove the marker or the trailing records.
mplus_data(model, file = NULL)mplus_data(model, file = NULL)
model |
A |
file |
Optional path override, one path per separate-file group. |
Separate-file groups use a reserved .mplus_group column containing FILE
labels in declaration order. NGROUPS summary groups are named g1, g2, ... .
GROUPING drops unlisted codes and reports counts. NOBSERVATIONS limits
individual observations per file. LISTWISE and analysis-sample deletion
rules are only reported: use fit_model(..., missing = "listwise") to
remove incomplete rows or missing = "fiml" for FIML; explicitly filter
missing covariates to reproduce Mplus's conditional analysis sample.
Summary matrices use divisor N-1 on input. As in Mplus ML and lavaan's default sample.cov.rescale, they are multiplied by (N-1)/N for fit_model(). Correlations are multiplied by supplied SDs; without SDs the input has unit variances. The report retains input covariances and conversion factors.
Accepted summary TYPE values are COVARIANCE, CORRELATION, FULLCOV and
FULLCORR, optionally with MEANS (and STDEVIATIONS for correlations).
Supply NOBSERVATIONS for every summary group; summary input uses free
format. MISSING accepts one global ., * or fixed-format BLANK symbol,
or numeric flags per NAMES list/ALL. Fixed blanks without BLANK missing
read as zero. Empty comma fields are errors; numeric records are bounded
to 10000 characters. File and matrix shape errors identify the data rule.
Perform DEFINE/qualified DATA transformations and USEOBSERVATIONS or
SUBPOPULATION selection in R before reading/fitting. Multiple imputation,
Monte Carlo datasets and two-level weight matrices are outside this reader;
supply one supported individual or summary dataset per declared group.
Individual data as a data.frame, or summary moments as a list with
S, mean and nobs accepted by fit_model(). Attribute mplus_data_report
records paths, counts, dropped codes and unapplied sample rules.
Imports single- and multiple-group linear SEM: BY, ON, WITH, PON, PWITH, means, variances, starts, fixes, labels and equality numbers, NOCOVARIANCES, and NOMEANSTRUCTURE with INFORMATION = EXPECTED. Names resolve without regard to case and retain the spelling in NAMES; factors retain their first BY spelling. Estimator and execution settings are reported, not imported.
mplus_model(input = NULL, file = NULL)mplus_model(input = NULL, file = NULL)
input |
One string containing the whole input text. |
file |
Path to an input file. Supply exactly one of input or file. |
CATEGORICAL lists binary and ordinal outcomes (two through ten categories).
Thresholds use [u$k], DELTA scales use {u}, and THETA residuals
use variance statements. Categories and thresholds are completed from data;
all groups must contain the same categories. All-ordinal models fit with
estimator = "DWLS"; mixed, conditional and ML categorical routes report
their unsupported route explicitly. Retained-estimate lavaan WLSMV
reporting is available through convention_inference().
Fixed-time polynomial and piecewise growth (i s | y1@0 y2@1 ...) imports
outcome intercept, growth mean, threshold and scale/residual defaults.
Growth accepts one through four factors; free time scores are accepted
when enough scores remain fixed to identify the polynomial loadings.
MODEL CONSTRAINT imports NEW (starts default to 0.5), explicit and implicit
equalities, derived quantities, and nested DO loops. Functions include EXP,
LOG, SQRT, PHI and LOG10; ** denotes power. Continuous ML, LS and FIML
use the existing equality backends. All-ordinal nonlinear equalities use
constrained LS fitting and expected-information lavaan reporting. Native
policy and observed/IJ inference require unimplemented Lagrangian curvature.
Inequalities are deliberately refused: active-bound inference
requires boundary asymptotics; for variance positivity drop the constraint
and use covariance = "psd" or "barrier" in fit_model().
MODEL INDIRECT imports total IND, specific IND and VIA products, including
paths through factors. Derived names are ind_g<group>_<outcome>_ind_<names>
or ind_g<group>_<outcome>_via_<mediator>_<predictor>; specific names retain
the written mediator order. Defined estimates and delta-method SEs are
available through compute_defined(). A free NEW coordinate appears as a
new partable row, with no observed variable or moment cell; rebuilding
always uses the original Mplus source. INFORMATION defaults, MODEL TEST,
LOOP and PLOT are reported in notes.
NAMES accepts bounded numeric- or letter-suffix ranges; MODEL and USEVARIABLES ranges follow schema order. Latent ranges follow factor-definition order. Labels apply on their physical line; subsequent mentions override earlier parameter specifications. PON and PWITH require equally sized lists. Model/option content must fit within 90 columns; wrap longer statements. TITLE and comments may be longer. Line and block comments are accepted, but a block opened after code must close on its opening line. TITLE, OUTPUT, SAVEDATA and PLOT are reported.
DEFINE and DATA transformations must be performed in R; USEOBSERVATIONS and
SUBPOPULATION must be applied as case selection in R before fitting.
Counts, nominal/censored/survival outcomes, survey weights, mixtures,
multilevel models, Bayes and full-information categorical links are outside
the linear SEM family: retain those analyses in Mplus. ESEM rotation is
replaced only by explicitly specified ordinary BY factors. Bare @ uses
data-dependent Mplus starts; write an explicit @value instead. Remove
all observed-independent means/variances/WITH mentions to preserve
fixed-x conditioning, or bring every observed independent variable into the
joint random-X model (e.g. x1 x2;). Complete mentions free X means,
variances and default covariances; partial mentions are rejected with the
exact variance statement that completes the joint model. Recode data-dependent GROUPING forms to explicit
integer code/label pairs in R. Categorical summary inputs require individual
observations for magmaan's moment preparation.
DEFINE, mixtures, multilevel models, ESEM, unsupported name ranges
and mixed conditioning on observed covariates are rejected with rule IDs
and an explanation of what to write instead. Data descriptions are parsed into
$mplus_data_plan; mplus_data() reads them. This constructor does not
read the data file or run Mplus.
GROUPING imports explicit integer code = label pairs, ordered by numeric code.
Group MODEL sections override the overall model; repeated sections apply
cumulatively. CONFIGURAL, METRIC and SCALAR accept one setting at a time.
Categorical shortcuts accept CONFIGURAL and SCALAR; METRIC is rejected
for binary and ordinal outcomes, following Mplus 9.1.
Group-only changes to variable roles are rejected; put the relation in the
overall model and fix it in the other groups instead. Variance identification
in a shortcut uses free first loadings and explicit factor variances at one.
mplus_data() drops unlisted GROUPING codes with counts. Separate FILE
groups retain source labels, use .mplus_group, and follow FILE order.
Summary NGROUPS labels are g1, g2, ... . Summary data without MEANS
have no mean structure and reject explicit means/intercepts.
A magmaan_model_spec with original mplus_source, a data.frame of mplus_notes (class, rule, line, col, message), and a lavaan syntax projection. Grouped specs also carry group_var, ordered integer-code group_labels and mplus_groups (a data.frame with label and code columns). Rebuilding uses mplus_source; construction options cannot be overridden.
Constructs and fits the requested ordinal invariance sequence using the Mplus-style WLSMV conventions.
mplus_wlsmv_invariance(model, data, ordered, group, steps = c("configural", "metric", "scalar"), estimator = c("WLSMV", "DWLS", "WLS"), missing = c("listwise", "pairwise", "error"), group_labels = NULL, optimizer = "nlopt-lbfgs", control = NULL, bounds = NULL, pd_gamma = c("overlap", "nominal"), validate = TRUE)mplus_wlsmv_invariance(model, data, ordered, group, steps = c("configural", "metric", "scalar"), estimator = c("WLSMV", "DWLS", "WLS"), missing = c("listwise", "pairwise", "error"), group_labels = NULL, optimizer = "nlopt-lbfgs", control = NULL, bounds = NULL, pd_gamma = c("overlap", "nominal"), validate = TRUE)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
ordered |
Names of ordinal observed variables. |
group |
Grouping-variable name or group identifiers, as appropriate for the data. |
steps |
Invariance steps to construct: configural, metric or scalar. |
estimator |
Estimation objective. Supported objectives depend on the data kind and fitting route. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
group_labels |
Explicit group labels in block order. |
optimizer |
Native optimizer name; NULL uses the route default. |
control |
Named optimizer control list, including iteration limits, tolerances and optional starts. |
bounds |
Lower and upper parameter-bound vectors or a named bounds preset; NULL leaves the route default. |
pd_gamma |
Pairwise fourth-moment covariance convention: overlap or nominal. |
validate |
Validate the constructed invariance models. |
An invariance result with the constructed models, fits and comparisons.
Computes the same nuisance-orthogonalized observed score and robust
restriction spectrum used by score_flip_test(), but skips every random
sign draw and the flip-specific covariance calculations. The recommended
p_value is the pEBA4 mixture approximation. Scalar SB, exact-mixture, and
direct sandwich comparators remain available for diagnostics.
nested_score_test( fit_H1, fit_H0, data = NULL, sensitivity = c("observed", "expected") )nested_score_test( fit_H1, fit_H0, data = NULL, sensitivity = c("observed", "expected") )
fit_H1 |
Less-restricted complete-data ML or direct-FIML fit, or a
|
fit_H0 |
More-restricted nested fit with paths dropped, fixed or constrained, using the same estimator and observations. Interior moment reparameterizations are evaluated at a common null point. |
data |
Raw fitting data for complete-data ML. Direct FIML uses the observed-data sample stored on both fits, so this argument must be omitted. |
sensitivity |
Nuisance sensitivity (bread). |
A list of class magmaan_nested_score_test containing the effective
score statistic, restriction eigenvalues, pEBA4/SB/exact-mixture/sandwich
p-values, conditioning diagnostics, and setup/asymptotic timings.
Minimum-distance projection of the configural (per-group) fit onto the linear
equality constraints A theta = b carried by the partable's group.equal
family (metric / tau-equivalence / strict invariance, fixed values, ...). The
Omega-metric projection is closed-form:
theta_tilde = theta_hat - Omega A'(A Omega A')^-1 (A theta_hat - b),
and the constraint statistic W is an exact chi-square on k (Wald =
minimum-distance duality). Returns the projected estimate (theta_tilde), its
rank-deficient covariance (vcov_constrained, se_constrained), and the
constraint test (W, k, p_wald).
noniterative_cfa_constrained( fit, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )noniterative_cfa_constrained( fit, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )
fit |
A fit from |
discrepancy |
Accepted for compatibility; ignored because this wrapper only needs the delta-method covariance. |
gamma |
Fourth-moment matrix: |
data |
Raw data matrix (rows = observations), required when
|
estimator |
Non-iterative estimator; see |
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
T_d = T(H0) - T(H1) with a weighted-chi-square reference (H1-anchored).
Secondary to the Wald test: T_d can be negative for a non-minimizing
estimator (flagged in warnings).
noniterative_cfa_difference_test( fit0, fit1, df_d, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data0 = NULL, data1 = NULL, estimator = NULL )noniterative_cfa_difference_test( fit0, fit1, df_d, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data0 = NULL, data1 = NULL, estimator = NULL )
fit0 |
The more-restricted (H0) fit. |
fit1 |
The less-restricted (H1) fit. |
df_d |
Degrees of freedom of the restriction (q_H1 - q_H0). |
discrepancy |
|
gamma |
Fourth-moment matrix: |
data0, data1
|
Raw data for each fit when |
estimator |
Non-iterative estimator; see |
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
Fits every group's Guttman block independently and stacks them: a
block-diagonal delta-method covariance (vcov, se), a joint goodness-of-fit
T on df degrees of freedom with the union weighted-chi-square reference,
and block_of_param (0-based group index per free parameter). Reduces to
noniterative_cfa_inference() for a single group with no mean structure.
Required for mean-structure models (the single-group path omits the intercept
block).
noniterative_cfa_grouped_inference( fit, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )noniterative_cfa_grouped_inference( fit, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )
fit |
A fit from |
discrepancy |
|
gamma |
Fourth-moment matrix: |
data |
Raw data matrix (rows = observations), required when
|
estimator |
Non-iterative estimator; see |
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
Returns delta-method standard errors (se, vcov), the goodness-of-fit
statistic T on df degrees of freedom, its weighted-chi-square p-value
family (p_scaled Satorra-Bentler, p_meanvar, p_scaled_shifted,
p_mixture), the reference eigenvalues, and the Satorra-Bentler scale_c.
For discrepancy = "ntml", rls_check is the reweighted-least-squares
cross-check of T.
noniterative_cfa_inference( fit, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )noniterative_cfa_inference( fit, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )
fit |
A fit from |
discrepancy |
|
gamma |
Fourth-moment matrix: |
data |
Raw data matrix (rows = observations), required when
|
estimator |
Non-iterative estimator; see |
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
Closed-form Guttman fits are not stationary minimizers of the ML/ULS discrepancy, so the usual score-test modification index is not defined. This helper reports residual-space analogues for fixed-zero and absent one-parameter candidates: raw residual scores, tangent-residualized residual scores, and local one-step discrepancy-drop/EPC diagnostics.
noniterative_cfa_modification_indices( fit, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL, candidates = c("all", "fixed"), include_loadings = TRUE, include_covariances = TRUE )noniterative_cfa_modification_indices( fit, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL, candidates = c("all", "fixed"), include_loadings = TRUE, include_covariances = TRUE )
fit |
A fit from |
discrepancy |
|
gamma |
Fourth-moment matrix: |
data |
Raw data matrix (rows = observations), required when
|
estimator |
Non-iterative estimator; see |
candidates |
|
include_loadings, include_covariances
|
Scope absent-row enumeration when
|
A data frame with candidate columns and .raw, .resid, and drop
diagnostics.
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
fit_H1 is the less restricted model and fit_H0 is the more restricted
estimator-side fit, typically from fit_noniterative_cfa_restricted(). The
statistic is T_diff = T(H0) - T(H1) with an H1-anchored weighted-chi-square
reference. This is an LRT-shaped discrepancy comparison; unlike ML, it can be
negative for a non-minimizing estimator.
noniterative_cfa_pseudo_lrt( fit_H1, fit_H0, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )noniterative_cfa_pseudo_lrt( fit_H1, fit_H0, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )
fit_H1 |
Less restricted non-iterative fit. |
fit_H0 |
More restricted non-iterative fit. |
discrepancy |
|
gamma |
Fourth-moment matrix: |
data |
Raw data matrix (rows = observations), required when
|
estimator |
Non-iterative estimator; see |
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
Frees the latent means. Reads the common metric off the reference group and
solves the latent means by least squares through the reference loadings:
alpha_g = (Lr'Lr)^-1 Lr'(m_g - m_r), nu = m_r. Scalar invariance is tested
on the mean residual d_g = (I - P_Lr)(m_g - m_r) with a linearized
pseudo-inverse Wald W on df = (G-1)(p - #factors) degrees of freedom. The
fit must carry mean structure (fit a configural meanstructure model first) and
at least two groups.
noniterative_cfa_scalar_invariance( fit, ref_group = 1, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )noniterative_cfa_scalar_invariance( fit, ref_group = 1, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )
fit |
A fit from |
ref_group |
Reference group (1-based; latent means are 0 there). |
discrepancy |
Accepted for compatibility; ignored because this wrapper only needs the delta-method covariance. |
gamma |
Fourth-moment matrix: |
data |
Raw data matrix (rows = observations), required when
|
estimator |
Non-iterative estimator; see |
Returns the latent means alpha (a list, one per non-reference group) with
delta-method alpha_se / alpha_cov, the common intercept nu, the stacked
residual d, and the test (W, df, rank, p_value).
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
Returns only se and vcov, skipping residual goodness-of-fit spectra.
noniterative_cfa_se( fit, gamma = c("nt", "empirical"), data = NULL, estimator = NULL )noniterative_cfa_se( fit, gamma = c("nt", "empirical"), data = NULL, estimator = NULL )
fit |
A fit from |
gamma |
Fourth-moment matrix: |
data |
Raw data matrix (rows = observations), required when
|
estimator |
Non-iterative estimator; see |
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
Exact chi-square on nrow(R) degrees of freedom, using the delta-method
covariance. The primary nested test for these estimators.
noniterative_cfa_wald( fit, R, q, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )noniterative_cfa_wald( fit, R, q, discrepancy = c("uls", "ntml"), gamma = c("nt", "empirical"), data = NULL, estimator = NULL )
fit |
A fit from |
R |
Restriction matrix ( |
q |
Right-hand side (length |
discrepancy |
Accepted for compatibility; ignored because this wrapper only needs the delta-method covariance. |
gamma |
Fourth-moment matrix: |
data |
Raw data matrix (rows = observations), required when
|
estimator |
Non-iterative estimator; see |
Noniterative development is postponed. The NT default is a normal-theory comparator and does not provide structural-misspecification robustness.
Estimator-agnostic: works for any magmaan fit given a vcov on the free
parameters. Rows are the free-parameter block of the fitted partable, in theta
order (by the free index), so est, se, z, and pvalue are aligned.
parameter_table(fit, vcov, level = 0.95)parameter_table(fit, vcov, level = 0.95)
fit |
A fitted magmaan model. |
vcov |
Free-parameter covariance ( |
level |
Confidence level for the Wald CI columns. |
A data frame with lhs, op, rhs, group, est, se, z,
pvalue, ci.lower, ci.upper.
Computes indices on request, including an independence baseline under the same estimator and data treatment. ML and FIML use the raw-likelihood Takeuchi trace difference; ordinal and mixed DWLS use exact first-stage influence with the estimated-weight channel. Continuous ULS uses its profile trace plus covariance moment bias; ML2S-NT uses Stage-1 Gamma. No intervals are returned. RMSEA includes the multigroup factor sqrt(G). TLI uses nominal degrees of freedom and truncated corrected discrepancies; the lab misspecification family's generalized-df TLI remains a separate comparator. Residual indices pool squared residuals across groups and subtract their influence trace. DWLS indices measure misfit in the DWLS metric; ML cutoffs do not transfer.
policy_fit_measures(fit)policy_fit_measures(fit)
fit |
A fitted magmaanlab model retaining raw data or categorical stats. |
A data frame with index, estimate and reason, and a details attribute carrying discrepancies, traces, corrected discrepancies and degrees of freedom. Unsupported components have NA estimates and explicit reasons.
Requests the C++ ordinary-user inference policy for the fitted estimator and data regime. Unsupported regimes remain explicit.
policy_inference(fit, data = NULL)policy_inference(fit, data = NULL)
fit |
A fitted magmaan model. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
ML/FIML use observed-bread empirical-score sandwich covariance and score and likelihood-ratio tests with PEBA4 as the default reference. All-ordinal and complete mixed DWLS use exact empirical first-stage sampling influence and estimated-weight IJ covariance. Global fit-function tests and observed-Hessian/IJ nested fit-function differences use the exact weighted chi-square All reference; SB/PEBA4 comparators remain available. Fitting retains OPG NACOV weights. Reference-law studies support the DWLS default across ordinal, mixed, threshold-invariance and textbook designs; finite-sample size varies across settings. Nested DWLS score tests are unavailable.
An inference bundle with availability status, covariance and test summaries where supported.
Frees one candidate (or releases one equality) and refits from the fitted estimate embedded in the augmented model, replaying the fit's options. The template is an evaluation point for the native embedding map; it is never optimized.
policy_mi_refit(fit, row, candidate_row)policy_mi_refit(fit, row, candidate_row)
fit |
The fitted (restricted) magmaanlab model. |
row |
One row of |
candidate_row |
The matching element of that output's |
The fitted augmented model, for policy_nested.
Thin adapter to the C++ ordinary-policy modification-index composer.
policy_modification_indices(fit, data = NULL, releases = TRUE)policy_modification_indices(fit, data = NULL, releases = TRUE)
fit |
An estimate-only magmaanlab fit. |
data |
Optional raw observations, otherwise the retained fitting data. |
releases |
Include univariate equality-release score tests. |
ML/FIML use observed nuisance sensitivity with expected metric/EPCs and empirical likelihood-score meat (pattern scores for FIML), and all-ordinal/mixed DWLS use exact first-stage sampling rows and estimated-weight influence with observed sensitivity. Each available robust score statistic has a chi-square(1) limiting reference. Singular nuisance sensitivity or nonpositive score variance retains numeric_failure rows. Fits outside the policy return typed unavailable rows. No alternative inference convention is substituted.
A data frame with kind, lhs, op, rhs, group, test, statistic, df, pvalue, epc, sepc.lv, sepc.all and reason. Internal candidate-row metadata supports native one-restriction augmentation and embedded-start refits.
Requests the C++ ordinary-user nested policy for a restricted and unrestricted fit.
policy_nested(fit_H1, fit_H0, data = NULL)policy_nested(fit_H1, fit_H0, data = NULL)
fit_H1 |
Unrestricted (alternative) fitted model. |
fit_H0 |
Restricted (null) fitted model. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
ML/FIML use observed-bread empirical-score sandwich covariance and score and likelihood-ratio tests with PEBA4 as the default reference. All-ordinal and complete mixed DWLS use exact empirical first-stage sampling influence and estimated-weight IJ covariance. Global fit-function tests and observed-Hessian/IJ nested fit-function differences use the exact weighted chi-square All reference; SB/PEBA4 comparators remain available. Fitting retains OPG NACOV weights. Reference-law studies support the DWLS default across ordinal, mixed, threshold-invariance and textbook designs; finite-sample size varies across settings. Nested DWLS score tests are unavailable.
A nested inference bundle with availability status and supported test summaries.
Own sample contributions and fitted NTML geometry across score, likelihood-ratio, goodness-of-fit and covariance calculations. These are methods-development interfaces for interior, random-X complete-data ML fits with affine equality constraints.
prepare_inference_data(fit, data = NULL, storage = c("auto", "casewise", "tiled")) prepare_hypothesis(null, alternative) inference_quadratic(object, test = c("score", "lr"), geometry = NULL) inference_covariance(context, robust = TRUE) inference_reuse(context)prepare_inference_data(fit, data = NULL, storage = c("auto", "casewise", "tiled")) prepare_hypothesis(null, alternative) inference_quadratic(object, test = c("score", "lr"), geometry = NULL) inference_covariance(context, robust = TRUE) inference_reuse(context)
geometry |
Observed information for nested hypotheses by default; expected information for global goodness-of-fit under the correct-model null. Either may be chosen explicitly. |
fit |
A continuous ML fit defining the observed-variable/group layout. |
data |
Fitting observations or a prepared dataset. Defaults to retained fitting data. |
storage |
Cache centered casewise moment rows, use tiled projection, or select casewise storage when the contribution matrix occupies at most 64 MiB. |
null, alternative
|
Inference snapshots created with
|
object |
An inference snapshot (global test), or prepared hypothesis (nested test). |
test |
Expected-information score or ML likelihood-ratio quadratic. |
context |
A prepared inference snapshot. |
robust |
Use the observed-information empirical sandwich covariance (the default), or explicitly request inverse expected information with |
The core reuses the existing NTML U-factor construction and casewise covariance reducers. It retains structured expected-information geometry and each test's reduction separately. Global LR uses the centered empirical GOF spectrum; global score uses likelihood contributions at the fitted null point. Restricted means require additional linear and constant terms, so these spectra are not silently equated. Nested LR uses the exact H1-anchored Satorra–2000 reduction; nested score evaluates at H0.
No empirical Gamma or full U matrix is required. Casewise storage reuses one contribution matrix across fits. Tiled storage reduces global score and GOF together when the sample size is at least df, retaining reduced matrices; otherwise the smaller row-space spectrum is used. Tiled storage trades repeated raw-data passes for bounded contribution memory when different hypotheses need different projections. Explicit Browne-unbiased GOF requests use the existing casewise correction and may materialize contributions.
score_spectrum and calibrate_quadratic accept these quadratics.
Spectrum calculations are lazy and retained; SB alone uses the trace.
inference_covariance returns a snapshot-tagged matrix usable with
wald_test. Existing GOF, expected-information, expected sandwich-SE and
exact empirical streaming nested-LR wrappers also reuse compatible prepared
snapshots. Other bread/Gamma/nesting conventions retain their existing paths.
Shared NTML geometry does not yet cover FIML, ML2S, ordinal or fixed-X fits. Their existing score interfaces remain available. Native handles are local to the current R process: prepare again after serialization. Locked R environments preserve ownership; edited extracted fit lists invalidate the native caches.
Prepared data/hypothesis and quadratic calls return locked environments owning native objects. Covariance returns a matrix; reuse returns construction counts, including data contributions, fit geometry, U, information and global spectra. Counts are diagnostics, not a timing guarantee.
## Not run: d <- prepare_inference_data(fit1, data) g0 <- prepare_inference(fit0, d) g1 <- prepare_inference(fit1, d) h <- prepare_hypothesis(g0, g1) qs <- inference_quadratic(h, "score") ql <- inference_quadratic(h, "lr") calibrate_quadratic(qs, c("sb", "peba4")) calibrate_quadratic(ql, c("sb", "peba4")) V <- inference_covariance(g0, robust = TRUE) inference_reuse(g0) ## End(Not run)## Not run: d <- prepare_inference_data(fit1, data) g0 <- prepare_inference(fit0, d) g1 <- prepare_inference(fit1, d) h <- prepare_hypothesis(g0, g1) qs <- inference_quadratic(h, "score") ql <- inference_quadratic(h, "lr") calibrate_quadratic(qs, c("sb", "peba4")) calibrate_quadratic(ql, c("sb", "peba4")) V <- inference_covariance(g0, robust = TRUE) inference_reuse(g0) ## End(Not run)
Separate structural model preparation, dataset preparation, estimation weights and estimation. Inference is requested separately.
prepare_model(model, ..., prototype = NULL) augment_model_spec(model, categories) prepare_data(model, data, kind = NULL, missing = c("error", "listwise")) prepare_weight(data, method = c("DWLS", "WLS", "ULS", "GLS", "DLS"), W = NULL, full = TRUE, dls_a = 0.5) estimate(model, data, estimator = NULL, weight = NULL, optimizer = NULL, control = NULL, bounds = NULL, covariance = NULL, psd = FALSE, barrier = NULL, dls_a = 0.5, options = NULL)prepare_model(model, ..., prototype = NULL) augment_model_spec(model, categories) prepare_data(model, data, kind = NULL, missing = c("error", "listwise")) prepare_weight(data, method = c("DWLS", "WLS", "ULS", "GLS", "DLS"), W = NULL, full = TRUE, dls_a = 0.5) estimate(model, data, estimator = NULL, weight = NULL, optimizer = NULL, control = NULL, bounds = NULL, covariance = NULL, psd = FALSE, barrier = NULL, dls_a = 0.5, options = NULL)
model |
Model syntax or a model specification for |
... |
Options passed to |
prototype |
Data frame or named matrix supplying categorical levels and order. No empirical moments or starts are retained from it. |
categories |
For |
data |
A data frame, named matrix or sample-moment list for
|
kind |
|
missing |
Reject missing observations or delete incomplete rows for moment data. Raw FIML data retain missingness. |
method |
Fixed weight: ULS, GLS/NT, DWLS, WLS/ADF or DLS for complete continuous and all-ordinal data. Lower-case weight names are also accepted. Mixed data retain DWLS/WLS. |
W |
Optional weight matrix or per-group list in model moment order. Otherwise empirical weights are constructed from raw observations. |
full |
For categorical data, retain full Gamma for post-fit inference. FALSE requests only the DWLS diagonal (or no Gamma for ULS) when W is omitted. GLS, DLS, WLS and supplied ordinal weights retain full Gamma. DWLS does not invert full Gamma. |
estimator |
Continuous or all-ordinal ML, ULS, GLS, DWLS, WLS or DLS; FIML for raw data; DWLS or WLS for mixed data. Default follows the weight, or otherwise the data kind. |
weight |
Optional prepared weight from this dataset, or a shared weight
name: |
dls_a |
Fixed DLS mixing scalar in [0, 1]. Zero selects NT and one ADF. When a prepared weight is supplied its stored scalar governs. |
optimizer, control
|
Existing native optimizer name and control list.
A keyed data-frame |
options |
Versioned fitting choices (preset, starts, optimizer and
convergence) for unrestricted continuous ML or FIML, as in |
bounds |
Explicit lower/upper bound list in free-parameter order. Not supported by the prepared FIML path. |
covariance |
Model covariance policy: |
psd |
Compatible spelling for |
barrier |
Options for barrier fitting: a list with |
Rebuild handles after serialization and in each worker. A new dataset requires new data and weight preparation, but reuses the model. Category levels, group order, observable order and mean-structure convention must remain compatible. Group labels must be declared explicitly. Covariances supplied as sample moments use divisor N.
The covariance policy changes final model fitting without repairing supplied
moments. A barrier minimizes f - weight / N * P, with fmin
retaining the unpenalized discrepancy and penalty$penalized_fmin
recording the fitted objective. Positive-weight barriers replace additional
bounds. Their general sampling/inference contract is not yet validated.
Ordinal ML fits associations with Stage-1 thresholds held fixed; it does not
provide Gaussian likelihood or generic post-fit sampling inference.
Continuous diagonal weight blocks use owning numeric vectors of entries of W, not square roots; full blocks remain matrices. Supplied W accepts either form, or a list of blocks. Prepared native handles are process-local: serialize W and prepare a new handle after loading it.
FIML retains its missingness pack but does not compute saturated H1 during
estimation unless versioned fitting options require it. Categorical inference
needs full Gamma; obtain it separately with
prepare_weight(data, "DWLS", full = TRUE)$stats and pass it to an
existing explicit inference function, without refitting.
Versioned fitting options use the same configured engines as fit_model()
for continuous ML/FIML and ordinal/complete mixed DWLS with unrestricted covariance,
including options = list(preset = "lavaan-0.7.2").
The interface covers the estimators listed above.
ML2S raises a typed magmaan_unsupported_estimator error.
Two-level, FC-SEM, SAM and frontier methods continue using their existing
entry points, which remain supported without deprecation warnings. Categorical
weight preparation currently recomputes stage-one moments in the existing core
builder; fitting itself reuses the prepared objects.
augment_model_spec returns a model specification with threshold
and scale rows added once. Preparation returns immutable, process-local handles. A prepared model
exposes its specification; a weight exposes W for continuous data and
stats for categorical inference. Estimation returns the existing
magmaan_fit list with convergence and admissibility diagnostics.
Dataframe helpers, prepared data and fitted lab objects retain a read-only
deletion record. Its policy identifies listwise, error, FIML or
pairwise row handling; known indicates whether supplied-row counts are
available. per_group contains group, rows_supplied,
rows_used, rows_deleted, and exclusive reason counts
missing_model_values, missing_group_label,
unknown_group_label, and missing_cluster_id.
Reasons take precedence in that order: group labels, cluster IDs, model values.
Rows without an assignable group appear in a separate NA group row.
Single-level routes still refuse missing or unknown group labels; two-level
listwise preparation deletes missing group or cluster IDs. FIML and ML2S retain
incomplete rows without listwise deletion; existing native refusals remain.
Summary-only inputs without retained provenance report unknown supplied/deleted
counts, rather than claiming that no earlier deletion occurred.
Embeds the restricted estimate using the native, moment-verified nesting map, then replays the larger model's estimator and fitting options with that explicit start. Neither input is modified.
refit_from_null(fit_H1, fit_H0)refit_from_null(fit_H1, fit_H0)
fit_H1 |
The larger fitted model. |
fit_H0 |
The restricted fitted model, using the same data and estimator. |
Supports single-level ML, FIML and all-ordinal DWLS, ULS and WLS fits from fit_model() or estimate(). FIML requires retained observations; complete-data and ordinal routes reuse retained sufficient statistics. This explicit lab operation returns the new endpoint even when its verdict fails; callers must inspect convergence diagnostics. Fit warnings are emitted as for any explicit user-requested fit.
A new estimate-only magmaan_fit, with its own convergence diagnostics and native verdict.
Compares a restricted model fit_H0 against the less-restricted superset
fit_H1. method = "restriction_map" uses Satorra's streaming low-rank
reduction of the asymptotic weighted-chi-square distribution. The
"lavaan_sb2001" and "lavaan_sb2010" options mirror lavaan's
compatibility difference-test approximations.
robust_nested_lrt( fit_H1, fit_H0, data = NULL, gamma = c("empirical", "unbiased", "NT", "both"), method = c("restriction_map", "lavaan_sb2001", "lavaan_sb2010"), A.method = c("exact", "delta"), computation = c("streaming", "materialized", "dense"), convention = c("magmaan", "lavaan"), ud_method = c("2000", "2001"), h1_reference_regularization = NULL, weight = NULL ) nestedTest( fit_H1, fit_H0, data = NULL, gamma = c("empirical", "unbiased", "NT", "both"), method = c("satorra.2000", "satorra.bentler.2001", "satorra.bentler.2010", "restriction_map", "lavaan_sb2001", "lavaan_sb2010"), A.method = c("exact", "delta"), computation = c("streaming", "materialized", "dense"), convention = c("magmaan", "lavaan"), ud_method = c("2000", "2001"), h1_reference_regularization = NULL, weight = NULL )robust_nested_lrt( fit_H1, fit_H0, data = NULL, gamma = c("empirical", "unbiased", "NT", "both"), method = c("restriction_map", "lavaan_sb2001", "lavaan_sb2010"), A.method = c("exact", "delta"), computation = c("streaming", "materialized", "dense"), convention = c("magmaan", "lavaan"), ud_method = c("2000", "2001"), h1_reference_regularization = NULL, weight = NULL ) nestedTest( fit_H1, fit_H0, data = NULL, gamma = c("empirical", "unbiased", "NT", "both"), method = c("satorra.2000", "satorra.bentler.2001", "satorra.bentler.2010", "restriction_map", "lavaan_sb2001", "lavaan_sb2010"), A.method = c("exact", "delta"), computation = c("streaming", "materialized", "dense"), convention = c("magmaan", "lavaan"), ud_method = c("2000", "2001"), h1_reference_regularization = NULL, weight = NULL )
fit_H1 |
Less-restricted fitted magmaan model, ordinarily returned by
|
fit_H0 |
More-restricted fit, with paths dropped, fixed or constrained. Interior reparameterizations through moments are supported for ML/FIML. |
data |
Raw complete data for complete-data fits: either a data.frame
whose columns include the observed variables of |
gamma |
|
method |
Historical lavaan labels ( |
A.method |
|
computation |
|
convention |
|
ud_method |
Estimator of the U_D difference matrix whose |
h1_reference_regularization |
FIML restriction-map tests only. |
weight |
For ordinal nested tests, |
With convention = "magmaan" and method omitted, robust_nested_lrt() calls policy_nested() for complete-data ML and all-ordinal DWLS. Unsupported components raise a condition of class magmaan_unsupported_inference, with reason and detail fields. Explicit method choices and nestedTest() are Satorra/lavaan compatibility routes and retain their documented formulas.
A list of class magmaan_nested_test. With gamma = "both",
eigenvalues and the scalar test summaries use empirical Gamma, while
eigenvalues_unbiased contains the auxiliary unbiased spectrum.
Composes observed-bread covariance with the estimated-weight influence. The exact comparator changes sampling rows and their contribution to weight movement; fitting continues to use OPG NACOV weights.
robust_ordinal_ij(fit, ordinal_stats, weight = "", first_stage = "opg")robust_ordinal_ij(fit, ordinal_stats, weight = "", first_stage = "opg")
fit |
An all-ordinal fitted lab model. |
ordinal_stats |
The ordinal statistics used for fitting. |
weight |
Computational weight; empty reuses the fit's weight. |
first_stage |
|
A list containing vcov, se, df and chisq_standard. The exact comparator also returns per-group sampling_moment_influence matrices and sampling_gamma (the cross-product of the rows divided by group sample size).
Composes separate measurement and structural fitting using the selected mapping and covariance convention.
sam(model, data, method = c("local", "global"), mapping = c("ml", "gls", "uls"), se = c("twostep", "twostep.robust", "standard", "none"), lambda_correction = TRUE, alpha_correction = 0L, meanstructure = FALSE, mm_optimizer = "nlopt-lbfgs", struc_optimizer = mm_optimizer, mm_control = NULL, struc_control = NULL, raw_data = NULL, missing = c("listwise", "error"), ...)sam(model, data, method = c("local", "global"), mapping = c("ml", "gls", "uls"), se = c("twostep", "twostep.robust", "standard", "none"), lambda_correction = TRUE, alpha_correction = 0L, meanstructure = FALSE, mm_optimizer = "nlopt-lbfgs", struc_optimizer = mm_optimizer, mm_control = NULL, struc_control = NULL, raw_data = NULL, missing = c("listwise", "error"), ...)
model |
Model syntax or a model specification; prepared objects are accepted only by their corresponding interfaces. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
method |
Method selector; see the available choices in the usage signature and details. |
mapping |
SAM measurement-to-structural mapping: ml, gls or uls. |
se |
Standard-error convention. fit_model is estimate-only and accepts only "none"; SAM and est_change expose the choices shown in their signatures. |
lambda_correction |
Apply the SAM loading correction. |
alpha_correction |
SAM alpha-correction mode. |
meanstructure |
Whether to include intercepts and means; model_spec also accepts the default convention. |
mm_optimizer |
Optimizer for the SAM measurement model. |
struc_optimizer |
Optimizer for the SAM structural model. |
mm_control |
Control list for the SAM measurement fit. |
struc_control |
Control list for the SAM structural fit. |
raw_data |
Optional raw observations needed for robust SAM inference. |
missing |
Missing-data handling: listwise deletion, rejection, or pairwise moments where supported. FIML retains missing observations. |
... |
Additional options forwarded to model construction or the underlying named operation. |
A fitted SAM result with measurement and structural components.
The SE/type defaults standardize SAM or case-change diagnostics. They do not assert a generic misspecification-robust inference law; explicit robust or estimated-weight choices remain available within their supported scope.
Calibrates the restrictions separating fit_H0 from fit_H1 by random
mean-zero, unit-variance multipliers on individual likelihood-score
contributions. Rademacher signs are the default and support the basic,
nuisance-effective, and flip-specifically standardized references. Mammen,
tunable two-point, Gaussian, and centered-exponential weights are
experimental diagnostics for the nuisance-effective reference.
score_flip_test( fit_H1, fit_H0, data = NULL, n_flips = 999L, seed = 1, calibration = c("effective", "all", "effective-standardized", "asymptotic"), multiplier = c("rademacher", "mammen", "two-point", "gaussian", "centered-exponential"), two_point_skewness = 1, center_multiplier_scores = FALSE, multiplier_studentization = c("none", "weighted-meat"), sensitivity = c("observed", "expected") )score_flip_test( fit_H1, fit_H0, data = NULL, n_flips = 999L, seed = 1, calibration = c("effective", "all", "effective-standardized", "asymptotic"), multiplier = c("rademacher", "mammen", "two-point", "gaussian", "centered-exponential"), two_point_skewness = 1, center_multiplier_scores = FALSE, multiplier_studentization = c("none", "weighted-meat"), sensitivity = c("observed", "expected") )
fit_H1 |
Less-restricted complete-data ML or direct-FIML fit, or a
|
fit_H0 |
More-restricted nested fit with paths dropped, fixed or constrained, using the same estimator and observations. Interior moment reparameterizations are evaluated at a common null point. |
data |
Raw fitting data for complete-data ML. Direct FIML uses the observed-data sample stored on both fits, so this argument must be omitted. |
n_flips |
Number of random multiplier transformations. |
seed |
Non-negative deterministic integer seed. |
calibration |
Which randomization references to compute. |
multiplier |
Multiplier distribution. Non-Rademacher resampling
requires |
two_point_skewness |
Non-negative third moment for
|
center_multiplier_scores |
Whether to center effective-score contributions within information strata before applying multipliers. |
multiplier_studentization |
Optional |
sensitivity |
Nuisance sensitivity (bread). |
A list of class magmaan_score_flip_test. In addition to the three
p-values it includes the mean-scaled and exact-mixture score references,
the direct sandwich-studentized score statistic and p-value, flip-variance
displacement diagnostics, optional multiplier-studentized output, and
elapsed seconds for setup, resampling, flip standardization, and the
asymptotic comparators.
Computes explicit release or restriction diagnostics. LR-type variants use the supplied observations for robust spectral inference. Unsupported candidate regimes are reported explicitly.
score_tests(fit, data = NULL, ...)score_tests(fit, data = NULL, ...)
fit |
A fitted magmaan model. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
... |
Additional options forwarded to model construction or the underlying named operation. |
A table of candidate parameter diagnostics.
Computes explicit release or restriction diagnostics. LR-type variants use the supplied observations for robust spectral inference. Unsupported candidate regimes are reported explicitly.
score_tests_lrt(fit, data, candidates = c("loadings", "intercepts", "all"), method = c("restriction_map", "lavaan_sb2001", "lavaan_sb2010"), gamma = c("empirical", "NT"))score_tests_lrt(fit, data, candidates = c("loadings", "intercepts", "all"), method = c("restriction_map", "lavaan_sb2001", "lavaan_sb2010"), gamma = c("empirical", "NT"))
fit |
A fitted magmaan model. |
data |
Observed data frame, named matrix or sample-moment list compatible with the model. FIML requires raw observations. |
candidates |
Candidate parameter rows to release or test: all or the named subset supported by the operation. |
method |
Method selector; see the available choices in the usage signature and details. |
gamma |
Moment covariance convention used for the nested score diagnostic. |
A table of candidate parameter diagnostics.
Prepare an immutable native inference snapshot, obtain scores and geometry, and choose projection, calibration or resampling separately. These methods-developer interfaces support complete-data ML, direct FIML and the unregularized fixed-normal-theory ML2S global score construction.
prepare_inference(fit, data = NULL) scores(object, data = NULL, space = c("parameter", "saturated")) score_components(object, data = NULL, H1 = NULL, sensitivity = c("observed", "expected", "observed-h1", "observed-shrink-light", "observed-shrink-sqrt"), metric = c("expected", "observed", "observed-h1")) score_components_from_matrices(score, rows, sensitivity, metric = sensitivity, nuisance = matrix(0, length(score), 0L), directions = diag(length(score)), influence_rows = FALSE) project_scores(components, retain_rows = FALSE, center = FALSE) score_quadratic(score, metric, meat) score_spectrum(projected) score_sandwich(projected) resample_scores(projected, n_flips = 999L, seed = 1, multiplier = c("rademacher", "mammen", "two-point", "gaussian", "centered-exponential"), two_point_skewness = 1) quadratic_reference(statistic, df, eigenvalues = NULL) calibrate_quadratic(object, methods = "peba4") inference_information(context, type = c("observed", "expected")) parameter_covariance(context, information, meat = NULL) wald_test(object, R, vcov, q = NULL)prepare_inference(fit, data = NULL) scores(object, data = NULL, space = c("parameter", "saturated")) score_components(object, data = NULL, H1 = NULL, sensitivity = c("observed", "expected", "observed-h1", "observed-shrink-light", "observed-shrink-sqrt"), metric = c("expected", "observed", "observed-h1")) score_components_from_matrices(score, rows, sensitivity, metric = sensitivity, nuisance = matrix(0, length(score), 0L), directions = diag(length(score)), influence_rows = FALSE) project_scores(components, retain_rows = FALSE, center = FALSE) score_quadratic(score, metric, meat) score_spectrum(projected) score_sandwich(projected) resample_scores(projected, n_flips = 999L, seed = 1, multiplier = c("rademacher", "mammen", "two-point", "gaussian", "centered-exponential"), two_point_skewness = 1) quadratic_reference(statistic, df, eigenvalues = NULL) calibrate_quadratic(object, methods = "peba4") inference_information(context, type = c("observed", "expected")) parameter_covariance(context, information, meat = NULL) wald_test(object, R, vcov, q = NULL)
fit |
A fitted magmaan model. |
data |
Fitting raw data for complete ML, optionally a prepared dataset. FIML and ML2S use the raw observations stored on the fit. |
object, context
|
A fit or prepared inference snapshot for score construction; a projected score or quadratic reference for calibration; a fit, snapshot or estimate vector for Wald inference. |
space |
Parameter or saturated-moment likelihood coordinates. ML2S
influence contributions are available through |
H1 |
Optional unrestricted model specification or fit for affine nested ML/FIML scores. No unrestricted fit is required. Null selects global GOF. |
sensitivity, metric
|
Nuisance sensitivity and quadratic metric choices.
For supplied-matrix |
rows, nuisance, directions, influence_rows
|
Supplied casewise rows, nuisance and tested direction matrices, and whether the rows are influence contributions rather than likelihood scores. Likelihood rows must sum to the observed score. |
components, projected
|
Reusable objects produced by the preceding stage. |
retain_rows |
Retain projected rows for multiplier resampling. |
center |
Globally center covariance rows. Does not change the observed score. This is not within-pattern centering. |
score |
An observed score or contrast vector in total-likelihood units. |
meat |
Symmetric score covariance in total units. Required for score_quadratic. For parameter_covariance, NULL derives empirical meat from retained fitting data; explicit "model" requests inverse information. |
statistic, df, eigenvalues
|
A precomputed quadratic statistic, nominal positive integer degrees of freedom, and optional spectrum including zero weights. Negative entries within the projected-score roundoff tolerance are clipped to zero; materially negative entries raise a NumericIssue error. |
methods |
Case-insensitive names std, sb, ss, mv, scaled_f, all, pall, peba<k>, eba<k>, with integer k >= 1 (up to the C++ integer limit). Output names are lower case. Calibration calls the C++ FMG routine. EBA/pEBA use blocks of size ceiling(df / k) in the retained spectrum, including zero weights. When k >= df, EBA equals All and pEBA equals pAll. |
n_flips, seed, multiplier, two_point_skewness
|
Explicit multiplier simulation settings. Reuses the projected metric factorization and retained rows. |
type |
Expected Fisher or realized observed information. |
information |
Previously computed total parameter information. |
R, q, vcov
|
Wald restriction matrix, target vector (zero by default), and previously computed parameter covariance. |
The preparation snapshot owns its native model/data/parameter state. It is process-local; reprepare after serialization or changes to the model or sample. New geometry never draws multipliers or computes p-values. Projection retains a Cholesky factor; spectrum construction is separate and its result can be reused for many calibrations. SB-only calibration of projected scores uses a trace without a spectrum. PSD meat is allowed for mixture inference; the separate sandwich operation requires full rank.
Likelihood scores have the sign of the log-likelihood derivative and summed normalization. ML2S instead exposes the observed Stage-2 score separately from its propagated Stage-1 influence rows: those rows need not sum to the observed score. Global and nested targets use different coordinate spaces. Geometry support restrictions follow the corresponding legacy score routines.
The snapshot can also be passed to fmg_tests, fmg_nested, and
robust_nested_lrt. Their native fit context is reused; these legacy
procedures still compute their own method-specific geometry. Save an existing
LR/GOF spectrum with quadratic_reference to recalibrate without repeating
that computation. Information and covariance preparation for Wald currently
support ML/FIML; ML2S uses its existing two-stage covariance interface.
Locked environments hold prepared snapshots, components, projections and reference laws. Scores and multiplier summaries are lists, information and covariance are matrices, and calibration returns a data frame. Wald returns the existing statistic, df and p-value list.
Calibrate and draw model-implied continuous data in one call.
sim_model_batch( fit_or_partable, n, reps, seed_base, theta = NULL, generator = "normal", df = 5, mixture_weights = NULL, mixture_scale_multipliers = NULL, contamination_probability = 0.05, contamination_scale_multiplier = 3, slash_q = 5, cholesky_jitter = 0 )sim_model_batch( fit_or_partable, n, reps, seed_base, theta = NULL, generator = "normal", df = 5, mixture_weights = NULL, mixture_scale_multipliers = NULL, contamination_probability = 0.05, contamination_scale_multiplier = 3, slash_q = 5, cholesky_jitter = 0 )
fit_or_partable |
A magmaan fit object or partable. |
n |
Number of observations per replication. |
reps |
Number of replications. |
seed_base |
Base RNG seed. |
theta |
Optional free-parameter vector when |
generator |
Continuous generator name; default |
df |
Degrees of freedom for Student t generation. |
mixture_weights |
Mixture component probabilities. |
mixture_scale_multipliers |
Positive component scale multipliers. |
contamination_probability |
Probability of a contaminated observation. |
contamination_scale_multiplier |
Scale multiplier for contamination. |
slash_q |
Positive exponent for slash generation. |
cholesky_jitter |
Non-negative diagonal jitter used for factorization. |
Calibrate model-implied continuous data generation.
sim_model_calibrate(fit_or_partable, theta = NULL)sim_model_calibrate(fit_or_partable, theta = NULL)
fit_or_partable |
A magmaan fit object or partable. |
theta |
Optional free-parameter vector when |
Draw model-implied continuous data from a calibration object.
sim_model_draw( calibration, n, reps, seed_base, generator = "normal", df = 5, mixture_weights = NULL, mixture_scale_multipliers = NULL, contamination_probability = 0.05, contamination_scale_multiplier = 3, slash_q = 5, cholesky_jitter = 0 )sim_model_draw( calibration, n, reps, seed_base, generator = "normal", df = 5, mixture_weights = NULL, mixture_scale_multipliers = NULL, contamination_probability = 0.05, contamination_scale_multiplier = 3, slash_q = 5, cholesky_jitter = 0 )
calibration |
A calibration from |
n |
Number of observations per replication. |
reps |
Number of replications. |
seed_base |
Base RNG seed. |
generator |
Continuous generator name; default |
df |
Degrees of freedom for Student t generation. |
mixture_weights |
Mixture component probabilities. |
mixture_scale_multipliers |
Positive component scale multipliers. |
contamination_probability |
Probability of a contaminated observation. |
contamination_scale_multiplier |
Scale multiplier for contamination. |
slash_q |
Positive exponent for slash generation. |
cholesky_jitter |
Non-negative diagonal jitter used for factorization. |
Calibrate and draw ordinal/continuous Pearson-code data in one call.
sim_ordcorr_batch( target_corr, marginals, n, reps, seed_base, metric = "polychoric", max_bisection_iter = 80L, calibration_tol = 1e-08, rho_bound = 0.999, matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08, cholesky_jitter = 0 )sim_ordcorr_batch( target_corr, marginals, n, reps, seed_base, metric = "polychoric", max_bisection_iter = 80L, calibration_tol = 1e-08, rho_bound = 0.999, matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08, cholesky_jitter = 0 )
target_corr |
Target observed correlation matrix. |
marginals |
List of marginal category probabilities, or |
n |
Number of observations per replication. |
reps |
Number of replications. |
seed_base |
Base RNG seed. |
metric |
Correlation metric used for the target; default |
max_bisection_iter |
Maximum iterations for each correlation inversion. |
calibration_tol |
Absolute tolerance for correlation calibration. |
rho_bound |
Upper bound on the absolute latent correlation. |
matrix_repair |
Correlation-matrix repair strategy. |
matrix_repair_min_eigenvalue |
Minimum eigenvalue requested by repair. |
cholesky_jitter |
Non-negative diagonal jitter used for factorization. |
Calibrate ordinal/continuous Pearson-code correlation generation.
sim_ordcorr_calibrate( target_corr, marginals, metric = "polychoric", max_bisection_iter = 80L, calibration_tol = 1e-08, rho_bound = 0.999, matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08 )sim_ordcorr_calibrate( target_corr, marginals, metric = "polychoric", max_bisection_iter = 80L, calibration_tol = 1e-08, rho_bound = 0.999, matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08 )
target_corr |
Target observed correlation matrix. |
marginals |
List of marginal category probabilities, or |
metric |
Correlation metric used for the target; default |
max_bisection_iter |
Maximum iterations for each correlation inversion. |
calibration_tol |
Absolute tolerance for correlation calibration. |
rho_bound |
Upper bound on the absolute latent correlation. |
matrix_repair |
Correlation-matrix repair strategy. |
matrix_repair_min_eigenvalue |
Minimum eigenvalue requested by repair. |
Draw ordinal/continuous Pearson-code data from a calibration object.
sim_ordcorr_draw(calibration, n, reps, seed_base, cholesky_jitter = 0)sim_ordcorr_draw(calibration, n, reps, seed_base, cholesky_jitter = 0)
calibration |
A calibration from |
n |
Number of observations per replication. |
reps |
Number of replications. |
seed_base |
Base RNG seed. |
cholesky_jitter |
Non-negative diagonal jitter used for factorization. |
Calibrate and draw grouped ordinal/continuous data in one call.
sim_ordcorr_mg_batch( target_corrs, marginals, n, reps, seed_base, group_labels = NULL, metric = "polychoric", max_bisection_iter = 80L, calibration_tol = 1e-08, rho_bound = 0.999, matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08, cholesky_jitter = 0 )sim_ordcorr_mg_batch( target_corrs, marginals, n, reps, seed_base, group_labels = NULL, metric = "polychoric", max_bisection_iter = 80L, calibration_tol = 1e-08, rho_bound = 0.999, matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08, cholesky_jitter = 0 )
target_corrs |
List of target correlation matrices, one per group. |
marginals |
List of group marginal lists. |
n |
Number of observations per replication. |
reps |
Number of replications. |
seed_base |
Base RNG seed. |
group_labels |
Optional group labels. |
metric |
Correlation metric used for the target; default |
max_bisection_iter |
Maximum iterations for each correlation inversion. |
calibration_tol |
Absolute tolerance for correlation calibration. |
rho_bound |
Upper bound on the absolute latent correlation. |
matrix_repair |
Correlation-matrix repair strategy. |
matrix_repair_min_eigenvalue |
Minimum eigenvalue requested by repair. |
cholesky_jitter |
Non-negative diagonal jitter used for factorization. |
Calibrate grouped ordinal/continuous Pearson-code generation.
sim_ordcorr_mg_calibrate( target_corrs, marginals, group_labels = NULL, metric = "polychoric", max_bisection_iter = 80L, calibration_tol = 1e-08, rho_bound = 0.999, matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08 )sim_ordcorr_mg_calibrate( target_corrs, marginals, group_labels = NULL, metric = "polychoric", max_bisection_iter = 80L, calibration_tol = 1e-08, rho_bound = 0.999, matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08 )
target_corrs |
List of target correlation matrices, one per group. |
marginals |
List of group marginal lists. |
group_labels |
Optional group labels. |
metric |
Correlation metric used for the target; default |
max_bisection_iter |
Maximum iterations for each correlation inversion. |
calibration_tol |
Absolute tolerance for correlation calibration. |
rho_bound |
Upper bound on the absolute latent correlation. |
matrix_repair |
Correlation-matrix repair strategy. |
matrix_repair_min_eigenvalue |
Minimum eigenvalue requested by repair. |
Draw grouped ordinal/continuous data from a calibration object.
sim_ordcorr_mg_draw(calibration, n, reps, seed_base, cholesky_jitter = 0)sim_ordcorr_mg_draw(calibration, n, reps, seed_base, cholesky_jitter = 0)
calibration |
A calibration from |
n |
Number of observations per replication. |
reps |
Number of replications. |
seed_base |
Base RNG seed. |
cholesky_jitter |
Non-negative diagonal jitter used for factorization. |
Rebuild grouped ordinal-correlation calibrations from summary pieces.
sim_ordcorr_mg_summary_calibrate( latent_corrs, kinds, thresholds, group_labels = NULL, metric = "polychoric", matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08 )sim_ordcorr_mg_summary_calibrate( latent_corrs, kinds, thresholds, group_labels = NULL, metric = "polychoric", matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08 )
latent_corrs |
List of latent Gaussian correlation matrices. |
kinds |
Integer variable-type codes from an existing calibration. |
thresholds |
List of threshold lists, one per group. |
group_labels |
Optional group labels. |
metric |
Correlation metric used for the target; default |
matrix_repair |
Correlation-matrix repair strategy. |
matrix_repair_min_eigenvalue |
Minimum eigenvalue requested by repair. |
Rebuild an ordinal-correlation calibration from latent summary pieces.
sim_ordcorr_summary_calibrate( latent_corr, kinds, thresholds, metric = "polychoric", matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08 )sim_ordcorr_summary_calibrate( latent_corr, kinds, thresholds, metric = "polychoric", matrix_repair = "none", matrix_repair_min_eigenvalue = 1e-08 )
latent_corr |
Latent Gaussian correlation matrix. |
kinds |
Integer variable-type codes from an existing calibration. |
thresholds |
Threshold list from an existing calibration. |
metric |
Correlation metric used for the target; default |
matrix_repair |
Correlation-matrix repair strategy. |
matrix_repair_min_eigenvalue |
Minimum eigenvalue requested by repair. |
Standardizes parameter estimates and propagates the supplied covariance.
standardized(fit, vcov, type = c("all", "lv"))standardized(fit, vcov, type = c("all", "lv"))
fit |
A fitted magmaan model. |
vcov |
Explicit covariance matrix of free parameters, in theta order. |
type |
Standardization: all variables or latent variables only. |
A table of standardized parameter estimates and uncertainty.
Includes fixed markers, group-specific transformations and ordinal latent-response residual variances. Standard errors use the delta method. Defined parameters have missing values because their expressions have no specified standardized scale.
standardized_rows(fit, vcov)standardized_rows(fit, vcov)
fit |
A lab fit. |
vcov |
Explicit covariance in the fit's free-parameter coordinates. |
A list of std.lv, std.lv.se, std.all and
std.all.se vectors in partable row order.
Checks generic local identification without data. A prepared model reuses its construction-time report. For an ordinal specification, provide a prototype to declare categories; prototype values never enter the check. Models with unsupported moment maps or constraints are returned as unchecked. Lab fitting remains available for every status; unidentified fits fail their convergence verdict. No constraints are added by this check.
structural_identification(model, prototype = NULL)structural_identification(model, prototype = NULL)
model |
A model specification, lavaan syntax, or a prepared model. |
prototype |
Optional category-schema prototype for ordinal specifications. |
A list with status (identified, unidentified, unchecked),
reason, map, reduced n_parameters, n_moments, counting_rule,
rank, n_points, null_tolerance, identified_tolerance,
min_relative_singular_values (one per evaluated point), and
smallest_singular_values at the deciding point. null_directions has
one column per free direction, with parameter labels as row names;
null_direction_text describes the coefficients. direction_types and
direction_factors classify each column as scale, location, rotation or
deficit; suggested_fixes gives matching advice. gauge_dimension and
deficit_dimension partition the nullity. Fixed matrix entries and linear
equalities are enforced before testing gauge membership. Cached directions are
evaluated at the deciding data-free probe (directions_at_estimate = FALSE).
This checks generic local identification, not global uniqueness or weak
identification at a fitted point.
Selects existing C++ covariance primitives without changing the fitted model or the ordinary-user inference policy.
## S3 method for class 'magmaan_fit' vcov(object, regime = NULL, data = NULL, ...)## S3 method for class 'magmaan_fit' vcov(object, regime = NULL, data = NULL, ...)
object |
A fitted |
regime |
Covariance formula; see Details. |
data |
Raw observations for empirical sandwiches or delta-method covariances. Defaults to the observations retained by the fit. FIML always uses its retained observations and rejects a replacement. |
... |
Reserved for generic compatibility. |
information_expected, information_observed
Inverse expected information or observed Hessian information, respectively. Available for complete-data ML and FIML; neither includes empirical sandwich meat.
sandwich_expected, sandwich_observed
Empirical-meat sandwiches with expected/Gauss–Newton or observed-Hessian bread. Available for continuous iterative fits and categorical fits where the corresponding core primitive supports the estimator, and for FIML. Categorical covariances use the retained categorical statistics. These are fixed-weight covariances.
sandwich_ijThe estimated-weight (infinitesimal-jackknife) sandwich for all-ordinal DWLS, WLS and ULS fits: observed bread, Stage-1 threshold and polychoric influence, and the influence of the estimated weight. It is the ordinary DWLS policy covariance.
delta_nt, delta_empirical
Non-iterative CFA delta-method covariances using normal-theory or empirical moment covariance.
storedThe covariance already computed by a SAM fit.
Unsupported combinations raise an error. Defaults are sandwich_observed
for ML and FIML and sandwich_ij for categorical and estimated-weight
continuous GLS/WLS fits. IJ errors when the estimator's influence law is unsupported.
Non-iterative CFA retains delta_nt: this postponed development area
uses a documented normal-theory comparator. SAM retains stored as a diagnostic.
Shared barrier compositions and pairwise MCAR fits reject this interface
pending their own sampling/inference contracts.
Legacy model selects the historical default. Legacy robust
selects sandwich_observed, except for categorical and GLS/WLS fits (sandwich_ij), non-iterative CFA
(delta_empirical) and SAM (stored). The model alias retains its historical comparator; robust selects the
empirical/IJ route described above. Prefer the explicit names.
A covariance matrix in the fit's free-parameter order.
Reports the version of the compiled magmaan library.
version()version()
A version string.