moderation.slopes: calculates slopes and intercepts for a moderation and plots a...

Description Usage Arguments Value See Also Examples

Description

calculates the slopes and intercepts for a simple moderation analysis from a lm

Usage

1
moderation.slopes(mod, zsd = 1, mod_name = "Moderator", ...)

Arguments

mod

the result of a moderation done like this: lm(y~x*z), so that you have one predictor x and one moderator z

zsd

the standard deviation of z to calculate the slopes

...

Parameter for plot (xlab, ylab, main etc.)

Value

moderation

See Also

lm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(crime_data)
attach(crime_data)
#crime <- scale(crime)
poverty <- scale(poverty) #poverty-mean(poverty, na.rm=T)
pcths <- scale(pcths) #pcths-mean(pcths, na.rm=T)
zz <- xm*zm
mod <- lm(crime~poverty*pcths)
summary(mod)
moderation.slopes(mod, ylab="crime rate", mod_name = "Highschool pct", xlab="poverty")
detach(crime_data)

lillion/emittr documentation built on May 10, 2020, 7:23 a.m.