Skip to contents

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.

Usage

relcorr_single_item(syntax, data, choose = NULL)

Arguments

syntax

A character string containing lavaan model syntax. Must at least include the measurement relations (=~).

data

A data.frame, tibble or object coercible to a data frame that holds the raw observed indicators.

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 `syntax`.

Value

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

Details

The resulting object can be fed directly into modsem or lavaan::sem by supplying syntax = $syntax and data = $data.

Examples

if (FALSE) { # \dontrun{
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)
} # }