condPlot: Draw conditional effect plot

View source: R/condPlot.R

condPlotR Documentation

Draw conditional effect plot

Description

Draw conditional effect plot

Usage

condPlot(
  fit,
  xmode = 1,
  pred = NULL,
  modx = NULL,
  pred.values = NULL,
  modx.values = NULL,
  labels = NULL,
  mode = 1,
  rangemode = 1,
  ypos = NULL,
  hjust = NULL,
  linecolor = "gray60",
  linetype = 2,
  linesize = 1,
  arrowsize = 1,
  digits = 3,
  depM = FALSE,
  ...
)

Arguments

fit

An object of class lm

xmode

integer. 1 or 2.

pred

name of predictor variable

modx

name of moderator variable

pred.values

Values of predictor variables

modx.values

Values of modifier variables

labels

labels of regression lines

mode

integer. one of 1:3.

rangemode

integer. 1 or 2

ypos

integer. label y position.

hjust

hjust of label

linecolor

name of color of vline and hline

linetype

linetype of arrow

linesize

size of regression line

arrowsize

size of arrow

digits

integer indicating the number of decimal places

depM

logical If true, label M instead of X

...

further arguments to be passed to add_lines

Examples

fit=lm(justify~frame*skeptic,data=disaster)
condPlot(fit,rangemode=2,xpos=0.7,labels=c("Climate change(X=1)","Natural causes(X=0)"))

condPlot(fit,mode=2,xpos=0.6)
condPlot(fit,mode=3,rangemode=2,xpos=0.5)
condPlot(fit,xmode=2)
condPlot(fit,xmode=2,mode=2)
condPlot(fit,xmode=2,mode=3)
fit=lm(mpg~vs*hp,data=mtcars)
condPlot(fit,rangemode=2,xpos=0.6)
condPlot(fit,mode=2,xpos=0.5)
condPlot(fit,mode=3,rangemode=2)
fit=lm(govact~negemot*age+posemot+ideology+sex,data=glbwarm)
condPlot(fit,xmode=2,hjust=c(-0.1,-0.1,1.1))
condPlot(fit,xmode=2,pred.values=c(30,70),hjust=c(-0.1,-0.1,1.1),xpos=0.5)
condPlot(fit,xmode=2,mode=2,pred.values=c(30,50,70),xpos=0.2)
condPlot(fit,xmode=2,mode=3,xpos=0.5,hjust=c(-0.1,-0.1,1.1))
condPlot(fit,xmode=2,modx.values=c(2,3,4),mode=3,xpos=0.6)


processR documentation built on Jan. 23, 2023, 5:44 p.m.