Skip to content

update Moderation example to best practice and v4 #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Mar 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a35fddb
create truncated regression example
drbenvincent Jan 24, 2021
bc3d659
delete truncated regression example from main branch
drbenvincent Jan 25, 2021
3aba79b
Merge branch 'pymc-devs:main' into main
drbenvincent Jun 30, 2021
d84d852
create truncated regression example
drbenvincent Jan 24, 2021
d3dabca
delete truncated regression example from main branch
drbenvincent Jan 25, 2021
664ab97
create truncated regression example
drbenvincent Jan 24, 2021
cc6693f
delete truncated regression example from main branch
drbenvincent Jan 25, 2021
612abc4
Merge branch 'main' of https://github.com/drbenvincent/pymc-examples
Feb 1, 2022
f0812aa
Merge branch 'main' of https://github.com/drbenvincent/pymc-examples
Feb 8, 2022
7372a46
Merge remote-tracking branch 'upstream/main' into main
Feb 8, 2022
22c9935
Merge remote-tracking branch 'upstream/main'
Feb 18, 2022
89c5af5
Merge remote-tracking branch 'upstream/main'
Mar 20, 2022
8a6d24d
start the update of moderation analysis notebook
Mar 20, 2022
3450309
bring back target_accept to resolve divergences
Mar 20, 2022
b7bb041
suggested updates
Mar 20, 2022
ba5aa58
add explanation to category
Mar 20, 2022
3a1a431
fix reference: article -> book
Mar 20, 2022
a89768d
Merge branch 'moderation-v4' of https://github.com/drbenvincent/pymc-…
Mar 20, 2022
a5e05da
fix a date to match up with references
Mar 20, 2022
7dfff33
attempt to add cross references between moderation and mediation note…
Mar 20, 2022
0a6b04a
remove pm. tags on mediation notebook while I'm here
Mar 20, 2022
f586eb8
fix notebook cross references
Mar 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/case_studies/mediation_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
"# Bayesian mediation analysis\n",
"\n",
":::{post} February, 2022\n",
":tags: mediation, path analysis, pymc3.ConstantData, pymc3.Deterministic, pymc3.HalfCauchy, pymc3.Model, pymc3.Normal, regression\n",
":tags: mediation, path analysis, regression\n",
":category: beginner\n",
":author: Benjamin T. Vincent\n",
":::\n",
"\n",
"This notebook covers Bayesian [mediation analysis](https://en.wikipedia.org/wiki/Mediation_(statistics) ). This is useful when we want to explore possible mediating pathways between a predictor and an outcome variable.\n",
"\n",
"It is important to note that the approach to mediation analysis has evolved over time. This notebook was heavily influenced by the approach of {cite:t}`hayes2017introduction` as set out in his textbook \"Introduction to Mediation, Moderation and Conditional Process Analysis.\""
"It is important to note that the approach to mediation analysis has evolved over time. This notebook was heavily influenced by the approach of {cite:t}`hayes2017introduction` as set out in his textbook \"Introduction to Mediation, Moderation and Conditional Process Analysis.\"\n",
"\n",
"Readers should be aware that mediation analysis is commonly confused with moderation analysis for which we have a separate example ({ref}`moderation_analysis`)."
]
},
{
Expand Down
568 changes: 281 additions & 287 deletions examples/case_studies/moderation_analysis.ipynb

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions examples/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ @article{ando2007bayesian
publisher = {Oxford University Press},
doi = {10.1093/biomet/asm017}
}
@article{bauer2005probing,
title = {Probing interactions in fixed and multilevel regression: Inferential and graphical techniques},
author = {Bauer, Daniel J and Curran, Patrick J},
journal = {Multivariate behavioral research},
volume = {40},
number = {3},
pages = {373--400},
year = {2005},
publisher = {Taylor \& Francis}
}
@book{breen1996regression,
title = {Regression models: Censored, sample selected, or truncated data},
author = {Breen, Richard and others},
Expand Down Expand Up @@ -117,6 +127,26 @@ @misc{hogg2010data
archiveprefix = {arXiv},
primaryclass = {astro-ph.IM}
}
@article{iacobucci2016mean,
title = {Mean centering helps alleviate ``micro'' but not ``macro'' multicollinearity},
author = {Iacobucci, Dawn and Schneider, Matthew J and Popovich, Deidre L and Bakamitsos, Georgios A},
journal = {Behavior research methods},
volume = {48},
number = {4},
pages = {1308--1317},
year = {2016},
publisher = {Springer}
}
@article{iacobucci2017mean,
title = {Mean centering, multicollinearity, and moderators in multiple regression: The reconciliation redux},
author = {Iacobucci, Dawn and Schneider, Matthew J and Popovich, Deidre L and Bakamitsos, Georgios A},
journal = {Behavior research methods},
volume = {49},
number = {1},
pages = {403--404},
year = {2017},
publisher = {Springer}
}
@book{ivezić2014astroMLtext,
author = {\v{Z}eljko Ivezi\'{c} and Andrew J. Connolly and Jacob T. VanderPlas and Alexander Gray},
doi = {10.1515/9781400848911},
Expand Down Expand Up @@ -187,6 +217,12 @@ @article{kruschke2013
title = {Bayesian estimation supersedes the t test.},
journal = {Journal of Experimental Psychology: General}
}
@book{kruschke2014doing,
title = {Doing Bayesian data analysis: A tutorial with R, JAGS, and Stan},
author = {Kruschke, John},
year = {2014},
publisher = {Academic Press}
}
@misc{kucukelbir2015automatic,
title = {Automatic Variational Inference in Stan},
author = {Alp Kucukelbir and Rajesh Ranganath and Andrew Gelman and David M. Blei},
Expand Down Expand Up @@ -218,6 +254,16 @@ @book{martin2021bayesian
publisher = {Chapman and Hall/CRC},
doi = {10.1201/9781003019169}
}
@article{mcclelland2017multicollinearity,
title = {Multicollinearity is a red herring in the search for moderator variables: A guide to interpreting moderated multiple regression models and a critique of Iacobucci, Schneider, Popovich, and Bakamitsos (2016)},
author = {McClelland, Gary H and Irwin, Julie R and Disatnik, David and Sivan, Liron},
journal = {Behavior research methods},
volume = {49},
number = {1},
pages = {394--402},
year = {2017},
publisher = {Springer}
}
@book{mcelreath2018statistical,
title = {Statistical rethinking: A Bayesian course with examples in R and Stan},
author = {McElreath, Richard},
Expand Down Expand Up @@ -294,6 +340,16 @@ @article{silver2016masteringgo
year = {2016},
url = {https://doi.org/10.1038/nature16961}
}
@article{spiller2013spotlights,
title = {Spotlights, floodlights, and the magic number zero: Simple effects tests in moderated regression},
author = {Spiller, Stephen A and Fitzsimons, Gavan J and Lynch Jr, John G and McClelland, Gary H},
journal = {Journal of marketing research},
volume = {50},
number = {2},
pages = {277--288},
year = {2013},
publisher = {SAGE Publications Sage CA: Los Angeles, CA}
}
@misc{szegedy2014going,
title = {Going Deeper with Convolutions},
author = {Christian Szegedy and Wei Liu and Yangqing Jia and Pierre Sermanet and Scott Reed and Dragomir Anguelov and Dumitru Erhan and Vincent Vanhoucke and Andrew Rabinovich},
Expand All @@ -302,6 +358,12 @@ @misc{szegedy2014going
archiveprefix = {arXiv},
primaryclass = {cs.CV}
}
@online{vandenbergSPSS,
author = {van den Berg, R. G},
title = {SPSS Moderation Regression Tutorial},
url = {https://www.spss-tutorials.com/spss-regression-with-moderation-interaction-effect/},
urldate = {2022-03-20}
}
@inproceedings{vanderplas2012astroML,
author = {{Vanderplas}, J.T. and {Connolly}, A.J. and {Ivezi{\'c}}, {\v Z}. and {Gray}, A.},
booktitle = {Conference on Intelligent Data Understanding (CIDU)},
Expand Down Expand Up @@ -330,3 +392,13 @@ @article{yuan2009bayesian
year = {2009},
publisher = {American Psychological Association}
}
@article{zhang2017moderation,
title = {Moderation analysis with missing data in the predictors.},
author = {Zhang, Qian and Wang, Lijuan},
journal = {Psychological methods},
volume = {22},
number = {4},
pages = {649},
year = {2017},
publisher = {American Psychological Association}
}
4 changes: 3 additions & 1 deletion myst_nbs/case_studies/mediation_analysis.myst.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ kernelspec:
# Bayesian mediation analysis

:::{post} February, 2022
:tags: mediation, path analysis, pymc3.ConstantData, pymc3.Deterministic, pymc3.HalfCauchy, pymc3.Model, pymc3.Normal, regression
:tags: mediation, path analysis, regression
:category: beginner
:author: Benjamin T. Vincent
:::
Expand All @@ -24,6 +24,8 @@ This notebook covers Bayesian [mediation analysis](https://en.wikipedia.org/wiki

It is important to note that the approach to mediation analysis has evolved over time. This notebook was heavily influenced by the approach of {cite:t}`hayes2017introduction` as set out in his textbook "Introduction to Mediation, Moderation and Conditional Process Analysis."

Readers should be aware that mediation analysis is commonly confused with moderation analysis for which we have a separate example ({ref}`moderation_analysis`).

```{code-cell} ipython3
import arviz as az
import matplotlib.pyplot as plt
Expand Down
Loading