condPlot: Draw conditional effect plot

Description Usage Arguments Examples

View source: R/condPlot.R

Description

Draw conditional effect plot

Usage

1
2
3
4
5
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 onject 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

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

cardiomoon/processR documentation built on Nov. 19, 2019, 2:29 p.m.