R/mdt_within_index.R
add_index.within_participant_mediation.Rd
Adds the confidence interval for the index of
within-participant mediation to a model fitted with
mdt_within
or mdt_within_wide
.
# S3 method for within_participant_mediation
add_index(mediation_model, times = 5000, level = 0.05, ...)
A mediation model of class
"within_participant_mediation"
.
Number of simulations to use to compute the Monte Carlo indirect effect confidence interval.
Alpha threshold to use for the confidence interval.
Further arguments passed to or from other methods.
Indirect effect index for within-participant mediation uses \(a\) and \(b\) estimates and their standard error to compute the \(ab\) product distribution using Monte Carlo methods (see MacKinnon, Lockwood, & Williams, 2004).
MacKinnon, D. P., Lockwood, C. M., & Williams, J. (2004). Confidence Limits for the Indirect Effect: Distribution of the Product and Resampling Methods. Multivariate Behavioral Research, 39(1), 99-128. doi: 10.1207/s15327906mbr3901_4
## getting an indirect effect index
within_model <- mdt_within(data = dohle_siegrist,
IV = name,
DV = willingness,
M = hazardousness,
grouping = participant)
add_index(within_model)
#> Test of mediation (within-participant_mediation)
#> ==============================================
#>
#> Variables:
#>
#> - IV: name (difference: simple - complex)
#> - DV: willingness
#> - M: hazardousness
#>
#> Paths:
#>
#> ==== ============== ===== ======================
#> Path Point estimate SE APA
#> ==== ============== ===== ======================
#> a -0.800 0.258 t(21) = 3.10, p = .005
#> b -0.598 0.113 t(19) = 5.29, p < .001
#> c 0.564 0.193 t(21) = 2.92, p = .008
#> c' 0.085 0.158 t(19) = 0.54, p = .596
#> ==== ============== ===== ======================
#>
#> Indirect effect index:
#>
#> - type: Within-participant indirect effect
#> - point estimate: 0.479
#> - confidence interval:
#> - method: Monte Carlo (5000 iterations)
#> - level: 0.05
#> - CI: [0.165; 0.867]
#>
#> Fitted models:
#>
#> - 1 -> DV_diff
#> - 1 -> M_diff
#> - 1 + M_diff + M_mean -> DV_diff