slopeDif: Conduct a slope difference test for three-way interaction...

Description Usage Arguments Value Examples

View source: R/slopeDif.R

Description

Calculates the expected value of the outcome variable (Y) at all combinations of high and low values (+/- 1SD) of X, Z, and W. Additionally, this function calculates the slope differences between all slope pairs.

Usage

1
slopeDif(x, )

Arguments

x

An object of class "lmerMod". The result of an lmer() function with a random intercept.

ZWithin

Logical. Required for all types. If TRUE, variable Z is simulated as a within-cluster variable. If FALSE, variable Z is simulated as a between-cluster variable.

WWithin

Logical. Required for all types. If TRUE, variable W is simulated as a within-cluster variable. If FALSE, variable W is simulated as a between-cluster variable.

Value

An object of class "slopetest" with the following components:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(mixedPowerSim)
library(lme4)

nCluster <- 20
nObs <- 15
db0 <- .1
db1 <- .1
db2 <- .1
db3 <- .1
db4 <- .1
db5 <- .1
db6 <- .1
db7 <- .1
SDb0 <- 1
SDresid <- 5

simDat <- simMixedXYZ(nCluster = nCluster, nObs = nObs,
 db0 = db0, db1 = db1, db2 = db2,
 db3 = db3, db4 = db4, db5 = db5, db6 = db6, db7 = db7,
 SDb0 = SDb0, SDresid = SDresid, XWithin = TRUE, ZWithin = FALSE, WWithin = TRUE)

 mod <- lmer(Y~X * Z * W + (1|Cluster), data = simDat$simulatedData)

 slopeDif(mod)

RobertGM111/mixedPowerSim documentation built on Jan. 19, 2021, 12:34 a.m.