The compareModels
function compares the output of two Mplus files and prints similarities and
differences in the model summary statistics and parameter estimates. Options are provided
for filtering out fixed parameters and nonsignificant parameters. When requested, compareModels
will compute the chisquare difference test for nested models (does not apply to MLMV, WLSM, and WLSMV
estimators, where DIFFTEST in Mplus is needed).
Model outputs to be compared can be full summaries and parameters (generated by readModels
),
summary statistics only (extractModelSummaries
), or parameters only (extractModelParameters
).
compareModels( m1, m2, show = "all", equalityMargin = c(param = 1e04, pvalue = 1e04), compare = "unstandardized", sort = "none", showFixed = FALSE, showNS = TRUE, diffTest = FALSE )
m1  The first Mplus model to be compared. Generated by 

m2  The second Mplus model to be compared. 
show  What aspects of the models should be compared. Options are "all", "summaries", "equal", "diff", "pdiff", and "unique". See below for details. 
equalityMargin  Defines the discrepancy between models that is considered equal. Different margins can be specified for pvalue equality versus parameter equality. Defaults to .0001 for both. 
compare  Which parameter estimates should be compared. Options are "unstandardized", "stdyx.standardized" "stdy.standardized", and "std.standardized". 
sort  How to sort the output of parameter comparisons. Options are "none", "type", "alphabetical", and "maxDiff". See below for details. 
showFixed  Whether to display fixed parameters in the output (identified
where the est/se = 999.000, per Mplus convention). Default to 
showNS  Whether to display nonsignificant parameter estimates. Can be

diffTest  Whether to compute a chisquare difference test between the models. Assumes that the models are nested. Not available for MLMV, WLSMV, and ULSMV estimators. Use DIFFTEST in Mplus instead. 
No value is returned by this function. It is used to print model differences to the R console.
The show
parameter can be one or more of the following, which can be passed as a vector, such as c("equal", "pdiff").
Display all available model comparison. Equivalent to c("summaries", "equal", "diff", "pdiff", "unique").
Print a comparison of model summary statistics. Compares the following summary statistics (where available): c("Title", "Observations", "Estimator", "Parameters", "LL", "AIC", "BIC", "ChiSqM_Value", "ChiSqM_DF", "CFI", "TLI", "RMSEA", "SRMR", "WRMR")
Prints a comparison of all summary statistics available in each model. May generate a lot of output.
Print parameter estimates that are equal between models
(i.e., <= equalityMargin["param"]
)
Print parameter estimates that are different between models
(i.e., > equalityMargin["param"]
)
Print parameter estimates where the pvalues differ between models
(i.e., > equalityMargin["pvalue"]
)
Print parameter estimates that are unique to each model.
The sort
parameter determines the order in which parameter estimates are displayed. The following options are available:
No sorting is performed, so parameters are output in the order presented in Mplus. (Default)
Sort parameters by their role in the model. This groups output by regression coefficient (ON), factor loadings (BY), covariances (WITH), and so on. Within each type, output is alphabetical.
Sort parameters in alphabetical order.
Sort parameter output by the largest differences between models (high to low).
Michael Hallquist
# make me!!!