condPlotCat2: Draw direct and indirect effect plot

Description Usage Arguments Examples

View source: R/condPlotCat2.R

Description

Draw direct and indirect effect plot

Usage

1
2
3
4
5
6
7
8
9
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 argumnets to be passed to predict3d::add_lines()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

processR documentation built on Jan. 7, 2021, 9:06 a.m.