VARIABLE CODING AND MODEL GUIDE

This guide supplements the manuscript's Variables and Analytical Strategy sections and the exact transformations in the code. Script paths below are relative to Code/Research project/AI perception/Code/.

Outcome: y10_gdaijs1 through y10_gdaijs7 measure expected AI consequences when looking for a job. Ratings 1-5 are retained; other codes are excluded itemwise. Higher scores indicate greater anticipated disadvantage. Targets: 1 migration background; 2 no migration background; 3 women; 4 men; 5 nonbinary people; 6 lower social strata; 7 higher social strata. Binary disadvantage is rating >=4. See prepare_ai_combined_20261104.py.

Religious affiliation: y10_rel1 codes 7-10 are Muslim; 3-5 are Christian; 1 is unaffiliated. The primary sample includes these three categories, with Christians and unaffiliated respondents combined as non-Muslim. Other affiliations are excluded. See ai_descriptive_20261104.py and prepare_ai_combined_20261104.py.

Immigrant origins: valid y6_generationG is used first, with y1_generationG as fallback. Included codes are 1-13 and 15-17; code 14 and missing classifications are excluded. See ai_descriptive_20261104.py. Origin-country labels used in exploratory outputs do not enter the primary models.

Sex: y10_sex 1=Men, 2=Women, 3=Diverse; missing sex is excluded from the primary analytical sample. Education: y10_hgendeg 1-2=Lower/intermediate, 3-4=University entrance, 5-6=Other/no qualification; missing is a category. Activity: y10_csit4H 1=School, 2=Training, 3=Studying, 4=Employed, 5=Internship, 6=Other; missing is a category. See ai_target_audit_20261104.py.

Occupational status: positive y10_w_iseiG values are centered at 50. Missing/nonpositive values are assigned zero on this centered scale, with a separate missing-status indicator. See prepare_ai_combined_20261104.py.

AI use: y10_uai 1-2=Weekly_or_more, 3-4=Less_than_weekly, 5=Never, 6=Unfamiliar; Never is the reference. General AI concern: y10_worai 1=More_excited, 2=More_concerned, 3=Equally_both; Equally_both is the reference. Acceptance of homosexuality: y9_tol4 1=Always_OK, 2=Often_OK, 3=Sometimes_OK, 4=Never_OK; Always_OK is the reference. Invalid codes become missing and are excluded from the common analytical sample. See prepare_ai_followup_20261104.py and ai_model_common.R.

Gender-role attitudes: w10_gender_equal counts code 3 (equal sharing) across y10_grol1-y10_grol4, range 0-4. All four items must have valid codes 1-3. This is the Wave 10 measure, not the historical Wave 8 variable. See prepare_w10_gender_roles_20261105.py.

PRIMARY MODELS
compare_job_simple_controls_20261106.R selects the common sample of 1,170 respondents (237 Muslim) with 8,103 valid job-finding assessments. All three models use this sample.
Base: ordered_rating ~ target * muslim + sex + education + activity + isei_centered + isei_missing.
AI: Base + ai_use + ai_concern.
Full: AI + sexual_acceptance + w10_gender_equal.
The primary specification includes control main effects. Target-specific control slopes are an appendix analysis.
Models use MASS::polr with a logistic link. Variance estimates cluster responses by youthid; ordinal_parts.R provides score and Hessian calculations. The model is logit[P(Y <= k)] = theta_k - X beta.
Disadvantage probabilities equal P(Y >=4), averaged over the common respondent covariate distribution. Religious-group differences are Muslim minus non-Muslim. Cross-target contrasts subtract the migration-background difference from each other target's difference. Confidence intervals use the respondent-clustered covariance; statistical tests are two-sided with unadjusted p values.

APPENDIX AND OUTPUTS
Code/README.txt gives the table-by-table map. Exact moderator coding is in prepare_ai_mechanisms_20261104.py and job_moderation_20261107.R. Reference-group sensitivity is in prepare_job_native_comparison_20261106.py and fit_job_merged_reference_20261106.R. Four-model sensitivity is in compare_four_job_models_20261105.R. run_all.py specifies execution order, including exports and diagnostics. Historical script names may say Table 2; the HSSC main regression table is Table 1.
