Intro
This is a starter file for your “Computational Notebook” script. This script be used to run analyses using the data file(s). This script should be separate from the “Prepare Data” file that is used for update the data file(s). Every time you run the “Computational Notebook” file with the exact same data, you should get the exact same findings (i.e., reproducibility). Thus, we keep the “Prepare Data script” separate from the “Computational Notebook” file so that you update the data only when you intend to.
This document is a Quarto Notebook, which is an example of a computational notebook. Best practices for using Markdown are in the Lab Wiki here: https://devpsylab.github.io/DataAnalysis/markdown.html#bestPractices. Steps for working with computational notebooks are located in the Lab Wiki here: https://devpsylab.github.io/DataAnalysis/markdown.html#computationalNotebook
This document is a Quarto Notebook. Quarto enables you to weave together content and executable code into a finished document. When you execute code within the notebook, the results appear beneath the code. This allows you to share your analyses and results with others so that they can see the results in line with the code for reproducibility. Make sure to have only one sentence per line. For more information on the value of computational notebooks, see the article titled “The Scientific Paper Is Obsolete”. To learn more about Quarto see https://quarto.org.
Preamble
Install Libraries
In [1]:
Load Libraries
In [2]:
Code
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.3 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Loading required package: showtextdb
Import Font for Figures
To use the fonts, download and install the fonts located here1: https://drive.google.com/drive/u/0/folders/1fqlrnEe7NFnWZoIrsHmr8ulDS4nhs-H3
Load Data
Specify Variables
Screening
Contacted to Screen
Refused Screen
Reasons People Refused the Screen
Eligible
Reasons for Ineligibility
Interested (Among Those Who were Eligible)
Reasons Eligible People Chose Not to Participate
Contacted to Enroll (Among Those Who Were Eligible and Interested)
Reasons Eligible and Interested People Were Not Contacted
Enrolled (Among Those Who Were Eligible, Interested, and Contacted)
Reasons Eligible and Interested People Were Not Enrolled
Consented (Among Those Who Were Eligible)
Reasons Enrolled People Were Not Consented
Recruitment Source
Among All of Those Screened
Among Those Who Consented
Tests of Systematic Differences Between Contacted (But Not Consented) and Consented
Describe the Sample
Sample Composition
Sex of the Participant
Race/Ethnicity of the Participant
Socioeconomic Status
Marital Status
Occupational Prestige
Educational Attainment
Duration of Procedures
Missingness
Extent of Missingness
Predictors
Outcome
Reasons for Missingness
Predictors
Outcome
Tests of Systematic Missingness
MCAR Test
Systematic Missingness of Predictors
Systematic Missingness of Outcome
Descriptive Statistics
Sample Size
Values
Frequencies
Histograms
Correlations
Bivariate Correlations
Correlation Matrices
Correlograms
Scatterplots
Scatterplot Matrix
Reliability
Internal Consistency
Inter-Rater Reliability
Cross-Time Stability Correlations
Analyses
Session Info
In [4]:
R version 4.5.3 (2026-03-11)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
time zone: UTC
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] showtext_0.9-8 showtextdb_3.0 sysfonts_0.8.9 lubridate_1.9.5
[5] forcats_1.0.1 stringr_1.6.0 dplyr_1.2.1 purrr_1.2.2
[9] readr_2.2.0 tidyr_1.3.2 tibble_3.3.1 ggplot2_4.0.3
[13] tidyverse_2.0.0 petersenlab_1.2.3
loaded via a namespace (and not attached):
[1] tidyselect_1.2.1 psych_2.6.3 viridisLite_0.4.3
[4] farver_2.1.2 S7_0.2.2 fastmap_1.2.0
[7] digest_0.6.39 rpart_4.1.24 timechange_0.4.0
[10] lifecycle_1.0.5 cluster_2.1.8.2 magrittr_2.0.5
[13] compiler_4.5.3 rlang_1.2.0 Hmisc_5.2-5
[16] tools_4.5.3 yaml_2.3.12 data.table_1.18.2.1
[19] knitr_1.51 htmlwidgets_1.6.4 mnormt_2.1.2
[22] plyr_1.8.9 RColorBrewer_1.1-3 foreign_0.8-91
[25] withr_3.0.2 nnet_7.3-20 grid_4.5.3
[28] stats4_4.5.3 lavaan_0.6-21 xtable_1.8-8
[31] colorspace_2.1-2 scales_1.4.0 MASS_7.3-65
[34] cli_3.6.6 mvtnorm_1.3-7 rmarkdown_2.31
[37] reformulas_0.4.4 generics_0.1.4 rstudioapi_0.18.0
[40] reshape2_1.4.5 tzdb_0.5.0 minqa_1.2.8
[43] DBI_1.3.0 splines_4.5.3 parallel_4.5.3
[46] base64enc_0.1-6 mitools_2.4 vctrs_0.7.3
[49] boot_1.3-32 Matrix_1.7-4 jsonlite_2.0.0
[52] hms_1.1.4 Formula_1.2-5 htmlTable_2.5.0
[55] glue_1.8.1 nloptr_2.2.1 stringi_1.8.7
[58] gtable_0.3.6 quadprog_1.5-8 lme4_2.0-1
[61] pillar_1.11.1 htmltools_0.5.9 R6_2.6.1
[64] Rdpack_2.6.6 mix_1.0-13 evaluate_1.0.5
[67] pbivnorm_0.6.0 lattice_0.22-9 rbibutils_2.4.1
[70] backports_1.5.1 Rcpp_1.1.1-1.1 gridExtra_2.3
[73] nlme_3.1-168 checkmate_2.3.4 xfun_0.57
[76] pkgconfig_2.0.3
Rstudio Version
You may need to ask Dr. Petersen to get access to this file.↩︎