Description Usage Arguments Value Examples
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.
1 | slopeDif(x, )
|
x |
An object of class "lmerMod". The result of an |
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. |
An object of class "slopetest" with the following components:
Expected_Y: A data frame with the expected values of Y at high and low values of X, Z, and W.
SlopeTests: A data frame representing slope tests as defined in Dawson and Richter (2006).
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.