The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(patchwork)library(readr)library(neuroUp)
Warning: package 'neuroUp' was built under R version 4.3.3
Read data from file and select complete cases:
In [2]:
# read data & select complete cases only (ignore NA)data_luna <-read_csv("data/luna_reward-learn_dev_BOLD.csv")
New names:
Rows: 275 Columns: 8
── Column specification
──────────────────────────────────────────────────────── Delimiter: "," chr
(1): sex dbl (7): ...1, lunaid, visitnum, age, beta, null, posrpe
ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
Specify the column types or set `show_col_types = FALSE` to quiet this message.
• `` -> `...1`
Set seed and create figure with Cohens’ d for the box:
In [3]:
# set seedset.seed(1234)# Estimate Cohen's dluna_cohen_fig <-estim_diff(data = data_luna,vars_of_interest =c("beta", "null"),sample_size =20:232, k =100, name ="Reward learning caudate")# plot figure 3aluna_cohen_fig$fig_cohens_d | luna_cohen_fig$fig_d_nozero
Set seed and create figure with correlations for the box:
In [4]:
# set seedset.seed(1234)# Estimate correlations between posrpe (parametric association between BOLD and reward prediction error) and ageluna_corr_fig <-estim_corr(data = data_luna,vars_of_interest =c("posrpe", "age"),sample_size =20:232, k =100, name ="Reward learning caudate corr. with age")# plot figure 3aluna_corr_fig$fig_corr | luna_corr_fig$fig_corr_nozero