Description Usage Arguments Value References Examples
Compute the moderated paths coefficients for analayses of moderated mediations.
1 | analyze_path(coefficients, moderations, mediations)
|
coefficients |
Tibble. Output of the function compute_coefficients. |
moderations |
Tibble. Output of the function retrieve_modval with option "allval" FALSE. |
mediations |
List. List of vectors specifying the paths, from the first independent variable to the last dependent variable through the moderators in order. |
A tibble gathering all (direct, indirect, and total) the moderated path coefficients.
Edwards, J. R., & Lambert, L. S. (2007). Methods for integrating moderation and mediation: a general analytical framework using moderated path analysis. Psychological Methods, 12(1), 1–22.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | # Prepare the specifications for subsequent analyses
library(dplyr)
library(tibble)
sample <- modestim::mm_edwards2007 %>%
mutate(
fbkc.x.cenc = fbkc * cenc,
satc.x.cenc = satc * cenc,
fbkc.x.gen = fbkc * gen,
satc.x.gen = satc * gen
)
moderations <- modestim::retrieve_modval(
sample,
moderators = c("gen","cenc"),
types = c("discrete","continuous"),
allval = FALSE
)
mediations <- list(
c("fbkc","satc","comc")
)
# Replicate Edwards and Lambert's 2007 analysis of moderated mediation with gender
specgen <- tibble::tibble(
sample = rep(list(sample),2),
formula = list(
as.formula("satc ~ fbkc + gen + fbkc.x.gen"),
as.formula("comc ~ satc + fbkc + gen + satc.x.gen + fbkc.x.gen")
),
method = "glm",
family = NA,
md_imputation = "deletion",
md_method = "deletion",
draws = 10,
size = NA,
cores = 2
)
coeffgen <- modestim::compute_coefficients(specgen)
pathanagen <- modestim::analyze_path(coeffgen, moderations, mediations)
# Replicate Edwards and Lambert's 2007 analysis of moderated mediation with centrality
speccenc <- tibble::tibble(
sample = rep(list(sample),2),
formula = list(
as.formula("satc ~ fbkc + cenc + fbkc.x.cenc"),
as.formula("comc ~ satc + fbkc + cenc + satc.x.cenc + fbkc.x.cenc")
),
method = "glm",
family = NA,
md_imputation = "deletion",
md_method = "deletion",
draws = 10,
size = NA,
cores = 2
)
coeffcenc <- modestim::compute_coefficients(speccenc)
pathanacenc <- modestim::analyze_path(coeffcenc, moderations, mediations)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.