semrulesid allows the user to check a structural
equation model (SEM) written in lavaan (Rosseel, 2012)
syntax, or supplied as a lavaan parameter table or fit
object, against a number of identification rules from the literature.
Rules are specified as being necessary and/or sufficient and specific
reasons are given when a rule is not satisfied or not applicable.
Users should not treat the package output as the sole determinant of
model identification. Instead, semrulesid should be used as
a “quick check” for potential identification issues and
outstanding model specification concerns.
You can install semrulesid from CRAN:
install.packages("semrulesid")You can install the development version from GitHub with:
install.packages("pak")
pak::pak("zacharyvig/semrulesid")id() takes a lavaan model string,
parameter table, or model fit and evaluates the identification rules
with informative output.
lav_fun argument is used to specify the
lavaan function with which you intend to fit a model (e.g.,
"sem").print_msgs = TRUE, information about why a rule did or did
not pass or whether a rule is relevant for the particular type or
specification of the model.lavaan’s lavaanify function (e.g.,
meanstructure).Example:
id(my_model, print_msgs = TRUE, lav_fun = "sem")
scaling() prints output about how, and if so why,
latent variables in the model are scaled.
Example:
scaling(my_model, print_msgs = TRUE, lav_fun = "cfa")
id2() evaluates the two-step rule of identification
for full SEMs only.
Example:
id2(my_model, print_msgs = TRUE, lav_fun = "sem")
Example:
id(my_model) |> scaling()orscaling(my_model) |> id()
library(semrulesid)
my_model <- '
L1 =~ x1 + x2 + x3
L2 =~ x4 + x5 + x6
L3 =~ x7 + x8 + x9
L2 ~ L1
L3 ~ L2
'
id(my_model, meanstructure = FALSE) # Check identification rules
id2(my_model, meanstructure = FALSE) # Check the two-step rule
scaling(my_model, meanstructure = FALSE) # Check latent-variable scaling