Type: | Package |
Title: | Plan Sample Size for Task fMRI Research using Bayesian Updating |
Version: | 0.3.1 |
Description: | Calculate the precision in mean differences (raw or Cohen's D) and correlation coefficients for different sample sizes. Uses permutations of the collected functional magnetic resonance imaging (fMRI) region of interest data. Method described in Klapwijk, Jongerling, Hoijtink and Crone (2024) <doi:10.31234/osf.io/cz32t>. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Imports: | dplyr, rlang, ggplot2, psychometric, tibble, magrittr, bootstrap |
Suggests: | knitr, readr, rmarkdown, testthat (≥ 3.0.0), vdiffr |
Config/testthat/edition: | 3 |
Depends: | R (≥ 2.10) |
VignetteBuilder: | knitr |
URL: | https://eduardklap.github.io/neuroUp/, https://github.com/eduardklap/neuroUp |
BugReports: | https://github.com/eduardklap/neuroUp/issues |
Packaged: | 2024-08-23 13:23:08 UTC; eduardklapwijk |
Author: | Eduard Klapwijk |
Maintainer: | Eduard Klapwijk <et.klapwijk@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2024-08-28 08:20:05 UTC |
Pipe operator
Description
See magrittr::[\%>\%][magrittr::pipe]
for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling rhs(lhs)
.
Estimate correlations
Description
estim_corr
determines point estimate, SD and SE, 95% Credibility Intervals,
and interval width, for Pearson correlations for multiple sample sizes
Usage
estim_corr(data, vars_of_interest, sample_size, k = 50, name = "")
Arguments
data |
Dataframe with the data to be analyzed |
vars_of_interest |
Vector containing the names of the variables to be
correlated: |
sample_size |
The range of sample size to be used: |
k |
The number of permutations to be used for each sample size. Defaults
to |
name |
The title of the dataset or variables to be displayed with the
figure. Defaults to |
Value
-
tbl_select
returns atibble::tibble()
containing estimates of the Pearson correlation between two correlated variables with associated SD, SE, 95% CI, and width of the 95% CI (lower, upper) for five different sample sizes (starting with the minimum sample size, then 1/5th parts of the total dataset). -
fig_corr
returns a scatterplot where for the five different sample sizes, 10 out of the total number of HDCIs computed are displayed (in green). The average estimate with credible interval summarizing the total number of HDCIs for each sample size are plotted in orange -
fig_corr_nozero
returns a barplot where for each of the five sample sizes the proportion of permutations not containing zero is displayed -
tbl_total
returns atibble::tibble()
containing estimates of the Pearson correlation between two correlated variables with associated SD, SE, 95% CI, and width of the 95% CI (lower, upper) for all sample sizes, including the permutation number.
Examples
data_gambling <- gambling
estim_corr(data_gambling,
c("lnacc_self_winvsloss", "age"), 20:221,
10, "Gambling NAcc correlation with age")
Estimate differences (unstandardized and Cohen's d)
Description
estim_diff
determines point estimate, SD and SE, 95% Credibility Intervals,
and interval width, for both differences in raw means and Cohen's d's for
multiple sample sizes
Usage
estim_diff(data, vars_of_interest, sample_size, k = 50, name = "")
Arguments
data |
Dataframe with the data to be analyzed |
vars_of_interest |
Vector containing the names of the variables to be
compared on their means: |
sample_size |
The range of sample size to be used |
k |
The number of permutations to be used for each sample size. Defaults to 50 |
name |
The title of the dataset or variables to be displayed with the
figure. Defaults to |
Value
-
tbl_select
returns atibble::tibble()
containing estimates of the difference in raw means and of Cohen's d with associated SD, SE, 95% CI, and width of the 95% CI (lower, upper) for five different sample sizes (starting with the minimum sample size, then 1/5th parts of the total dataset). -
fig_diff
returns a scatterplot for the difference in raw means, where for the five different sample sizes, 10 out of the total number of HDCI's computed are displayed (in light blue). The average estimate with credible interval summarizing the total number of HDCIs for each sample size are plotted in reddish purple -
fig_nozero
returns a barplot where for each of the five sample sizes the proportion of permutations not containing zero is displayed for the difference in raw means -
fig_cohens_d
returns a scatterplot for Cohen's d, where for the five different sample sizes, 10 out of the total number of HDCI's computed are displayed (in light blue). The average estimate with credible interval summarizing the total number of HDCIs for each sample size are plotted in reddish purple -
fig_d_nozero
returns a barplot where for each of the five sample sizes the proportion of permutations not containing zero is displayed for Cohen's d -
tbl_total
returns atibble::tibble()
containing estimates of the difference in raw means and of Cohen's d with associated SD, SE, 95% CI, and width of the 95% CI (lower, upper) for all sample sizes, including the permutation number.
Examples
data_feedback <- feedback
estim_diff(data_feedback,
c("mfg_learning", "mfg_application"), 20:71,
10, "Feedback middle frontal gyrus")
Feedback task fMRI region of interest data
Description
A dataset containing the parameter estimates of the atlas-based middle frontal gyrus (Harvard-Oxford cortical atlas; thresholded at 50%; center-of-mass coordinates x = -4, y = 22, z = 43), ), with one value for the mean activation during learning and one value for the mean activation during application for all participants.
Usage
feedback
Format
A data frame with 271 rows and 4 variables:
- participant_id
unique id for every participant
- age
age in years (8.01-25.95)
- mfg_learning
parameter estimates for the middle frontal gyrus during the learning phase (-2.54-4.83)
- mfg_application
parameter estimates for the middle frontal gyrus during the application phase (-6.46-3.09)
Source
Peters, S., & Crone, E. A. (2017). Increased striatal activity in adolescence benefits learning. Nature Communications, 8(1), 1983. doi:10.1038/s41467-017-02174-z
Gambling task fMRI region of interest data
Description
A dataset containing the parameter estimates of the anatomical mask of the left nucleus accumbens (Harvard-Oxford subcortical atlas; thresholded at 40%; 28 voxels included), with one value for the mean activation during winning and one value for the mean activation during losing for all participants.
Usage
gambling
Format
A data frame with 221 rows and 5 variables:
- participant_id
unique id for every participant
- age
age in years (11.94-28.46)
- lnacc_self_win
parameter estimates for the left nucleas accumbens during winning (-2.78-3.41)
- lnacc_self_loss
parameter estimates for the left nucleas accumbens during losing (-3.84-3.28)
- lnacc_self_winvsloss
parameter estimates for the left nucleas accumbens for the contrast winning versus losing (-2.60-4.47)
Source
Schreuders, E., Braams, B. R., Blankenstein, N. E., Peper, J. S., Guroglu, B., & Crone, E. A. (2018). Contributions of reward sensitivity to ventral striatum activity across adolescence and early adulthood. Child development, 89(3), 797-810. doi:10.1111/cdev.13056
Self-evaluations task fMRI region of interest data
Description
A dataset containing the parameter estimates of the left medial prefrontal cortex (x = -6, y = 50, z = 4), with one value for the mean activation during self-evaluation and one value for the mean activation during the control condition for all participants.
Usage
self_eval
Format
A data frame with 149 rows and 4 variables:
- participant_id
unique id for every participant
- age
age in years (11.00-20.92)
- mpfc_self
parameter estimates for the left medial prefrontal cortex during self-evaluation (-2.82-4.97)
- mpfc_control
parameter estimates for the lmedial prefrontal cortex during the control condition (-7.17-3.50)
Source
van der Cruijsen, R., Blankenstein, N. E., Spaans, J. P., Peters, S., & Crone, E. A. (2023). Longitudinal self-concept development in adolescence. Social Cognitive and Affective Neuroscience, 18(1), nsac062. doi:10.1093/scan/nsac062
Vicarious Charity task fMRI region of interest data
Description
A dataset containing the parameter estimates from the anatomical mask of the left nucleus accumbens (Harvard-Oxford subcortical atlas; thresholded at 40%; center-of-mass coordinates x = -10, y = 12, z = -7; 28 voxels included), with one value for the mean activation during gaining for self and one value for the mean activation during no-gain for self and charity for all participants.
Usage
vicar_char
Format
A data frame with 156 rows and 4 variables:
- participant_id
unique id for every participant
- age
age in years (11.00-21.17)
- nacc_selfgain
parameter estimates for the left nucleus accumbens during gaining for self (-5.66-3.05)
- nacc_bothnogain
parameter estimates for the left nucleus accumbens during no-gain for self and charity (-6.44-2.97)
Source
Spaans, J., Peters, S., Becht, A., van der Cruijsen, R., van de Groep, S., & Crone, E. A. (2023). Longitudinal neural and behavioral trajectories of charity contributions across adolescence. Journal of Research on Adolescence, 33(2), 480-495. doi:10.1111/jora.12820