Join GitHub today
semTools: Useful tools for structural equation modeling
The goal of this package is to collect useful functions for structural equation modeling in a single, easily accessible place. Everyone is invited to send functions to us and we will maintain the functions for you. Click here for the list of all current functionality of this package and the near future development.
[25 September 2018] Latest Update: semTools, Version 0.5-1
Version 0.5-1 of semTools has been released on CRAN, which requires at least lavaan version 0.6-3. In addition to fixing some bugs, the major changes in this version include:
- The formerly deprecated
lisrel2lavaan()function has been removed from semTools
compareFit()function now accepts
lavaan.miobjects returned by
lavaan.miobjects returned by
anova()method has been updated to behave more like lavaan's
- more than 2 nested models can be compared
- fit indices are no longer an option, and must be requested using the
- Given the previous addition of score-test functions
lavaan.miobjects (parallel to
lavaanobjects), the remaining "trilogy" of tests in lavaan (
lavTestWald()) now have parallel functions for
lavTestWald.mi()implements what was formerly available in using
anova(..., test = "D1")
lavTestLRT.mi()implements what was formerly available in using
anova(..., test = "D3")
lavTestLRT.mi()cannot compare more than 2 nested models. The
anova()method internally calls the
compareFit()function to compare multiple
- For all 3 tests (score, Wald, and LRT), the "D2" pooling method is an option, and there is a newly public function
calculate.D2()that can be used to pool any set of Wald chi-squared or z statistics.
runMI()function can now be applied to multilevel SEMs that can be fitted with
- Known issue (#39):
resid()methods will not yet work in models with both multiple levels and multiple groups. This will be resolved in a future version.
- Known issue (#39):
- The 3 functions
longInvariance()have been deprecated, redirecting users to the new
measEq.syntax()function. It is much more general, capable of combining features of all 3 deprecated functions without their restrictions.
- The function's primary purpose is writing syntax that users can read and edit.
- The fitting of a model is optional, and fitting multiple models is not (yet) automated. See the
?measEq.syntaxhelp-page examples for how to fit and compare several levels of invariance.
- Find many more details posted on the lavaan forum (the Google group).
[1 July 2018] Latest Update: semTools, Version 0.5-0
Version 0.5-0 of semTools has been released on CRAN, which assimilates lavaan's most recent internal changes (therefore requiring at least lavaan version 0.6-1), adds some minor features to a few existing functions, and fixes some bugs.
The biggest change in this version is the re-design of the
runMI() function, which no longer produces an object of class
lavaanStar (that object class is no longer supported), which inherited from class
lavaan. It now produces an object of class
lavaan.mi, which inherits from lavaan's new
lavaanList class (see the
?lavaanList help page for details). The reasons to redesign
- The user was required to choose among available methods for pooling the chi-squared test statistic when fitting the model, and the baseline model was also fit so that incremental fit indices (e.g., CFI and TLI) could be calculated. This lead to more frequent convergence problems.
lavaanStarclass could inadvertently mislead users into thinking that certain results were available from multiple imputations that were not. For example, the
modindices()function would return modification indices for the first imputation, but those were not appropriately pooled statistics.
runMI() no longer includes the
chi= argument, because those options have been moved to an
anova() method written for
lavaan.mi objects. Additional methods have been written: see the
class?lavaan.mi help page for a list of methods and details about their use. Additionally, appropriately pooled modification indices and (S)EPCs are now available for multiple imputations (via
modindices.mi()), as well as a general score test via
parcelAllocation() has also been redesigned with new arguments to improve its flexibility and ease of use. Users are now required to provide lavaan syntax not only for the parcel-level model, but also for the item-level model. This allows parcel allocation to be automatically detected, no longer requiring users to provide a list of item-to-parcel assignments (see new examples on the help page).
The OpenMx enhancements in previous versions of semTools are obsolete now that OpenMx provides fit indices and standardized paths, so they have been removed. However,
standardizeMx() is still available (temporarily deprecated) to provide standardized mean-structure parameters, until the OpenMx maintainers add that feature to
measurementInvarianceCat() now require users to name all arguments passed to
cfa(), including the first argument:
model=. This is to prevent errors that occurred when some previous users had passed arguments in a different order than expected, which should not be a limitation.
Please report any issues on the lavaan Google forum or on the GitHub issues site: https://github.com/simsem/semTools/issues
Everyone is invited to be a developer! Here is the list of current developers and contributors.
Terrence D. Jorgensen (primary maintainer)
Sunthud Pornprasertmanit (past maintainer)
[Alexander Schoemann] (https://sites.google.com/site/alexandermschoemann/home)
The project is still under development. The package can be installed by copying this line into the R program:
If you are interested in the source code, please click the code tab. You may install the latest development version using the
Note that latestVersion is the appropriate number of the latest version. For example, "semTools_0.4-14.tar.gz" is used.
Please report any bugs or send any suggestions (e.g., feature requests) on the Issues page.
The maintainer and primary contributors to this package are listed as authors, but this
package is a collaborative work. The maintainer(s) cannot take credit for others'
contributions. Whenever possible, please cite the paper(s) associated with the
development of a particular function (e.g.,
parcelAllocation), listed in
the References section of its associated help page. Otherwise, please use the following
citation for the package as a whole:
Jorgensen, T. D., Pornprasertmanit, S., Schoemann, A. M., & Rosseel, Y. (2018). semTools: Useful tools for structural equation modeling. R package version 0.5-1. Retrieved from https://CRAN.R-project.org/package=semTools
The development of semTools was initially supported by the University of Kansas Center for Research Methods and Data Analysis.