augment_lav_predict: Obtain factor scores and related definition variables from a...

View source: R/get_fscore.R

augment_lav_predictR Documentation

Obtain factor scores and related definition variables from a lavaan object for 2S-PA analyses.

Description

This function obtained the factor scores, standard errors, loading matrix, and variance covariance matrix by calling the lavaan::lavPredict() function.

Usage

augment_lav_predict(
  lavobj,
  method = c("regression", "Bartlett"),
  drop_list_single = TRUE,
  ...
)

Arguments

lavobj

A fitted lavaan::lavaan object

method

A character string indicating the scoring method to use. Must be either "regression" or "Bartlett".

drop_list_single

logical. Should the results be unlisted for single-group models?

...

Additional arguments passed to lavaan::lavPredict()

Value

A data.frame containing the factor scores, the corresponding standard errors, the loadings and cross-loadings of the factor scores as indicators of the latent variables, the error variance-covariance matrix of the factor scores, and the measurement intercepts. In addition, three character matrices are added as attributes that can be used as input to tspa_mx_model():

  • ld: cross-loading matrix

  • ev: error variance-covariance matrix

  • int: measurement intercepts

Examples

library(lavaan)
hs_model <- ' visual  =~ x1 + x2 + x3 '
fit <- cfa(hs_model,
           data = HolzingerSwineford1939,
           group = "school")
augment_lav_predict(fit)

Gengrui-Zhang/R2spa documentation built on Sept. 6, 2024, 5:01 p.m.