Analysis code accompanying the HSSC manuscript

REPRODUCE ALL REPORTED ANALYSES
1. Obtain authorized GESIS access to the five reduced survey files listed in data_file_manifest.json. Place them in Data/ym with their original filenames. No survey records are distributed here.
2. Install Python with pandas, numpy and scipy, and R with MASS. Put Rscript on PATH.
3. Run: python run_all.py
4. Outputs are written under Research project/AI perception/Results. Logs are in Results/reproduction_logs.
For the three primary models only, run: python run_primary.py

The complete driver fits all reported appendix specifications from raw inputs. It includes the previously manual copying of freshly computed prediction files and explicit exports for appendix cutpoints and vector figures. Estimation, standard-error calculations, and source model specifications are unchanged.

OUTPUT MAP
- Main models and Figures 2-3: Results/job_manuscript_20261106/Main.
- A1 sample characteristics and A2 sequential separate ordered logits: Results/job_appendix_tables_20261105 (copies in job_manuscript_20261106/Appendix).
- A3 target-specific control slopes: Results/job_manuscript_20261106/Appendix/original_coefout.csv; cutpoints.csv contains thresholds.
- A4-A6 controls, religious-group gaps and cross-target contrasts: Main and Appendix subdirectories of Results/job_manuscript_20261106.
- A7 moderation and A10 moderator availability and same-sample baselines: Results/job_moderation_20261107.
- A8 four-model sensitivity: Results/four_job_models_20261105. Its cross-target CSV uses migration-minus-target orientation; displayed A8 reverses the sign. OLS estimates are rating points; other probability contrasts are fractions, multiplied by 100 in tables.
- A9 merged reference group: Results/job_merged_reference_20261106.
- A10 sample flow and diagnostics: Results/code_audit_20261105 and its clean_reference subdirectory. Sparse cumulative binary fits do not provide a stable within-target proportional-odds test; this is reported in the supplement.
- S1-S2: PDF files in Results/job_manuscript_20261106/Appendix.
- Figure 1 is a conceptual diagram, not a statistical estimate.

VALIDATION
The complete analysis was rerun from the authorized raw files on 8 November 2026 in an isolated directory, without copying saved model objects or prior statistical results. 31 of 32 aggregate numerical files matched the previous submission package exactly. One appendix threshold CSV had mistakenly duplicated the primary-model thresholds; it was corrected from the freshly fitted appendix models. All 32 files now match the corrected numerical supplement exactly. See export_correction.json. All 17 Word table panels spanning A1-A10, and the main regression table, matched freshly generated tables, including rounding, significance markers and intervals. Statistical Figures 2, 3, S1 and S2 matched the fresh output; vector drawing commands matched as well. See appendix_numeric_validation.json, word_table_validation.json and figure_validation.json. The three primary models retain 1,170 respondents and 8,103 assessments. R 4.6.1 and MASS 7.3-65 were used.

CODE SCOPE
Only the code required by the manuscript and reported supplementary analyses is supplied: 32 analysis/helper scripts plus run_all.py and run_primary.py. Unreported exploratory analyses and unused Word-formatting scripts have been removed. Two preparation helpers contain only the prefixes used by the analysis pipeline; their unused exploratory sections have been removed. The executed preparation, estimation and prediction code is unchanged.

The package includes shared data preparation, model diagnostics, sensitivity analyses and figure/table exports needed to reproduce the submitted work. run_all.py does not overwrite or rebuild the submitted Word documents. Historical script names may refer to Table 2, now Table 1 in the HSSC submission. Historical Holm columns may be generated by a retained sensitivity script but are not used in the submitted tables or numerical supplement. Shared preprocessing retains its original inputs and intermediate variables to preserve the verified pipeline.

Execution_logs/ records the complete successful 20 November run. Scope pruning removes no code executed in that run. All 32 submitted numerical CSVs matched the run in their reported columns. CODE_OUTPUT_MAP.txt maps retained entry points and helpers to reported outputs.

DATA AND PRIVACY
The delivered package contains code, documentation and aggregate results only. It contains no respondent-level source/derived data, respondent-ID lists, fitted model objects, personal author/contact details, or user-specific absolute filesystem paths. Data/ym is empty until the authorized user supplies inputs. Running the code locally creates restricted derived records and fitted model objects: do not redistribute these generated files. The input manifest contains filenames and checksums, not survey records. Wave 8 is read by historical preparation code, but the final gender-role control comes from Wave 10.

READABILITY UPDATE — 20 November 2026
Compressed statements have been expanded and indentation standardized. Short comments in the main model explain the common sample, respondent clustering, predicted disadvantage and target contrasts. Filenames, statistical specifications and output names are preserved. Three plotting sources retain their literal layout because export helpers read them as text. Python syntax trees and R parsed expressions were checked for equivalence during formatting. A fresh full run completed all 23 stages; all 32 published numerical files match in their reported columns. Execution_logs/ contains the new run.
