lavMatrixRepresentation: lavaan matrix representation

Description Usage Arguments Value See Also Examples

View source: R/lav_representation.R

Description

Extend the parameter table with a matrix representation.

Usage

1
2
lavMatrixRepresentation(partable, representation = "LISREL", 
                        add.attributes = FALSE, as.data.frame. = TRUE)

Arguments

partable

A lavaan parameter table (as extracted by the parTable function, or generated by the lavPartable function).

representation

Character. The matrix representation style. Currently, only the all-y version of the LISREL representation is supported.

add.attributes

Logical. If TRUE, additional information about the model matrix representation is added as attributes.

as.data.frame.

Logical. If TRUE, the extended parameter table is returned as a data.frame.

Value

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.

See Also

lavParTable, parTable

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '

fit <- cfa(HS.model, data=HolzingerSwineford1939)

# extract partable
partable <- parTable(fit)

# add matrix representation (and show only a few columns)
lavMatrixRepresentation(partable)[,c("lhs","op","rhs","mat","row","col")]

Example output

This is lavaan 0.6-3
lavaan is BETA software! Please report any bugs.
       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

lavaan documentation built on March 10, 2021, 5:05 p.m.