condPlotCat2: Draw direct and indirect effect plot

View source: R/condPlotCat2.R

condPlotCat2R Documentation

Draw direct and indirect effect plot

Description

Draw direct and indirect effect plot

Usage

condPlotCat2(
  labels = NULL,
  data = NULL,
  semfit,
  catlabels = NULL,
  digits = 3,
  add.point = FALSE,
  ...
)

Arguments

labels

list of variable labels

data

data.frame

semfit

An object of class lavaan

catlabels

labels for direct/indirect effects

digits

Integer indicating the number of decimal places

add.point

logical. Whether or not add points to the plot

...

further arguments to be passed to predict3d::add_lines()

Examples

library(lavaan)
labels=list(X="protest",W="sexism",M="respappr",Y="liking")
moderator=list(name="sexism",site=list(c("a","c")))
data1=addCatVars(protest,"protest",mode=3)
catlabels=c("Indirect: Protest\n   vs. No Protest",
      "Indirect: Collective\n       vs. Individual",
      "Direct: Protest\n vs. No Protest",
      "Direct: Collective\n      vs. Individual")
model=catMediation(X="protest",M="respappr",Y="liking",moderator=moderator,
       data=data1,maxylev=6,rangemode = 2)
semfit=sem(model=model,data=data1)
condPlotCat2(labels=labels,data=data1,semfit=semfit,catlabels=catlabels,
       xpos=c(0.7,0.3,0.3,0.7),add.point=TRUE)

cardiomoon/processR documentation built on April 20, 2023, 3:38 a.m.