# Methodology — student-health-yrbs2023-r1

## Source

The national respondent file `XXH2023_YRBS_Data.dat` of the 2023 CDC Youth Risk Behavior Survey
(8,503,569 bytes; SHA-256 `0a83cba11dc8a0cdf0043aacf0b80478f86cf93a91a8ecb81a276518e486241a`), with CDC's 2023 SAS input program, SAS
formats program and data users guide, all downloaded from https://www.cdc.gov/yrbs/data/national-yrbs-datasets-documentation.html. The build refuses to read any file whose
size or SHA-256 differs from the pinned values (`docs/PROVENANCE.md`). The file holds 20,103 records of
421 characters each (CRLF line endings): every usable questionnaire after CDC's data edits.

## Parsing

* Field positions, widths and variable labels are read from CDC's SAS input program; response codes and value labels
  from CDC's SAS formats program. The build stops if the input program places any selected variable somewhere other
  than the positions recorded in the build code.
* Every record is kept, in file order. `record_number` is the record's 1-based position in CDC's file; it is not a
  CDC variable or a student identifier.
* Response codes are written exactly as CDC stores them. Nothing is recoded, collapsed, top-coded or imputed. A blank
  field becomes an empty cell. A non-blank code that CDC's formats do not define would stop the build (none occurs).
* `survey_weight`, `stratum` and `psu` are CDC's values with fixed-width padding removed.
* `q5_race_selected` is CDC's eight-column check-all-that-apply field written as the marked letters in order, padding
  removed (for example `B   E` → `BE`). Letters F–H, which are not national response options, occur in a few records
  and are preserved; CDC's own race/ethnicity variable treats them as out of range.
* The four `_label` columns repeat CDC's value labels for the headline codes as a convenience.

## Column selection

| Group | Column | CDC variable |
|---|---|---|
| identifier | `record_number` | — (Persistfolio) |
| survey design | `survey_weight` | WEIGHT |
| survey design | `stratum` | STRATUM |
| survey design | `psu` | PSU |
| headline | `q80_social_media_frequency` | Q80 |
| headline | `q80_social_media_frequency_label` | Q80 |
| headline | `q84_poor_mental_health_frequency` | Q84 |
| headline | `q84_poor_mental_health_frequency_label` | Q84 |
| headline | `q85_school_night_sleep_hours` | Q85 |
| headline | `q85_school_night_sleep_hours_label` | Q85 |
| headline | `q87_self_reported_grades` | Q87 |
| headline | `q87_self_reported_grades_label` | Q87 |
| CDC indicator | `qn80_social_media_several_times_a_day_or_more` | QN80 |
| CDC indicator | `qn84_poor_mental_health_most_of_the_time_or_always` | QN84 |
| CDC indicator | `qn85_sleep_8_or_more_hours` | QN85 |
| CDC indicator | `qn87_grades_mostly_a_or_b` | QN87 |
| demographics | `q1_age` | Q1 |
| demographics | `q2_sex` | Q2 |
| demographics | `q3_grade_level` | Q3 |
| demographics | `q4_hispanic_or_latino` | Q4 |
| demographics | `q5_race_selected` | Q5 |
| demographics | `race_ethnicity` | RACEETH |
| physical activity | `q76_days_active_60_minutes` | Q76 |
| physical activity | `q77_pe_class_days` | Q77 |
| physical activity | `q78_sports_teams` | Q78 |
| physical activity | `q97_muscle_strengthening_days` | Q97 |
| dietary behavior | `q75_breakfast_days` | Q75 |
| dietary behavior | `q69_fruit_frequency` | Q69 |
| dietary behavior | `q70_green_salad_frequency` | Q70 |
| dietary behavior | `q74_soda_frequency` | Q74 |
| dietary behavior | `q96_plain_water_frequency` | Q96 |
| bullying | `q24_bullied_at_school` | Q24 |
| bullying | `q25_electronically_bullied` | Q25 |
| school connectedness | `q103_feel_close_to_people_at_school` | Q103 |
| housing instability | `q86_usual_sleeping_place` | Q86 |

The four headline measures and the design variables were specified in advance. The context variables are a focused
set: CDC's demographic questions and computed race/ethnicity; four physical-activity items; five dietary items;
bullying at school and electronic bullying; school connectedness; and the usual sleeping place, which CDC uses to
define unstable housing. CDC's dichotomous QN indicators are included for the four headline measures so CDC's
published definitions can be used directly; note that CDC's QN87 denominator includes *None of these grades* and
*Not sure*.

**Not included in this edition:** sexual identity and transgender identity (Q64–Q65), height, weight and BMI
variables, sadness and suicide items (Q26–Q30), adverse childhood experiences, substance use, sexual behavior and the
remaining questionnaire items. The complete file is free from CDC. AI use, time spent on social media and clinical
diagnoses are not measured by these questions at all.

## Survey design and variance estimation

The national YRBS is a three-stage cluster sample (PSUs of counties, then schools, then classes), stratified by
racial/ethnic concentration and metropolitan status. CDC's weight adjusts for nonresponse and the oversampling of
Black and Hispanic students and is scaled so that weights sum to the sample size.

The QA, the notebook and the documentation use:

* **Estimate:** weighted proportion within the analysis group (domain), `sum(w·d·y) / sum(w·d)`.
* **Variance:** first-order Taylor-series linearization of that ratio, with PSUs treated as sampled with replacement
  within strata (the default in SUDAAN, SAS PROC SURVEYFREQ, Stata `svy` and R `survey`). Domains are estimated within
  the full design — records outside the domain contribute zero — never by subsetting the design. All 16 strata have
  at least two PSUs, so no lonely-PSU rule is needed.
* **Degrees of freedom:** PSUs minus strata, 89 − 16 = 73.
* **95% confidence interval for a proportion:** logit-transformed interval with the t quantile on 73 degrees of
  freedom, back-transformed (asymmetric and inside 0–100%). Differences between two domain proportions use a
  symmetric t interval on the linearized variance of the difference.

With these methods the share of students using social media at least several times a day (Q80 codes 6–8 among the
15,203 students who answered Q80) is **76.9704%** (SE 1.6556 points;
95% CI 73.5068%–80.1037%), matching CDC's published 77.0% (73.5%–80.1%) at published
precision (https://www.cdc.gov/mmwr/volumes/73/su/su7304a3.htm). The unweighted share is 78.09%. CDC notes that different variance
methods can give slightly different confidence intervals while point estimates always match.

## Notebook conventions

The notebook defines its groups before showing results, reports unweighted group sizes beside every weighted
estimate, does not estimate any cell with fewer than 100 students in the denominator (none falls below this), flags
estimates with a relative standard error above 30%, and reports mostly D's and mostly F's together in its tables
because each is sparse within cells. These are Persistfolio analysis rules, not CDC rules, and they do not change the
CSV.

## Privacy

The CDC national file is a public-use file released by CDC without names or school identifiers. This edition removes
columns and adds none that could identify a student; it keeps CDC's stratum and PSU codes because valid variance
estimation needs them.
