
Bootstrap percentile CI for the indirect effect in simple mediation
Source:R/bsmed_native.R
Bsmed.RdIn the model M = i1 + a X and Y = i2 + cp X + b M, draws B resamples of the n cases with replacement, recomputes a times b in each, sorts the B estimates and takes the (B alpha/2)-th and (B (1 - alpha/2) + 1)-th order statistics as interval limits: for B = 1000 and alpha = .05 these are the 25th and 976th sorted values, the worked rule of Preacher and Hayes (2004, p. 722). The bootstrap point estimate is the mean of the resampled products; the sample-data product is reported alongside.
Value
List with estimate, boot_estimate, se,
ci_lower, ci_upper, a, b,
c_prime, B, n, conf_level,
method.
References
Preacher, K. J. and Hayes, A. F. (2004), SPSS and SAS procedures for estimating indirect effects in simple mediation models, Behavior Research Methods, Instruments, and Computers 36(4), 717-731, doi:10.3758/BF03206553, procedure p. 722. Shrout, P. E. and Bolger, N. (2002), Mediation in experimental and nonexperimental studies: New procedures and recommendations, Psychological Methods 7(4), 422-445, doi:10.1037/1082-989X.7.4.422.
Examples
Bsmed(x = c(2.5, 1.0, 3.5, 4.0, 2.0, 5.5, 3.0, 6.5), m = c(1, 2, 3, 4, 5, 6, 7, 8),
y = c(1, 2, 3, 4, 5, 6, 7, 8))
#> $estimate
#> [1] 0.9130435
#>
#> $boot_estimate
#> [1] 0.8500739
#>
#> $se
#> [1] 0.3386402
#>
#> $ci_lower
#> [1] 0.1016949
#>
#> $ci_upper
#> [1] 1.578947
#>
#> $a
#> [1] 0.9130435
#>
#> $b
#> [1] 1
#>
#> $c_prime
#> [1] 1.210143e-15
#>
#> $B
#> [1] 1000
#>
#> $n
#> [1] 8
#>
#> $conf_level
#> [1] 0.95
#>
#> $method
#> [1] "Preacher-Hayes (2004) bootstrap percentile CI for a*b"
#>