get_fs_int: Compute interaction indicators for tspa() function

View source: R/get_fs_int.R

get_fs_intR Documentation

Compute interaction indicators for tspa() function

Description

This function computes product indicators and the corresponding standard errors according to equation (3) in Hsiao et al. (2021). The double-mean-centering (DMC) strategy is applied in this function, where first-order indicators are mean-centered first and product indicators for latent interaction term(s) are mean-centered again (Lin et al., 2010)

Usage

get_fs_int(
  dat,
  fs_name,
  se_fs,
  loading_fs,
  lat_var = rep_len(1, length.out = length(fs_name)),
  model = NULL
)

Arguments

dat

A data frame containing first-order factor score indiactors with standard error.

fs_name

A vector indicating names of factor scores

se_fs

A vector indicating standard error of factor scores

loading_fs

A vector indicating model-implied loadings of factor scores

lat_var

A vector indicating latent variances

model

An optional string specifying the measurement model in lavaan syntax.

Value

A data frame of product indicators for interaction terms, with their loadings and standard errors.

References

Hsiao, Y.-Y., Kwok, O.-M., & Lai, M. H. C. (2021). Modeling measurement errors of the exogenous composites from congeneric measures in interaction models. Structural Equation Modeling: A Multidisciplinary Journal, 28(2), 250–260. https://doi.org/10.1080/10705511.2020.1782206

Examples

library(lavaan)
fs1 <- get_fs(HolzingerSwineford1939,
              model = "visual  =~ x1 + x2 + x3",
              std.lv = TRUE)
fs2 <- get_fs(HolzingerSwineford1939,
              model = "textual =~ x4 + x5 + x6",
              std.lv = TRUE)
fs_dat <- cbind(fs1, fs2)
fs_dat2 <- get_fs_int(fs_dat,
  fs_name = c("fs_visual", "fs_textual"),
  se_fs = c("fs_visual_se", "fs_textual_se"),
  loading_fs = c("visual_by_fs_visual",
                 "textual_by_fs_textual")
)
head(fs_dat2[c("fs_visual", "fs_textual", "fs_visual:fs_textual",
               "fs_visual:fs_textual_se", "fs_visual:fs_textual_ld")])

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