modsem_pi {modsem}R Documentation

Interaction between latent variables using product indicators

Description

modsem_pi is a function for estimating interaction effects between latent variables, in structural equation models (SEMs), using product indicators. Methods for estimating interaction effects in SEM's can basically be split into two frameworks: 1. Product Indicator based approaches ("dblcent", "rca", "uca", "ca", "pind"), and 2. Distributionally based approaches ("lms", "qml"). modsem_pi() is essentially a just a fancy wrapper for lavaan::sem() which generates the necessary syntax, and variables for the estimation of models with latent product indicators. use 'default_settings_pi()' to get the default settings for the different methods.

Usage

modsem_pi(
  model.syntax = NULL,
  data = NULL,
  method = "dblcent",
  match = NULL,
  standardize.data = FALSE,
  center.data = FALSE,
  first.loading.fixed = TRUE,
  center.before = NULL,
  center.after = NULL,
  residuals.prods = NULL,
  residual.cov.syntax = NULL,
  constrained.prod.mean = NULL,
  constrained.loadings = NULL,
  constrained.var = NULL,
  constrained.res.cov.method = NULL,
  auto.scale = "none",
  auto.center = "none",
  estimator = "ML",
  group = NULL,
  run = TRUE,
  ...
)

Arguments

model.syntax

lavaan syntax

data

dataframe

method

method to use: "rca" = residual centering approach (passed to lavaan), "uca" = unconstrained approach (passed to lavaan), "dblcent" = double centering approach (passed to lavaan), "pind" = prod ind approach, with no constraints or centering (passed to lavaan), "custom" = use parameters specified in the function call (passed to lavaan)

match

should the product indicators be created by using the match-strategy

standardize.data

should data be scaled before fitting model

center.data

should data be centered before fitting model

first.loading.fixed

Sould the first factorloading in the latent prod be fixed to one?

center.before

should inds in prods be centered before computing prods (overwritten by method, if method != NULL)

center.after

should ind prods be centered after they have been computed?

residuals.prods

should ind prods be centered using residuals (overwritten by method, if method != NULL)

residual.cov.syntax

should syntax for residual covariances be produced (overwritten by method, if method != NULL)

constrained.prod.mean

should syntax prod mean be produced (overwritten by method, if method != NULL)

constrained.loadings

should syntax for constrained loadings be produced (overwritten by method, if method != NULL)

constrained.var

should syntax for constrained variances be produced (overwritten by method, if method != NULL)

constrained.res.cov.method

method for constraining residual covariances

auto.scale

methods which should be scaled automatically (usually not useful)

auto.center

methods which should be centered automatically (usually not useful)

estimator

estimator to use in lavaan

group

group variable for multigroup analysis

run

should the model be run via lavaan, if FALSE only modified syntax and data is returned

...

arguments passed to other functions, e.g,. lavaan

Value

modsem object

Examples

library(modsem)
# For more examples check README and/or GitHub.
# One interaction
m1 <- '
  # Outer Model
  X =~ x1 + x2 +x3
  Y =~ y1 + y2 + y3
  Z =~ z1 + z2 + z3
  
  # Inner model
  Y ~ X + Z + X:Z 
'

# Double centering approach
est1 <- modsem_pi(m1, oneInt)
summary(est1)

## Not run: 
# The Constrained Approach 
est1Constrained <- modsem_pi(m1, oneInt, method = "ca")
summary(est1Constrained)

## End(Not run)

# Theory Of Planned Behavior
tpb <- ' 
# Outer Model (Based on Hagger et al., 2007)
  ATT =~ att1 + att2 + att3 + att4 + att5
  SN =~ sn1 + sn2
  PBC =~ pbc1 + pbc2 + pbc3
  INT =~ int1 + int2 + int3
  BEH =~ b1 + b2

# Inner Model (Based on Steinmetz et al., 2011)
  # Covariances
  ATT ~~ SN + PBC
  PBC ~~ SN 
  # Causal Relationsships
  INT ~ ATT + SN + PBC
  BEH ~ INT + PBC 
  BEH ~ INT:PBC  
'

# double centering approach
estTpb <- modsem_pi(tpb, data = TPB)
summary(estTpb)

## Not run: 
# The Constrained Approach 
estTpbConstrained <- modsem_pi(tpb, data = TPB, method = "ca")
summary(estTpbConstrained)

## End(Not run)

[Package modsem version 1.0.1 Index]