Learn R Programming

semPlot (version 1.1.2)

modelMatrices: Extract SEM model matrices

Description

Create a "semMatriModel" object. Use semMatrixAlgebra to extract or compute with these models. The structure of "semMatriModel" objects is chosen such that they can be used to create a semPlotModel-class object using do.call in combination with ramModel, lisrelModel or mplusModel (not yet implemented). See details.

Usage

modelMatrices(object, model = "ram", endoOnly = FALSE)

Arguments

object

A "semPlotModel" object or any of the input types that can be used in semPlotModel directly.

model

Model to be used, "mplus", "ram" or "lisrel"

endoOnly

Only needed when the model is "lisrel", sets all variables to endogenous.

Value

a "semMatriModel" object

Details

The "lisrel" model uses the following matrix names: LY, TE, PS, BE, LX, TD, PH, GA, TY, TX, AL and KA. Regressions on manifest variables will cause dummy latents to be included in the model.

The "mplus" model uses the following matrix names: Lambda, Nu, Theta, Kappa, Alpha, Beta, Gamma and Psi.

The "ram" model uses the following matrix names: F, A and S.

See Also

semPlotModel semPlotModel-class semMatrixAlgebra lisrelModel ramModel

Examples

Run this code
# NOT RUN {
## Mplus user guide SEM example:
outfile <- tempfile(fileext=".out")
download.file("http://www.statmodel.com/usersguide/chap5/ex5.11.out",outfile)

# Plot model:
semPaths(outfile, intercepts = FALSE)

# Extract RAM:
RAM <- modelMatrices(outfile, "ram")
semPaths(do.call(ramModel, RAM), as.expression = "edges", intercepts = FALSE)

# Extract LISREL:
LISREL <- modelMatrices(outfile, "lisrel")
semPaths(do.call(lisrelModel, LISREL), as.expression = "edges", intercepts = FALSE)
# }

Run the code above in your browser using DataLab