View source: R/lav_model_plotinfo.R
| lav_model_plotinfo | R Documentation |
Extracts the information from a model that is needed to produce a plot.
lav_model_plotinfo(model = NULL, infile = NULL, varlv = FALSE)
model |
A character vector specifying the model in lavaan syntax or a list
(or data.frame) with at least members lhs, op, rhs, label and fixed or a fitted
lavaan object (in which case the |
infile |
A character string specifying the file that contains the model syntax. |
varlv |
A logical indicating that the (residual) variance of a variable should be plotted as a separate latent variable (with a smaller circle than ordinary latent variables). In this case, a covariance between two such variables is plotted as a covariance between their variance latent variables. |
A structure 'plotinfo', which is a list with members nodes and edges. These are data.frames containing the data needed to create a diagram.
nodes
character, identification of the node consisting of blok and naam.
character, name of the node as specified in the model. For intercepts the name is "1vanXXXX", with XXXX the name of the regressed variable.
character, type of node: ov (observed variable), lv (latent variable), varlv (variance as latent variable), cv (composite variable), wov (within level variable in multilevel model), bov (between level variable in multilevel model), const (intercept of regression).
integer, level (0 if not a multilevel model).
edges
integer, autoincrement identification of the edge.
character, label for the edge, made from the label specified in the model and the fixed (or estimated) value if present.
character, id of the starting node.
character, id of the destination node.
character, lavaan operator, with two exceptions: a (residual) variance is coded here as '~~~', and a regression introduced by varlv = TRUE is coded as '~.'.
model <- 'alpha =~ 1 * x1 + x2 + x3 # latent variable
beta <~ x4 + x5 + x6 # composite
gamma =~ 1 * x7 + x8 + x9 # latent variable
Xi =~ 1 * x10 + x11 + x12 + x13 # latent variable
# regressions
Xi ~ v * alpha + t * beta + cc * 1
alpha ~ tt * beta + ss * gamma + yy * Theta1
# variances and covariances
x2 ~~ cc25 * x5
x3 ~~ cc36 * x6
x3 ~~ cc34 * x4
gamma ~~ 0.55 * gamma
'
(test <- lav_model_plotinfo(model))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.