mediation
Assess whether a predictor's effect on an outcome operates through mediator variables, estimating direct, indirect, and total effects with bootstrap confidence intervals and optional covariates.
Instructions
Mediation analysis: does X affect Y through M? Builds and fits the path model, and reports the a, b, direct (c') and indirect paths with bootstrap confidence intervals - the standard Preacher-Hayes evidence for mediation. Supports several mediators at once (each gets its own indirect effect plus a total) and covariates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| m | Yes | Mediator column(s). | |
| x | Yes | Predictor column. | |
| y | Yes | Outcome column. | |
| data | Yes | Dataset name in the session. | |
| digits | No | Decimal places. | |
| save_as | No | Name for the fitted model in the session. | |
| bootstrap | No | Bootstrap samples for the indirect effect's interval; 5000 is conventional. | |
| conf_level | No | Confidence level. | |
| covariates | No | Columns to control for in both equations. |