View source: R/reliablity_single_item.R
relcorr_single_item | R Documentation |
Replace (some of) the first‑order latent variables in a lavaan measurement
model by single composite indicators whose error variances are fixed from
Cronbach's \alpha
. The function returns a modified lavaan model
syntax together with an augmented data set that contains the newly created
composite variables, so that you can fit the full SEM in a single step.
relcorr_single_item(
syntax,
data,
choose = NULL,
scale.corrected = TRUE,
warn.lav = TRUE
)
syntax |
A character string containing lavaan model syntax. Must at
least include the measurement relations ( |
data |
A |
choose |
Optional. Character vector with the names of the latent
variables you wish to replace by single indicators. Defaults to all
first‑order latent variables in |
scale.corrected |
Should reliability-corrected items be scale-corrected? If |
warn.lav |
Should warnings from |
The resulting object can be fed directly into modsem
or lavaan::sem
by supplying syntax = $syntax
and data = $data
.
An object of S3 class modsem_relcorr
(a named list) with elements:
syntax
Modified lavaan syntax string.
data
Data frame with additional composite indicator columns.
parTable
Parameter table corresponding to 'syntax'.
reliability
Named numeric vector of reliabilities (one per latent variable).
AVE
Named numeric vector with Average Variance Extracted values.
lVs
Character vector of latent variables that were corrected.
single.items
Character vector with names for the generated reliability corrected items
## Not run:
tpb_uk <- "
# Outer Model (Based on Hagger et al., 2007)
ATT =~ att3 + att2 + att1 + att4
SN =~ sn4 + sn2 + sn3 + sn1
PBC =~ pbc2 + pbc1 + pbc3 + pbc4
INT =~ int2 + int1 + int3 + int4
BEH =~ beh3 + beh2 + beh1 + beh4
# Inner Model (Based on Steinmetz et al., 2011)
INT ~ ATT + SN + PBC
BEH ~ INT + PBC
BEH ~ INT:PBC
"
corrected <- relcorr_single_item(syntax = tpb_uk, data = TPB_UK)
print(corrected)
syntax <- corrected$syntax
data <- corrected$data
est_dca <- modsem(syntax, data = data, method = "dblcent")
est_lms <- modsem(syntax, data = data, method="lms", nodes=32)
summary(est_lms)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.