| lavPredict {lavaan} | R Documentation |
The lavPredict() function can be used to compute estimated
values for latent variables, and model predicted values for observed
variables.
lavPredict(object, type = "lv", newdata = NULL, method = "EBM",
se.fit = FALSE, label = TRUE, optim.method = "nlminb")
object |
An object of class |
type |
A character string. If |
newdata |
An optional data.frame, containing the same variables as the data.frame used when fitting the model in object. |
method |
A character string. In the linear case (when the indicators are
continuous), the possible options are |
se.fit |
Not used yet. |
label |
Logical. If TRUE, the columns are labeled. |
optim.method |
Character string. Only used in the categorical case.
If |
The predict() function calls the lavPredict() function
with its default options.
# fit model
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data=HolzingerSwineford1939)
head(lavPredict(fit))
head(lavPredict(fit, type = "ov"))