The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
lavaan is an extremely versatile package for structural equation modeling. It covers a wide range of different estimation procedures beyond the basic maximum likelihood estimation with listwise deletion of missings. lessSEM tries to cover some of these procedures out of the box. That is, when provided with a lavaan model, lessSEM will check the estimator, missing data procedure, etc. and try to match it.
lessSEM may not yet provide all procedures implemented in lavaan. If you run into cases where lessSEM does not match the lavaan model correctly, please let us know at GitHub.
By default, lavaan will use maximum likelihood estimation with listwise deletion of missing data. If you pass such a “default” model to lessSEM, the same procedures will be used as well:
library(lessSEM)
dataset <- simulateExampleData()
lavaanSyntax <- "
f =~ l1*y1 + l2*y2 + l3*y3 + l4*y4 + l5*y5 +
l6*y6 + l7*y7 + l8*y8 + l9*y9 + l10*y10 +
l11*y11 + l12*y12 + l13*y13 + l14*y14 + l15*y15
f ~~ 1*f
"
lavaanModel <- lavaan::sem(lavaanSyntax,
data = dataset,
std.lv = TRUE)
lsem <- lasso(
lavaanModel = lavaanModel,
regularized = paste0("l", 6:15),
nLambdas = 50)
You can also use meanstructure = TRUE
and
lessSEM will automatically add a meanstructure as
well.
Missing data is a very common problem in real data analysis.
Different procedures have been developed to address with issue, with
full-information-maximum-likelihood being among the most famous ones. In
lavaan, you can use this procedure by setting
missing = "ml"
:
library(lessSEM)
dataset <- simulateExampleData(percentMissing = 20)
lavaanSyntax <- "
f =~ l1*y1 + l2*y2 + l3*y3 + l4*y4 + l5*y5 +
l6*y6 + l7*y7 + l8*y8 + l9*y9 + l10*y10 +
l11*y11 + l12*y12 + l13*y13 + l14*y14 + l15*y15
f ~~ 1*f
"
lavaanModel <- lavaan::sem(lavaanSyntax,
data = dataset,
std.lv = TRUE,
# note: we change the missing procedure
missing = "ml")
lsem <- lasso(
lavaanModel = lavaanModel,
regularized = paste0("l", 6:15),
nLambdas = 50)
Warning WLS is under development and not fully supported at the moment.
Weighted least squares estimation is an alternative to maximum
likelihood estimation that is prominent in case of non-normal data.
Again, lavaan covers a wide range of different weighted
least squares estimators that can be selected with the
estimator = x
option. These estimators differ in their
weight matrix. lessSEM extracts the weights
automatically from lavaan. The following weighted least
squares variants are supported: estimator = "wls"
,
estimator = "dwls"
, estimator = "gls"
, and
estimator = "uls"
.
Again, lessSEM will try to copy the procedure used in lavaan automatically:
library(lessSEM)
# Note: WLS needs much larger sample sizes
dataset <- simulateExampleData(N = 1000)
lavaanSyntax <- "
f =~ l1*y1 + l2*y2 + l3*y3 + l4*y4 + l5*y5 +
l6*y6 + l7*y7 + l8*y8 + l9*y9 + l10*y10 +
l11*y11 + l12*y12 + l13*y13 + l14*y14 + l15*y15
f ~~ 1*f
"
lavaanModel <- lavaan::sem(lavaanSyntax,
data = dataset,
std.lv = TRUE,
estimator = "wls")
lsem <- lasso(
lavaanModel = lavaanModel,
regularized = paste0("l", 6:15),
nLambdas = 50)
Changing the estimator just requires replacing
estimator = "wls"
with any of the other weighted least
squares variants mentioned above:
library(lessSEM)
# Note: WLS needs much larger sample sizes
dataset <- simulateExampleData(N = 1000)
lavaanSyntax <- "
f =~ l1*y1 + l2*y2 + l3*y3 + l4*y4 + l5*y5 +
l6*y6 + l7*y7 + l8*y8 + l9*y9 + l10*y10 +
l11*y11 + l12*y12 + l13*y13 + l14*y14 + l15*y15
f ~~ 1*f
"
lavaanModel <- lavaan::sem(lavaanSyntax,
data = dataset,
std.lv = TRUE,
estimator = "uls")
lsem <- lasso(
lavaanModel = lavaanModel,
regularized = paste0("l", 6:15),
nLambdas = 50)
Currently, the only procedure to select final parameters that is supported by lessSEM out of the box is cross-validation. AIC or BIC are not supported.
lavaan supports ordered data. This is not yet implemented in lessSEM. Check lslx for an implementation of regularized SEM with categorical data (Huang, 2020).
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.