Online Resource 3 - Analysis code and output

Article: Emotional Resource, Academic Cost? Romantic Relationships, Academic Functioning and
Psychological Well-Being among Students at a Public University in Egypt: A Mixed-Methods Study
Journal: Applied Research in Quality of Life
Authors: withheld for double-anonymous review

Files
  Online_Resource_3_analysis_code.py  Analysis code, version 2.0: data audit (run on the original form
                                      export with --xlsx) and every analysis reported in the article and in
                                      Online Resource 1 (run on Online Resource 2 with --data).
  Online_Resource_3_addendum.py       Addendum, version 2.1: implied odds ratios from the year-of-study
                                      interaction model (Table S6b) and the re-estimation of
                                      within-relationship models without items close in content to the
                                      outcome (Table S5e). It imports version 2.0 unchanged and must be in
                                      the same folder.
  results.json                        Complete output of version 2.0, as archived by the authors (run on
                                      the original export, so it includes the audit counts).
  results_addendum.json               Output of the addendum.
  qualitative_audit.py                Audit of the interview accounts for repeated wording (Online
                                      Resource 1, Section S8). It needs the accounts, which are not shared
                                      to protect participants' confidentiality.
  requirements.txt                    Package versions (Python 3.13.17).

Running the analyses (Online Resource 2 is the data file ESM_2.csv)
  pip install -r requirements.txt
  python Online_Resource_3_analysis_code.py --data ESM_2.csv --out out
  python Online_Resource_3_addendum.py --data ESM_2.csv --out out

The main script takes about ten minutes. Seeds are fixed (parallel analysis 20260401, bootstrap
20260402).

Reproducibility check (26 October 2026, environment in requirements.txt)
  Running version 2.0 on ESM_2.csv reproduced all 4,312 numeric values of results.json to within
  1e-12, apart from the audit counts, which require the original export. Confirmatory-factor-analysis
  values can differ in the last digits between runs, and some latent correlations are labelled with
  the two factors in reverse order (e.g. ENG-AMOT instead of AMOT-ENG), because the order in which the
  code assembles the factors varies between Python sessions. The addendum reproduced
  results_addendum.json exactly.

Note on this review copy
  In the faculty mapping (FAC_GROUP) used only when the original export is read, the names of the eight
  faculties grouped as "STEM & Health" are replaced by placeholders because they could identify the
  university. Analyses run on ESM_2.csv use the coded faculty group and are not affected.
