lavMatrixRepresentation.RdExtend the parameter table with a matrix representation.
lavMatrixRepresentation(partable, representation = "LISREL",
allow.composites = TRUE,
add.attributes = FALSE, as.data.frame. = TRUE)A lavaan parameter table (as extracted by the
parTable function, or generated by the
lavPartable function).
Character. The matrix representation style. Currently, only the all-y version of the LISREL representation is supported.
Logical. If TRUE, and the model syntax
contains the "<~" operator, handle the lhs as proper composites.
If FALSE, use the old (<0.6-20) approach.
Logical. If TRUE, additional information
about the model matrix representation is added as attributes.
Logical. If TRUE, the extended parameter table is
returned as a data.frame.
A list or a data.frame containing the original parameter table, plus
three columns: a "mat" column containing matrix names, and
a "row" and "col" column for the row and column indices
of the model parameters in the model matrices.
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data=HolzingerSwineford1939)
#> Warning: lavaan->lav_model_vcov():
#> The variance-covariance matrix of the estimated parameters (vcov) does not
#> appear to be positive definite! The smallest eigenvalue (= -1.747972e-02)
#> is smaller than zero. This may be a symptom that the model is not
#> identified.
# extract partable
partable <- parTable(fit)
# add matrix representation (and show only a few columns)
lavMatrixRepresentation(partable)[,c("lhs","op","rhs","mat","row","col")]
#> lhs op rhs mat row col
#> 1 visual =~ x1 lambda 1 1
#> 2 visual =~ x2 lambda 2 1
#> 3 visual =~ x3 lambda 3 1
#> 4 textual =~ x4 lambda 4 2
#> 5 textual =~ x5 lambda 5 2
#> 6 textual =~ x6 lambda 6 2
#> 7 speed =~ x7 lambda 7 3
#> 8 speed =~ x8 lambda 8 3
#> 9 speed =~ x9 lambda 9 3
#> 10 x1 ~~ x1 theta 1 1
#> 11 x2 ~~ x2 theta 2 2
#> 12 x3 ~~ x3 theta 3 3
#> 13 x4 ~~ x4 theta 4 4
#> 14 x5 ~~ x5 theta 5 5
#> 15 x6 ~~ x6 theta 6 6
#> 16 x7 ~~ x7 theta 7 7
#> 17 x8 ~~ x8 theta 8 8
#> 18 x9 ~~ x9 theta 9 9
#> 19 visual ~~ visual psi 1 1
#> 20 textual ~~ textual psi 2 2
#> 21 speed ~~ speed psi 3 3
#> 22 visual ~~ textual psi 1 2
#> 23 visual ~~ speed psi 1 3
#> 24 textual ~~ speed psi 2 3