implied_scores {semfindr}R Documentation

Implied Scores of Observed Outcome Variables

Description

Gets a lavaan::lavaan() output and computes the implied scores of observed outcome variables.

Usage

implied_scores(fit, output = "matrix", skip_all_checks = FALSE)

Arguments

fit

The output from lavaan::lavaan(), such as lavaan::cfa() and lavaan::sem().

output

Output type. If "matrix", the default, the output will be combined to one matrix, with cases ordered as in the original dataset (after listwise deletion, if used). If "list", the a list of matrices is returned, even if the model has only one group.

skip_all_checks

If TRUE, skips all checks and allows users to run this function on any object of lavaan class. For users to experiment this and other functions on models not officially supported. Default is FALSE.

Details

The implied scores for each observed outcome variable (the y-variables or the endogenous variables) are simply computed in the same way the predicted scores in a linear regression model are computed.

Currently it supports only single-group and multiple-group path analysis models with only observed variables. (Support for multiple-group models available in 0.1.4.8 and later version).

Value

A matrix of the implied scores if output is "matrix". If output is "list", a list of matrices of the implied scores.

Author(s)

Shu Fai Cheung https://orcid.org/0000-0002-9871-9448.

Examples

library(lavaan)
dat <- pa_dat
# For illustration, select only the first 50 cases
dat <- dat[1:50, ]
# The model
mod <-
"
m1 ~ iv1 + iv2
dv ~ m1
"
# Fit the model
fit <- lavaan::sem(mod, dat)
summary(fit)

# Compute the implied scores for `m1` and `dv`
fit_implied_scores <- implied_scores(fit)
head(fit_implied_scores)



[Package semfindr version 0.1.8 Index]