This repository contains the code and instructions for reproducing the following paper:
Klapwijk, E. T., Jongerling, J., Hoijtink, H., & Crone, E. (2024, July 9). Sample size estimation for task-related functional MRI studies using Bayesian updating. https://doi.org/10.31234/osf.io/cz32t
The following two Quarto Markdown files (*.qmd
) are the main files containing the code to reproduce the figures and tables:
-
figures-cohens_d.qmd
(Figure 1 and 2; Table 2) -
figures-correlation.qmd
(Figure 3 and 4; Table 2)
These files are rendered as hmtl pages containing all the individual and collected figures:
-
figures-cohens_d.html
-
figures-correlation.html
The individual .png files are saved in the following directories:
-
figures-cohens_d_files/figure-html/
-
figures-correlation_files/figure-html/
The analysis for this paper is implemented in the statistical programming language R. To reproduce the results, you will need installed on your computer the R software itself, optionally (but recommended) RStudio Desktop, and Quarto.
-
You can download this repository as a zip from from this URL: main.zip
-
Or you can clone the repository:
git clone [email protected]:eduardklap/sample-size-codecheck.git
Then:
-
open the
sample-size-codecheck.Rproj
file in RStudio -
make sure you have the following packages installed:
-
neuroUp
, you can runinstall.packages("neuroUp")
to install it-
this is the main package that was specifically developed for this paper
-
It also contains the 4 datasets used in the paper: You can run
?feedback
,?gambling
,?self_eval
, and?vicar_char
for more information about the data source
-
-
patchwork
, you can runinstall.packages("patchwork")
to install it- this package is used to combine the different plots into the figures as presented in the manuscript
-
-
Finally, open
figures-cohens_d.qmd
and click Render to produce the html file and the individual png files (figures-cohens_d_files/
), or runquarto render figures-cohens_d.qmd
in the RStudio Terminal.- Runtime note: due to the number of permutations (1000) used in the paper, it might take some time to run the whole document (e.g., on a 4 core 32GB CPU virtual machine, it took 2.5 hrs to render
figures-cohens_d.qmd
and 1 hr to renderfigures-correlations.qmd
)
- Runtime note: due to the number of permutations (1000) used in the paper, it might take some time to run the whole document (e.g., on a 4 core 32GB CPU virtual machine, it took 2.5 hrs to render
-
Do the same for the correlational analysis: open
figures-correlations.qmd
and click Render to produce the html file and the individual png files (figures-correlations_files/
), or runquarto render figures-correlations.qmd
in the RStudio Terminal. -
If you do not have Quarto (or RStudio) installed, another (much less convenient) way to reproduce the analyses would be to run the individual code blocks as displayed in the .qmd (and .html) files subsequently in R.