simstandard (version 0.3.0)

add_factor_scores: Add factor scores to observed data

Description

Add factor scores to observed data

Usage

add_factor_scores(d, m, CI = FALSE, p = 0.95, ...)

Arguments

d

A data.frame with observed data in standardized form (i.e, z-scores)

m

A character string with lavaan model

CI

Add confidence intervals? Defaults to `FALSE`. If `TRUE`, For each factor score, a lower and upper bound of the confidence interval is created. For example, the lower bound of factor score `X` is `X_LB`, and the upper bound is `X_UB`.

p

confidence interval proportion. Defaults to 0.95

...

parameters passed to simstandardized_matrices

Value

data.frame with observed data and estimated factor scores

Examples

Run this code
# NOT RUN {
library(simstandard)
# lavaan model
m = "
X =~ 0.9 * X1 + 0.8 * X2 + 0.7 * X3
"

# Make data.frame for two cases
d <- data.frame(
  X1 = c(1.2, -1.2),
  X2 = c(1.5, -1.8),
  X3 = c(1.8, -1.1))

# Compute factor scores for two cases
add_factor_scores(d, m)
# }

Run the code above in your browser using DataLab