Statistical mediation allows researchers to investigate potential causal e
ects of experimental manipulations through intervening variables. Although
mediation is common in certain areas of psychology, it is rarely applied in
cognitive psychology and neuroscience. One reason for the scarcity of
applications is that these areas commonly employ within- subjects designs,
and it is only recently that statistical mediation has been worked out
satisfactorily for such designs. Here, we draw attention to the importance
and ubiquity of mediational hypotheses in within-subjects designs, and we
present a free and open source so ware package for conducting Bayesian
within-subjects mediation analyses in the R programming environment. e so
ware package is easy to use and provides methods for preparing data for
multilevel mediation analysis, estimating the mediation model, and
summarizing and plotting the results. We use experimental data to
illustrate the practice and bene ts of within-subject mediation for theory
testing and comparison.