[{"data":1,"prerenderedAt":993},["ShallowReactive",2],{"content-query-iJYZPlFRau":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"heading":10,"prompt":11,"tags":15,"files":17,"nav":6,"presets":18,"gallery":36,"body":38,"_type":986,"_id":987,"_source":988,"_file":989,"_stem":990,"_extension":991,"sitemap":992},"/tools/mediation-analysis","tools",false,"","Mediation Analysis Calculator","Run mediation analysis online from Excel or CSV data. Estimate direct and indirect effects with bootstrap confidence intervals using AI.","Mediation Analysis",{"prefix":12,"label":13,"placeholder":14},"Run mediation analysis","Describe the predictor, mediator, and outcome variables","e.g. X = stress, M = sleep quality, Y = health outcome; bootstrap indirect effect with 5000 samples; 95% CI; path diagram with a, b, c, c' coefficients",[16],"statistics",true,[19,25,31],{"label":20,"prompt":21,"dataset_url":22,"dataset_title":23,"dataset_citation":24},"SES → Health via Stress","Mediation analysis: X = socioeconomic status, M = perceived stress, Y = health outcomes; bootstrap indirect effect with 5000 samples; 95% CI; path diagram with all coefficients; test full vs partial mediation","https://data.cdc.gov/api/views/iuq5-y9ct/rows.csv?accessType=DOWNLOAD","NHANES Mental Health Assessment","CDC",{"label":26,"prompt":27,"dataset_url":28,"dataset_title":29,"dataset_citation":30},"Education → Income via Skills","Mediation: X = years of education, M = skill index, Y = income; bootstrap 5000 reps; indirect effect with 95% percentile CI; proportion of total effect mediated; path diagram","https://ourworldindata.org/grapher/mean-years-of-schooling-long-run.csv","Mean Years of Schooling","Our World in Data",{"label":32,"prompt":33,"dataset_url":34,"dataset_title":35,"dataset_citation":30},"GDP → Life Satisfaction via Health","Mediation analysis: X = GDP per capita, M = life expectancy, Y = life satisfaction; bootstrap indirect effect; test whether health mediates the GDP-wellbeing relationship; path diagram and proportion mediated","https://ourworldindata.org/grapher/happiness-cantril-ladder.csv","Self-Reported Life Satisfaction (Cantril Ladder)",[37],"/img/tools/mediation-analysis.png",{"type":39,"children":40,"toc":975},"root",[41,50,111,116,142,148,205,211,406,411,417,567,573,730,736,804,810,847,853,877,912,937],{"type":42,"tag":43,"props":44,"children":46},"element","h2",{"id":45},"what-is-mediation-analysis",[47],{"type":48,"value":49},"text","What Is Mediation Analysis?",{"type":42,"tag":51,"props":52,"children":53},"p",{},[54,60,62,67,69,74,76,81,83,88,90,95,97,102,104,109],{"type":42,"tag":55,"props":56,"children":57},"strong",{},[58],{"type":48,"value":59},"Mediation analysis",{"type":48,"value":61}," tests whether the effect of an independent variable X on an outcome Y operates ",{"type":42,"tag":55,"props":63,"children":64},{},[65],{"type":48,"value":66},"through",{"type":48,"value":68}," an intermediate variable M (the mediator). Rather than simply asking \"does X affect Y?\", mediation asks \"how does X affect Y — what is the mechanism?\" The total effect of X on Y is decomposed into: the ",{"type":42,"tag":55,"props":70,"children":71},{},[72],{"type":48,"value":73},"indirect effect",{"type":48,"value":75}," (X → M → Y, the part that flows through the mediator) and the ",{"type":42,"tag":55,"props":77,"children":78},{},[79],{"type":48,"value":80},"direct effect",{"type":48,"value":82}," (X → Y after accounting for M). The indirect effect is quantified as the product of path ",{"type":42,"tag":55,"props":84,"children":85},{},[86],{"type":48,"value":87},"a",{"type":48,"value":89}," (X → M) and path ",{"type":42,"tag":55,"props":91,"children":92},{},[93],{"type":48,"value":94},"b",{"type":48,"value":96}," (M → Y controlling X), written as a×b. ",{"type":42,"tag":55,"props":98,"children":99},{},[100],{"type":48,"value":101},"Complete mediation",{"type":48,"value":103}," occurs when the direct effect (c') is zero after including the mediator — all of X's effect on Y goes through M. ",{"type":42,"tag":55,"props":105,"children":106},{},[107],{"type":48,"value":108},"Partial mediation",{"type":48,"value":110}," occurs when both the indirect and direct effects are significant.",{"type":42,"tag":51,"props":112,"children":113},{},[114],{"type":48,"value":115},"The classic example from social psychology: socioeconomic status (X) predicts depression (Y). A mediation analysis reveals that SES affects depression largely through perceived stress (M) — lower SES → higher perceived stress → worse depression. The path coefficients show: a = −0.41 (lower SES → more stress), b = 0.52 (more stress → more depression), c' = −0.12 (small direct effect of SES on depression after controlling stress). The indirect effect a×b = −0.21 accounts for 64% of the total effect — stress mediates most of the SES-depression relationship.",{"type":42,"tag":51,"props":117,"children":118},{},[119,121,126,128,133,135,140],{"type":48,"value":120},"Mediation analysis requires careful attention to causal inference. The path model implicitly assumes a ",{"type":42,"tag":55,"props":122,"children":123},{},[124],{"type":48,"value":125},"causal ordering",{"type":48,"value":127},": X causes M, which causes Y, and there are no unmeasured confounders of the M → Y path. These are assumptions about the data-generating process that cannot be verified from the data alone — they must be justified by theory, temporal ordering, or experimental manipulation. ",{"type":42,"tag":55,"props":129,"children":130},{},[131],{"type":48,"value":132},"Bootstrap resampling",{"type":48,"value":134}," (rather than the older Sobel test) is the gold standard for testing the indirect effect because the sampling distribution of a×b is typically non-normal, and bootstrap confidence intervals correctly capture its asymmetry. The ",{"type":42,"tag":55,"props":136,"children":137},{},[138],{"type":48,"value":139},"percentile bootstrap CI",{"type":48,"value":141}," (5000+ resamples) is the recommended default; if the CI excludes zero, the indirect effect is statistically significant.",{"type":42,"tag":43,"props":143,"children":145},{"id":144},"how-it-works",[146],{"type":48,"value":147},"How It Works",{"type":42,"tag":149,"props":150,"children":151},"ol",{},[152,163,179],{"type":42,"tag":153,"props":154,"children":155},"li",{},[156,161],{"type":42,"tag":55,"props":157,"children":158},{},[159],{"type":48,"value":160},"Upload your data",{"type":48,"value":162}," — provide a CSV or Excel file with one column each for the predictor (X), mediator (M), and outcome (Y). Optional covariates can be included as additional columns to control for confounders.",{"type":42,"tag":153,"props":164,"children":165},{},[166,171,173],{"type":42,"tag":55,"props":167,"children":168},{},[169],{"type":48,"value":170},"Describe the analysis",{"type":48,"value":172}," — e.g. ",{"type":42,"tag":174,"props":175,"children":176},"em",{},[177],{"type":48,"value":178},"\"X = stress_score, M = sleep_hours, Y = health_index; bootstrap indirect effect with 5000 samples; 95% percentile CI; path diagram; proportion of total effect mediated\"",{"type":42,"tag":153,"props":180,"children":181},{},[182,187,189,195,197,203],{"type":42,"tag":55,"props":183,"children":184},{},[185],{"type":48,"value":186},"Get full results",{"type":48,"value":188}," — the AI writes Python code using ",{"type":42,"tag":87,"props":190,"children":192},{"href":191},"https://www.statsmodels.org/",[193],{"type":48,"value":194},"statsmodels",{"type":48,"value":196}," and ",{"type":42,"tag":87,"props":198,"children":200},{"href":199},"https://plotly.com/python/",[201],{"type":48,"value":202},"Plotly",{"type":48,"value":204}," to estimate path coefficients via OLS regression, run percentile bootstrap to obtain the indirect effect CI, and produce the path diagram and bootstrap distribution plot",{"type":42,"tag":43,"props":206,"children":208},{"id":207},"required-data-format",[209],{"type":48,"value":210},"Required Data Format",{"type":42,"tag":212,"props":213,"children":214},"table",{},[215,239],{"type":42,"tag":216,"props":217,"children":218},"thead",{},[219],{"type":42,"tag":220,"props":221,"children":222},"tr",{},[223,229,234],{"type":42,"tag":224,"props":225,"children":226},"th",{},[227],{"type":48,"value":228},"Column",{"type":42,"tag":224,"props":230,"children":231},{},[232],{"type":48,"value":233},"Description",{"type":42,"tag":224,"props":235,"children":236},{},[237],{"type":48,"value":238},"Example",{"type":42,"tag":240,"props":241,"children":242},"tbody",{},[243,286,326,366],{"type":42,"tag":220,"props":244,"children":245},{},[246,257,262],{"type":42,"tag":247,"props":248,"children":249},"td",{},[250],{"type":42,"tag":251,"props":252,"children":254},"code",{"className":253},[],[255],{"type":48,"value":256},"X",{"type":42,"tag":247,"props":258,"children":259},{},[260],{"type":48,"value":261},"Predictor / independent variable",{"type":42,"tag":247,"props":263,"children":264},{},[265,271,273,279,280],{"type":42,"tag":251,"props":266,"children":268},{"className":267},[],[269],{"type":48,"value":270},"stress_score",{"type":48,"value":272},", ",{"type":42,"tag":251,"props":274,"children":276},{"className":275},[],[277],{"type":48,"value":278},"dose",{"type":48,"value":272},{"type":42,"tag":251,"props":281,"children":283},{"className":282},[],[284],{"type":48,"value":285},"SES",{"type":42,"tag":220,"props":287,"children":288},{},[289,298,303],{"type":42,"tag":247,"props":290,"children":291},{},[292],{"type":42,"tag":251,"props":293,"children":295},{"className":294},[],[296],{"type":48,"value":297},"M",{"type":42,"tag":247,"props":299,"children":300},{},[301],{"type":48,"value":302},"Mediator variable",{"type":42,"tag":247,"props":304,"children":305},{},[306,312,313,319,320],{"type":42,"tag":251,"props":307,"children":309},{"className":308},[],[310],{"type":48,"value":311},"sleep_hours",{"type":48,"value":272},{"type":42,"tag":251,"props":314,"children":316},{"className":315},[],[317],{"type":48,"value":318},"cortisol",{"type":48,"value":272},{"type":42,"tag":251,"props":321,"children":323},{"className":322},[],[324],{"type":48,"value":325},"self_efficacy",{"type":42,"tag":220,"props":327,"children":328},{},[329,338,343],{"type":42,"tag":247,"props":330,"children":331},{},[332],{"type":42,"tag":251,"props":333,"children":335},{"className":334},[],[336],{"type":48,"value":337},"Y",{"type":42,"tag":247,"props":339,"children":340},{},[341],{"type":48,"value":342},"Outcome / dependent variable",{"type":42,"tag":247,"props":344,"children":345},{},[346,352,353,359,360],{"type":42,"tag":251,"props":347,"children":349},{"className":348},[],[350],{"type":48,"value":351},"health_index",{"type":48,"value":272},{"type":42,"tag":251,"props":354,"children":356},{"className":355},[],[357],{"type":48,"value":358},"performance",{"type":48,"value":272},{"type":42,"tag":251,"props":361,"children":363},{"className":362},[],[364],{"type":48,"value":365},"depression",{"type":42,"tag":220,"props":367,"children":368},{},[369,378,383],{"type":42,"tag":247,"props":370,"children":371},{},[372],{"type":42,"tag":251,"props":373,"children":375},{"className":374},[],[376],{"type":48,"value":377},"covariate",{"type":42,"tag":247,"props":379,"children":380},{},[381],{"type":48,"value":382},"Optional: control variables",{"type":42,"tag":247,"props":384,"children":385},{},[386,392,393,399,400],{"type":42,"tag":251,"props":387,"children":389},{"className":388},[],[390],{"type":48,"value":391},"age",{"type":48,"value":272},{"type":42,"tag":251,"props":394,"children":396},{"className":395},[],[397],{"type":48,"value":398},"sex",{"type":48,"value":272},{"type":42,"tag":251,"props":401,"children":403},{"className":402},[],[404],{"type":48,"value":405},"baseline",{"type":42,"tag":51,"props":407,"children":408},{},[409],{"type":48,"value":410},"Any column names work — describe them in your prompt. All variables should be numeric and continuous; for binary mediators or outcomes, mention that logistic regression should be used for the relevant path. With covariates, they are included as predictors in both the M and Y regressions.",{"type":42,"tag":43,"props":412,"children":414},{"id":413},"interpreting-the-results",[415],{"type":48,"value":416},"Interpreting the Results",{"type":42,"tag":212,"props":418,"children":419},{},[420,436],{"type":42,"tag":216,"props":421,"children":422},{},[423],{"type":42,"tag":220,"props":424,"children":425},{},[426,431],{"type":42,"tag":224,"props":427,"children":428},{},[429],{"type":48,"value":430},"Output",{"type":42,"tag":224,"props":432,"children":433},{},[434],{"type":48,"value":435},"What it means",{"type":42,"tag":240,"props":437,"children":438},{},[439,455,471,487,503,519,535,551],{"type":42,"tag":220,"props":440,"children":441},{},[442,450],{"type":42,"tag":247,"props":443,"children":444},{},[445],{"type":42,"tag":55,"props":446,"children":447},{},[448],{"type":48,"value":449},"Path a",{"type":42,"tag":247,"props":451,"children":452},{},[453],{"type":48,"value":454},"X → M coefficient — how strongly X predicts the mediator",{"type":42,"tag":220,"props":456,"children":457},{},[458,466],{"type":42,"tag":247,"props":459,"children":460},{},[461],{"type":42,"tag":55,"props":462,"children":463},{},[464],{"type":48,"value":465},"Path b",{"type":42,"tag":247,"props":467,"children":468},{},[469],{"type":48,"value":470},"M → Y coefficient (controlling X) — how strongly mediator predicts outcome",{"type":42,"tag":220,"props":472,"children":473},{},[474,482],{"type":42,"tag":247,"props":475,"children":476},{},[477],{"type":42,"tag":55,"props":478,"children":479},{},[480],{"type":48,"value":481},"Direct effect (c')",{"type":42,"tag":247,"props":483,"children":484},{},[485],{"type":48,"value":486},"X → Y coefficient after including M — X's effect not explained by M",{"type":42,"tag":220,"props":488,"children":489},{},[490,498],{"type":42,"tag":247,"props":491,"children":492},{},[493],{"type":42,"tag":55,"props":494,"children":495},{},[496],{"type":48,"value":497},"Total effect (c)",{"type":42,"tag":247,"props":499,"children":500},{},[501],{"type":48,"value":502},"X → Y without M in the model — c = c' + a×b",{"type":42,"tag":220,"props":504,"children":505},{},[506,514],{"type":42,"tag":247,"props":507,"children":508},{},[509],{"type":42,"tag":55,"props":510,"children":511},{},[512],{"type":48,"value":513},"Indirect effect (a×b)",{"type":42,"tag":247,"props":515,"children":516},{},[517],{"type":48,"value":518},"Effect of X on Y transmitted through M — the mediated portion",{"type":42,"tag":220,"props":520,"children":521},{},[522,530],{"type":42,"tag":247,"props":523,"children":524},{},[525],{"type":42,"tag":55,"props":526,"children":527},{},[528],{"type":48,"value":529},"95% Bootstrap CI",{"type":42,"tag":247,"props":531,"children":532},{},[533],{"type":48,"value":534},"Percentile CI for indirect effect — excludes zero = significant mediation",{"type":42,"tag":220,"props":536,"children":537},{},[538,546],{"type":42,"tag":247,"props":539,"children":540},{},[541],{"type":42,"tag":55,"props":542,"children":543},{},[544],{"type":48,"value":545},"Proportion mediated",{"type":42,"tag":247,"props":547,"children":548},{},[549],{"type":48,"value":550},"a×b / c — fraction of total effect explained by the mediator; only meaningful when c and a×b have the same sign",{"type":42,"tag":220,"props":552,"children":553},{},[554,562],{"type":42,"tag":247,"props":555,"children":556},{},[557],{"type":42,"tag":55,"props":558,"children":559},{},[560],{"type":48,"value":561},"Path diagram",{"type":42,"tag":247,"props":563,"children":564},{},[565],{"type":48,"value":566},"Visual summary of all paths with coefficients; arrows show hypothesized causal flow",{"type":42,"tag":43,"props":568,"children":570},{"id":569},"example-prompts",[571],{"type":48,"value":572},"Example Prompts",{"type":42,"tag":212,"props":574,"children":575},{},[576,592],{"type":42,"tag":216,"props":577,"children":578},{},[579],{"type":42,"tag":220,"props":580,"children":581},{},[582,587],{"type":42,"tag":224,"props":583,"children":584},{},[585],{"type":48,"value":586},"Scenario",{"type":42,"tag":224,"props":588,"children":589},{},[590],{"type":48,"value":591},"What to type",{"type":42,"tag":240,"props":593,"children":594},{},[595,612,629,646,663,679,696,713],{"type":42,"tag":220,"props":596,"children":597},{},[598,603],{"type":42,"tag":247,"props":599,"children":600},{},[601],{"type":48,"value":602},"Basic mediation",{"type":42,"tag":247,"props":604,"children":605},{},[606],{"type":42,"tag":251,"props":607,"children":609},{"className":608},[],[610],{"type":48,"value":611},"X = stress, M = sleep, Y = health; bootstrap indirect effect 5000 reps; 95% CI; path diagram",{"type":42,"tag":220,"props":613,"children":614},{},[615,620],{"type":42,"tag":247,"props":616,"children":617},{},[618],{"type":48,"value":619},"With covariates",{"type":42,"tag":247,"props":621,"children":622},{},[623],{"type":42,"tag":251,"props":624,"children":626},{"className":625},[],[627],{"type":48,"value":628},"mediation with covariates age and sex; include in both M and Y regressions; report adjusted path coefficients",{"type":42,"tag":220,"props":630,"children":631},{},[632,637],{"type":42,"tag":247,"props":633,"children":634},{},[635],{"type":48,"value":636},"Multiple mediators",{"type":42,"tag":247,"props":638,"children":639},{},[640],{"type":42,"tag":251,"props":641,"children":643},{"className":642},[],[644],{"type":48,"value":645},"parallel mediation with 3 mediators (M1=sleep, M2=exercise, M3=diet); indirect effect for each; compare specific indirect effects",{"type":42,"tag":220,"props":647,"children":648},{},[649,654],{"type":42,"tag":247,"props":650,"children":651},{},[652],{"type":48,"value":653},"Serial mediation",{"type":42,"tag":247,"props":655,"children":656},{},[657],{"type":42,"tag":251,"props":658,"children":660},{"className":659},[],[661],{"type":48,"value":662},"serial mediation: X → M1 → M2 → Y; indirect effect through sequential chain; bootstrap CI",{"type":42,"tag":220,"props":664,"children":665},{},[666,670],{"type":42,"tag":247,"props":667,"children":668},{},[669],{"type":48,"value":545},{"type":42,"tag":247,"props":671,"children":672},{},[673],{"type":42,"tag":251,"props":674,"children":676},{"className":675},[],[677],{"type":48,"value":678},"mediation analysis; report proportion of total effect mediated; test if direct effect becomes non-significant",{"type":42,"tag":220,"props":680,"children":681},{},[682,687],{"type":42,"tag":247,"props":683,"children":684},{},[685],{"type":48,"value":686},"Binary outcome",{"type":42,"tag":247,"props":688,"children":689},{},[690],{"type":42,"tag":251,"props":691,"children":693},{"className":692},[],[694],{"type":48,"value":695},"Y is binary (0/1); use logistic regression for Y path; odds-ratio scale indirect effect; bootstrap CI",{"type":42,"tag":220,"props":697,"children":698},{},[699,704],{"type":42,"tag":247,"props":700,"children":701},{},[702],{"type":48,"value":703},"Moderated mediation",{"type":42,"tag":247,"props":705,"children":706},{},[707],{"type":42,"tag":251,"props":708,"children":710},{"className":709},[],[711],{"type":48,"value":712},"test whether mediation effect varies by gender (moderator W); index of moderated mediation; conditional indirect effects",{"type":42,"tag":220,"props":714,"children":715},{},[716,721],{"type":42,"tag":247,"props":717,"children":718},{},[719],{"type":48,"value":720},"Sensitivity analysis",{"type":42,"tag":247,"props":722,"children":723},{},[724],{"type":42,"tag":251,"props":725,"children":727},{"className":726},[],[728],{"type":48,"value":729},"report E-value for indirect effect — minimum confounding strength needed to explain away the mediation",{"type":42,"tag":43,"props":731,"children":733},{"id":732},"assumptions-to-check",[734],{"type":48,"value":735},"Assumptions to Check",{"type":42,"tag":737,"props":738,"children":739},"ul",{},[740,750,767,777,787],{"type":42,"tag":153,"props":741,"children":742},{},[743,748],{"type":42,"tag":55,"props":744,"children":745},{},[746],{"type":48,"value":747},"Causal ordering",{"type":48,"value":749}," — mediation assumes X temporally or causally precedes M, which precedes Y; this cannot be verified statistically and must be justified by theory, study design (e.g., X measured before M), or prior literature; cross-sectional data with simultaneous measurement of X, M, and Y makes causal mediation claims tenuous",{"type":42,"tag":153,"props":751,"children":752},{},[753,758,760,765],{"type":42,"tag":55,"props":754,"children":755},{},[756],{"type":48,"value":757},"No unmeasured M → Y confounders",{"type":48,"value":759}," — the key identifying assumption for the indirect effect is that there are no unmeasured variables that confound the M → Y relationship; include known confounders as covariates in the Y regression; the ",{"type":42,"tag":55,"props":761,"children":762},{},[763],{"type":48,"value":764},"E-value",{"type":48,"value":766}," (sensitivity analysis) quantifies how strong an unmeasured confounder would need to be to explain away the indirect effect",{"type":42,"tag":153,"props":768,"children":769},{},[770,775],{"type":42,"tag":55,"props":771,"children":772},{},[773],{"type":48,"value":774},"No X → Y confounders",{"type":48,"value":776}," — the total and direct effects assume no unmeasured confounders between X and Y; in observational data, include known confounders; in experimental data where X is randomized, this assumption is satisfied",{"type":42,"tag":153,"props":778,"children":779},{},[780,785],{"type":42,"tag":55,"props":781,"children":782},{},[783],{"type":48,"value":784},"Linearity",{"type":48,"value":786}," — OLS-based mediation assumes linear relationships among X, M, and Y; inspect scatterplots and residual plots; for non-linear relationships, consider log-transforming skewed variables or using polynomial terms",{"type":42,"tag":153,"props":788,"children":789},{},[790,795,797,802],{"type":42,"tag":55,"props":791,"children":792},{},[793],{"type":48,"value":794},"No interaction between X and M",{"type":48,"value":796}," — standard mediation assumes the effect of M on Y is the same at all levels of X (no X×M interaction); test by adding an X×M interaction term to the Y regression; if significant, use ",{"type":42,"tag":55,"props":798,"children":799},{},[800],{"type":48,"value":801},"moderated mediation",{"type":48,"value":803}," instead",{"type":42,"tag":43,"props":805,"children":807},{"id":806},"related-tools",[808],{"type":48,"value":809},"Related Tools",{"type":42,"tag":51,"props":811,"children":812},{},[813,815,821,823,829,831,837,839,845],{"type":48,"value":814},"Use the ",{"type":42,"tag":87,"props":816,"children":818},{"href":817},"/tools/multiple-regression",[819],{"type":48,"value":820},"Multiple Regression",{"type":48,"value":822}," calculator to estimate the individual regression paths (a, b, c, c') separately — mediation analysis is a structured combination of regression equations. Use the ",{"type":42,"tag":87,"props":824,"children":826},{"href":825},"/tools/partial-correlation",[827],{"type":48,"value":828},"Partial Correlation Calculator",{"type":48,"value":830}," to examine whether the X-Y correlation shrinks when M is controlled — a large drop in partial correlation is informal evidence of mediation (though not a substitute for bootstrapped indirect effects). Use the ",{"type":42,"tag":87,"props":832,"children":834},{"href":833},"/tools/mixed-effects-model",[835],{"type":48,"value":836},"Linear Mixed Effects Model Calculator",{"type":48,"value":838}," when data are clustered or longitudinal and mediation is tested in a multilevel context — standard mediation assumes independent observations. Use the ",{"type":42,"tag":87,"props":840,"children":842},{"href":841},"/tools/factor-analysis",[843],{"type":48,"value":844},"Factor Analysis Calculator",{"type":48,"value":846}," if the mediator is a latent construct measured by multiple items — latent variable mediation (SEM) handles measurement error in M that inflates direct effects and deflates indirect effects in manifest-variable mediation.",{"type":42,"tag":43,"props":848,"children":850},{"id":849},"frequently-asked-questions",[851],{"type":48,"value":852},"Frequently Asked Questions",{"type":42,"tag":51,"props":854,"children":855},{},[856,861,863,868,870,875],{"type":42,"tag":55,"props":857,"children":858},{},[859],{"type":48,"value":860},"Why should I use bootstrap confidence intervals instead of the Sobel test?",{"type":48,"value":862},"\nThe ",{"type":42,"tag":55,"props":864,"children":865},{},[866],{"type":48,"value":867},"Sobel test",{"type":48,"value":869}," approximates the sampling distribution of a×b as normal, which is only valid in large samples with symmetric distributions of the paths a and b. In practice, the distribution of a×b is often right-skewed (especially with small samples or strong effects), and the Sobel test is too conservative — it underestimates significance. The ",{"type":42,"tag":55,"props":871,"children":872},{},[873],{"type":48,"value":874},"percentile bootstrap",{"type":48,"value":876}," makes no distributional assumptions: it directly resamples the data thousands of times, recomputes a×b each time, and uses the 2.5th and 97.5th percentiles of this empirical distribution as the CI. Simulations consistently show that bootstrap CIs have better coverage (closer to the nominal 95%) than the Sobel test, especially with n \u003C 200. Use 5000+ bootstrap resamples for stable CI estimates.",{"type":42,"tag":51,"props":878,"children":879},{},[880,885,890,892,896,898,903,905,910],{"type":42,"tag":55,"props":881,"children":882},{},[883],{"type":48,"value":884},"What is the difference between full and partial mediation?",{"type":42,"tag":55,"props":886,"children":887},{},[888],{"type":48,"value":889},"Full (complete) mediation",{"type":48,"value":891}," occurs when the direct effect c' is not significantly different from zero after including M in the model — all of X's effect on Y is explained by the mediator. ",{"type":42,"tag":55,"props":893,"children":894},{},[895],{"type":48,"value":108},{"type":48,"value":897}," occurs when both the indirect effect (a×b) and the direct effect (c') are significant — M explains some but not all of X's effect on Y. Note that Baron and Kenny's (1986) requirement of a significant total effect c as a prerequisite for mediation is outdated — the modern approach (Preacher & Hayes, 2008) tests the indirect effect directly via bootstrap, and mediation can exist even when c is non-significant (this can happen when indirect and direct effects have opposite signs and cancel each other out, called ",{"type":42,"tag":55,"props":899,"children":900},{},[901],{"type":48,"value":902},"inconsistent",{"type":48,"value":904}," or ",{"type":42,"tag":55,"props":906,"children":907},{},[908],{"type":48,"value":909},"suppressor",{"type":48,"value":911}," mediation).",{"type":42,"tag":51,"props":913,"children":914},{},[915,920,922,927,929,935],{"type":42,"tag":55,"props":916,"children":917},{},[918],{"type":48,"value":919},"How many observations do I need for reliable mediation analysis?",{"type":48,"value":921},"\nSimulation studies suggest ",{"type":42,"tag":55,"props":923,"children":924},{},[925],{"type":48,"value":926},"n ≥ 200",{"type":48,"value":928}," for stable bootstrap estimates of the indirect effect with typical effect sizes (a ≈ 0.3–0.5, b ≈ 0.3–0.5). With n \u003C 100, bootstrap CIs are wide and often include zero even when true mediation exists — insufficient power to detect the indirect effect. The power to detect mediation depends on the product a×b, not just the individual paths: two weak paths (a = 0.20, b = 0.20) require n ≈ 500+ to reliably detect the indirect effect of 0.04. Use a power calculator for mediation (e.g., the ",{"type":42,"tag":251,"props":930,"children":932},{"className":931},[],[933],{"type":48,"value":934},"pwr2ppl",{"type":48,"value":936}," R package or Monte Carlo power analysis) when planning sample sizes. When n \u003C 50 and mediation is the primary hypothesis, collect more data rather than relying on the bootstrap.",{"type":42,"tag":51,"props":938,"children":939},{},[940,945,947,952,954,959,961,966,968,973],{"type":42,"tag":55,"props":941,"children":942},{},[943],{"type":48,"value":944},"Can I run mediation with a binary X or Y?",{"type":48,"value":946},"\nYes, with modifications. If ",{"type":42,"tag":55,"props":948,"children":949},{},[950],{"type":48,"value":951},"X is binary",{"type":48,"value":953}," (e.g., treatment vs control), the standard OLS approach works fine — X is just treated as a 0/1 dummy variable. If ",{"type":42,"tag":55,"props":955,"children":956},{},[957],{"type":48,"value":958},"Y is binary",{"type":48,"value":960},", use logistic regression for the Y path (b and c') and interpret the indirect effect on the log-odds scale; bootstrap the indirect effect as usual. If ",{"type":42,"tag":55,"props":962,"children":963},{},[964],{"type":48,"value":965},"M is binary",{"type":48,"value":967},", use logistic regression for the M path (a) and express the indirect effect as the product of the log-odds ratio from path a and the OLS coefficient from path b — this is an approximation, and the fully causal interpretation requires additional assumptions. For binary M or Y, report the indirect effect on the standardized scale (using probit regression) or use the ",{"type":42,"tag":55,"props":969,"children":970},{},[971],{"type":48,"value":972},"product of coefficients",{"type":48,"value":974}," method with heteroscedasticity-robust standard errors.",{"title":7,"searchDepth":976,"depth":976,"links":977},2,[978,979,980,981,982,983,984,985],{"id":45,"depth":976,"text":49},{"id":144,"depth":976,"text":147},{"id":207,"depth":976,"text":210},{"id":413,"depth":976,"text":416},{"id":569,"depth":976,"text":572},{"id":732,"depth":976,"text":735},{"id":806,"depth":976,"text":809},{"id":849,"depth":976,"text":852},"markdown","content:tools:076.mediation-analysis.md","content","tools/076.mediation-analysis.md","tools/076.mediation-analysis","md",{"loc":4},1775502472559]