DOI: 10.5281/zenodo.16498102
title: Data, Code and Supplemental Materials for "Externalizing problems and Reward-Punishment sensitivity: Testing Within-Person Reciprocal Associations in an elementary school sample. A Replication of Ramer et al. (2024)".

description: SUPPLEMENTAL MATERIALS:

Supplemental materials can be download in .html or .docx format. We recommend using the .html files as the layout and readability is better. The files are named "Supplemental-materials-PUBLIC".

CODE:

Use the R-markdown file named "Supplemental materials.RmD" to replicate the analyses used in article. Please do not rearrange the code chunks as there are dependencies. Download and run the python script "8_missing_patterns_and_categorization.py" before running the R-markdown script, as this uses files generated by the python script. 

For all code make sure to adjust any pathnames that tells R or Mplus how to access datafiles (e.g., '/Volumes/T9_MAC/Public/replication.dat').



Descriptives.  Detailed in supplemental materials chapter 1. Download file "replication.dat" and run the code in the R-markdown file. 

Univariate growth models. Detailed in supplemental materials chapter 2. Uses output- and the FSCORES.dat-files generated by the Mplus. The Mplus analyses are run using "replication.dat" data file. After conducting the Mplus analyses that generates the files, run the code in R-markdown manuscript.



2.1 BIS growth model uses the Mplus output files:



1_1_bis_linear.out, 1_2_bis_quad.out, and 1_3_bis_basis.out for estimation of linear, quadratic and basis slope models.

1_1_bis_linear_FSCORES, 1_2_bis_quad_FSCORES, and 1_3_bis_basis_FSCORES are data files generated by Mplus containing scores to produce the plots.

The supplemental multigroup comparison described in 2.1.4. are found in Mplus output files 1_4_bis_multigroup_equal and 1_5_bis_multigroup_freed. 



2.2 BAS growth model uses the Mplus output files:



2_1_bas_linear.out, 2_2_bas_quad.out, and 2_3_bas_basis.out for estimation of linear, quadratic and basis slope models.

2_1_bas_linear_FSCORES, 2_2_bas_quad_FSCORES, and 2_3_bas_basis_FSCORES are data files generated by Mplus containing scores to produce the plots.

The supplemental multigroup comparison described in 2.2.4. are found in Mplus output files 2_4_bas_multigroup_equal and 2_5_bas_multigroup_freed. 



2.3 Oppositional growth model uses the Mplus output files:



3_1_opp_linear.out, 3_2_opp_quad.out, and 3_3_opp_basis.out for estimation of linear, quadratic and basis slope models.

3_1_opp_linear_FSCORES, 3_2_opp_quad_FSCORES, and 3_3_opp_basis_FSCORES are data files generated by Mplus containing scores to produce the plots.

The supplemental multigroup comparison described in 2.3.4. are found in Mplus output files 3_4_opp_multigroup_equal and 3_5_opp_multigroup_freed. 



2.4 Conduct growth model uses the Mplus output files:



 4_1_con_linear.out, 4_2_con_quad.out, and 4_3_con_basis.out for estimation of linear, quadratic and basis slope models.

4_1_con_linear_FSCORES, 4_2_con_quad_FSCORES, and 4_3_con_basis_FSCORES are data files generated by Mplus containing scores to produce the plots.

The supplemental multigroup comparison described in 2.4.4. are found in Mplus output files 4_4_con_multigroup_equal and 4_5_con_multigroup_freed. 





Structural models - LCM-SR.  The LCM-SR model bulding and analyses are detailed in supplemental materials chapter 3. All analyses are done in Mplus using the "replication.dat" file



3.1. Oppostional problems. For each step described use the corresponding Mplus file to conduct the analyses. Step 1 corresponds to Mplus file 5_1, Step 2 uses Mplus file 5_2, [...], Step 11 uses Mplus file 5_11.

3.2. Conduct problems. For each step described use the corresponding Mplus file to conduct the analyses. Step 1 corresponds to Mplus file 6_1, Step 2 uses Mplus file 6_2, [...], Step 11 uses Mplus file 6_11.



Item descriptions. Detailed in supplemental materials chapter 4. Download "DSMscale_ODD.csv" and "DSMscale_ODD.csv" and run code in R-markdown file. 

Longitudinal measurement Invariance. Detailed in supplemental materials chapter 5. Analyses for measurement invariances uses a separate dataset for each outcome. The R-markdown file reads the Mplus output files to generate tables of model fit. 



Mplus files for Oppositional problems use the datafile "inv_oppositionalitems.dat" containing the items for each timepoint. 7_1_ODD to 7_3_ODD contains the Mplus code and output for configural, weak, and strong invariance. 

Mplus files for Conduct problems use the datafile "inv_conductitems.dat". 7_4_CD to 7_6_CD contains the Mplus code and output for configural, weak, and strong invariance. 

Mplus files for BAS use the datafile "inv_basitems.dat". 7_7_BAS to 7_9_BAS contains the Mplus code and output for configural, weak, and strong invariance. 

Mplus files for BIS use the datafile "inv_bisitems.dat". 7_10_BIS to 7_12_BIS contains the code and output for configural, weak, and strong invariance. 



Missing data analyses. Detailed in supplemental materials chapter 6. First download the python script "8_missing_patterns_and_categorization.py". This file runs on the datafile "replication.sav", and generates the four datasets "decriptives.csv", "missing_group_dataset.csv", "missing_pattern_frequencies.csv", and "missing_values.csv". Copy the path to these files into the R-Markdown code where indicated. And run R-markdown code. (optional: download "JetBrainsMono-Regular.ttf" and copy the path to the file to generate font for the figures. If you dont use it remove this code from r-Markdown file).  Make sure not to run the enitre R-markdown script (i.e., using the kntir-function), before you have run the python code first.


DATA FILES:

There are several datafiles for conducting these analyses. 



"replication.dat" and "replicaton.sav" are identical in content but one is for mplus analyses and one is for spss. It contains 27 variables. 20 are sumscores for the four outcomes in the study (BAS1-5, BIS1-5, Conduct1-5, Oppositional1-5). The other seven are id, group, gender, schoolid, as well as three variables with mean of sumscores across the five timpoints for conduct problems, oppositional problems, and internalizing problems. It is important to note that the id variable is a randomly generated number and it is not possible to use the dataset in conjunction with other data have been made availble from other studies using the same data set. 

There are four separate datafiles containing the items for the four outcomes. These are without id and cannot be merged with other data. These files are necessary to conduct measurment invariance analyses for the outcomes. "inv-basitems" is for BAS, "inv_bisitems" for BIS, "inv_conductitems" is for conduct problems, and "inv_oppositionalitems" is for oppostional problems. For invariance analyses Mplus also requires the files "ODD_config.dat", "ODD_weak.dat", "CD_config.dat", "CD_weak.dat", "BIS_config.dat", "BIS_weak.dat", "BAS_config.dat", and "BAS_weak.dat". These are not included here but are generated when running the DIFFTEST analysis in Mplus (see Mplus output files 7_1 through 7_12 which contains code and output for invariance tests)

 There are two csv files named DSMscale_CD and DSMscale_OD. These are used in the R-markdown script to create descriptives and comparisons of the items used in the study.

There are also a number of ...FSCORE.dat files. These are files generated by Mplus when running the univariate models and allows for plotting the estimated trajectories of the models. 

For missing analyses the R-markdown script requires the files "decriptives.csv", "missing_group_dataset.csv", "missing_pattern_frequencies.csv", and "missing_values.csv". These are not included here but are generated when running the python script (see point 6 missing data analyses). 


WHERE YOU NEED TO CHANGE CODE IN R-MARKDOWN FILE:

The only places you should need to change code is when specifying the path to the datafiles or Mplus outputs in the R-markdown file. The placement of these can be found around these lines in the R-markdown file:



1  Descriptives



line 28: "repl <- read.table('/Volumes/T9_MAC/Public/replication.dat', header=FALSE, colClasses = classes, na.strings="-999")"



2.1. BIS growth model



line 383: "BIS_lin <- readModels('/Volumes/T9_MAC/Public/1_1_bis_linear.out')"

line 503: "fscores_BIS_lin <- read.table('/Volumes/T9_MAC/Public/1_1_bis_linear_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_BIS_lin)"

line 576: "BIS_quad <- readModels('/Volumes/T9_MAC/Public/1_2_bis_quad.out')"

line 699: "fscores_BIS_quad <- read.table('/Volumes/T9_MAC/Public/1_2_bis_quad_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_BIS_quad)"

line 774: "BIS_basis <- readModels('/Volumes/T9_MAC/Public/1_3_bis_basis.out')"

line 894: "fscores_BIS_basis <- read.table('/Volumes/T9_MAC/Public/1_3_bis_basis_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_BIS_basis)"



2.2 BAS growth model



line 976: "BAS_lin <- readModels('/Volumes/T9_MAC/Public/2_1_bas_linear.out')"

line 1096: "fscores_BAS_lin <- read.table('/Volumes/T9_MAC/Public/2_1_bas_linear_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_BAS_lin)"

line 1169: "BAS_quad <- readModels('/Volumes/T9_MAC/Public/2_2_bas_quad.out')"

line 1291: "fscores_BAS_quad <- read.table('/Volumes/T9_MAC/Public/2_2_bas_quad_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_BAS_quad)"

line 1364: "BAS_basis <- readModels('/Volumes/T9_MAC/Public/2_3_bas_basis.out')"

line 1484: "fscores_BAS_basis <- read.table('/Volumes/T9_MAC/Public/2_3_bas_basis_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_BAS_basis)"



2.3 OPP growth model



line 1565: "OPP_lin <- readModels('/Volumes/T9_MAC/Public/3_1_opp_linear.out')"

line 1686: "fscores_OPP_lin <- read.table('/Volumes/T9_MAC/Public/3_1_opp_linear_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_OPP_lin)"

line 1758: "OPP_quad <- readModels('/Volumes/T9_MAC/Public/3_2_opp_quad.out')"

line 1881: "fscores_OPP_quad <- read.table('/Volumes/T9_MAC/Public/3_2_opp_quad_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_OPP_quad)"

line 1953: "OPP_basis <- readModels('/Volumes/T9_MAC/Public/3_3_opp_basis.out')"

line 2073: "fscores_OPP_basis <- read.table('/Volumes/T9_MAC/Public/3_3_opp_basis_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_OPP_basis)"



2.4 CON growth model



line 2154: "CON_lin <- readModels('/Volumes/T9_MAC/Public/4_1_con_linear.out')"

line 2275: "fscores_CON_lin <- read.table('/Volumes/T9_MAC/Public/4_1_con_linear_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_CON_lin)"

line 2348: "CON_quad <- readModels('/Volumes/T9_MAC/Public/4_2_con_quad.out')"

line 2471: "fscores_CON_quad <- read.table('/Volumes/T9_MAC/Public/4_2_con_quad_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_CON_quad)"

line 2544: "CON_basis <- readModels('/Volumes/T9_MAC/Public/4_3_con_basis.out')"

line 2664: "fscores_CON_basis <- read.table('/Volumes/T9_MAC/Public/4_3_con_basis_FSCORES.dat', header = FALSE, na.strings = "*", col.names = varnames_CON_basis)"



4 Item descriptions



line 2986: "data <- read.csv("/Volumes/T9_MAC/Public/DSMscale_ODD.csv", sep=";")"

line 3031: "data <- read.csv("/Volumes/T9_MAC/Public/DSMscale_CD.csv", sep=";")"



5 Longitudinal measurement invariance analyses



line 3110: ODD_configural = "/Volumes/T9_MAC/Public/7_1_ODD_configural.out"

line 3111: ODD_weak = "/Volumes/T9_MAC/Public/7_2_ODD_weak.out"

line 3112: ODD_strong = "/Volumes/T9_MAC/Public/7_3_ODD_strong.out"

line 3113: CD_configural = "/Volumes/T9_MAC/Public/7_4_CD_configural.out"

line 3114: CD_weak = "/Volumes/T9_MAC/Public/7_5_CD_weak.out"

line 3115: CD_strong = "/Volumes/T9_MAC/Public/7_6_CD_strong.out"

line 3116: BAS_configural = "/Volumes/T9_MAC/Public/7_7_BAS_configural.out"

line 3117: BAS_weak = "/Volumes/T9_MAC/Public/7_8_BAS_weak.out"

line 3118: BAS_strong = "/Volumes/T9_MAC/Public/7_9_BAS_strong.out"

line 3119: BIS_configural = "/Volumes/T9_MAC/Public/7_10_BIS_configural.out"

line 3120: BIS_weak = "/Volumes/T9_MAC/Public/7_11_BIS_weak.out"

line 3121: BIS_strong = "/Volumes/T9_MAC/Public/7_12_BIS_strong.out"



6 Missing data analyses. NB: Run the "8_missing_patterns_and_categorization.py" first in order to produce the necessary data files. 



line 3480: "df_patterns <- read.csv("/Volumes/T9_MAC/Public/missing_group_dataset.csv", sep = ";", header = TRUE, colClasses = c(missing_pattern = "character"))"

line 3590: "font_add("JetBrains Mono", regular = "/Volumes/T9_MAC/Public/JetBrainsMono-Regular.ttf") "

line 4178: "miss_group <- read.csv("/Volumes/T9_MAC/Public/missing_group_dataset.csv", sep = ";", header = TRUE, colClasses = c(missing_pattern = "character"))"

line 4223: "miss_freq <- read.csv("/Volumes/T9_MAC/Public/missing_values.csv", sep = ";", header = TRUE,     colClasses = c(var = "character"))"