ml_dadas {multid} | R Documentation |
Predicting algebraic difference scores in multilevel model
Description
Decomposes difference score predictions to predictions of difference score components by probing simple effects at the levels of the binary moderator.
Usage
ml_dadas(
model,
predictor,
diff_var,
diff_var_values,
scaled_estimates = FALSE,
re_cov_test = FALSE,
var_boot_test = FALSE,
nsim = NULL,
level = 0.95,
seed = NULL,
abs_diff_test = 0
)
Arguments
model |
Multilevel model fitted with lmerTest. |
predictor |
Character string. Variable name of independent variable predicting difference score. |
diff_var |
Character string. A variable indicative of difference score components (two groups). |
diff_var_values |
Vector. Values of the component score groups in diff_var. |
scaled_estimates |
Logical. Are scaled estimates obtained? Does fit a reduced model for correct standard deviations. (Default FALSE) |
re_cov_test |
Logical. Significance test for random effect covariation? Does fit a reduced model without the correlation. (Default FALSE) |
var_boot_test |
Logical. Compare variance by lower-level groups at the upper-level in a reduced model with bootstrap? (Default FALSE) |
nsim |
Numeric. Number of bootstrap simulations. |
level |
Numeric. The confidence level required for the var_boot_test output (Default .95) |
seed |
Numeric. Seed number for bootstrap simulations. |
abs_diff_test |
Numeric. A value against which absolute difference between component score predictions is tested (Default 0). |
Value
dadas |
A data frame including main effect, interaction, regression coefficients for component scores, dadas, and comparison between interaction and main effect. |
scaled_estimates |
Scaled regression coefficients for difference score components and difference score. |
vpc_at_reduced |
Variance partition coefficients in the model without the predictor and interactions. |
re_cov_test |
Likelihood ratio significance test for random effect covariation. |
boot_var_diffs |
List of different variance bootstrap tests. |
Examples
## Not run:
set.seed(95332)
n1 <- 10 # groups
n2 <- 10 # observations per group
dat <- data.frame(
group = rep(c(LETTERS[1:n1]), each = n2),
w = sample(c(-0.5, 0.5), n1 * n2, replace = TRUE),
x = rep(sample(1:5, n1, replace = TRUE), each = n2),
y = sample(1:5, n1 * n2, replace = TRUE)
)
library(lmerTest)
fit <- lmerTest::lmer(y ~ x * w + (w | group),
data = dat
)
round(ml_dadas(fit,
predictor = "x",
diff_var = "w",
diff_var_values = c(0.5, -0.5)
)$dadas, 3)
## End(Not run)