Movatterモバイル変換


[0]ホーム

URL:


modsemLogo

R-CMD-checkTestsCRANPKGDOWN-BuildGitHub Clones

modsem is anR-package for estimatinginteraction (i.e., moderation) effects between latent variables instructural equation models (SEMs). See https://www.modsem.org for atutorial.

Installation

modsem is available onCRAN andGitHub, and can be installed as follows:

# From CRANinstall.packages("modsem")# Latest version from GitHubinstall.packages("devtools")devtools::install_github("kss2k/modsem",build_vignettes =TRUE)

Note: The package needs to be compiled from sourceonmacOS (if installing viaGitHub) andLinux. If you have issues installing the package onmacOS, you might need to install thegfortrancompiler. AC++ compiler is also required, but should beinstalled by default on most systems. See theR for macOs pagefor more information.

If you’re usingWindows, consider installingOpenBLAS in R for Windowsfor better perfmance. If you’re using aLinux distribution,consider installing theropenblaspackage

Methods/Approaches

There are a number of approaches for estimating interaction effectsin SEM. Inmodsem(), themethod = "method"argument allows you to choose which to use. Different approaches can becategorized into two groups: Product Indicator (PI) and DistributionAnalytic (DA) approaches.

Product Indicator (PI)Approaches:

Distribution Analytic (DA)Approaches

Examples

ElementaryInteraction Model (Kenny & Judd, 1984; Jaccard & Wan, 1995)
library(modsem)m1<-'  # Outer Model  X =~ x1 + x2 + x3  Y =~ y1 + y2 + y3  Z =~ z1 + z2 + z3  # Inner model  Y ~ X + Z + X:Z'# Double centering approachest1_dca<-modsem(m1, oneInt)summary(est1_dca)# Constrained approachest1_ca<-modsem(m1, oneInt,method ="ca")summary(est1_ca)# QML approachest1_qml<-modsem(m1, oneInt,method ="qml")summary(est1_qml,standardized =TRUE)# LMS approachest1_lms<-modsem(m1, oneInt,method ="lms")summary(est1_lms)

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)  INT ~ ATT + SN + PBC  BEH ~ INT + PBC  BEH ~ PBC:INT"# double centering approachest_tpb_dca<-modsem(tpb,data = TPB,method ="dblcent")summary(est_tpb_dca)# Constrained approach using Wrigths path tracing rules for generating# the appropriate constraintsest_tpb_ca<-modsem(tpb,data = TPB,method ="ca")summary(est_tpb_ca)# LMS approachest_tpb_lms<-modsem(tpb,data = TPB,method ="lms")summary(est_tpb_lms,standardized =TRUE)# QML approachest_tpb_qml<-modsem(tpb,data = TPB,method ="qml")summary(est_tpb_qml,standardized =TRUE)

Interactionsbetween two observed variables

est2<-modsem('y1 ~ x1 + z1 + x1:z1',data = oneInt,method ="dblcent")summary(est2)
Interactionbetween an obsereved and a latent variable
m3<-'  # Outer Model  X =~ x1 + x2 + x3  Y =~ y1 + y2 + y3  # Inner model  Y ~ X + z1 + X:z1'est3<-modsem(m3, oneInt,method ="dblcent",res.cov.method ="none")# res.cov.method = "simple" will lead# to an unidentifiable model. Instead we# constrain them to zerosummary(est3)

[8]ページ先頭

©2009-2025 Movatter.jp