The city of Leipzig conducted Youth Surveys in the years 2010, 2015 and 2023. Here, we are going to start by loading the data and taking an initial look at it.
In 2010, the city of Leipzig actually conducted two parallel Youth Surveys. All the following information was taken from the official report: “Jugend in Leipzig – Ergebnisse einer Befragung 2010 [07/2011]” issued by Stadt Leipzig, Amt für Statistik und Wahlen in Kooperation mit dem Amt für Jugend, Familie und Bildung.
First, students between the ages of 12 and 17 were targeted within their respective schools (although students within the same classes who happened to be older were surveyed as well). Second, young people between the ages of 18 and 27 were contacted separately based on registry information, to ensure that young people who already left school were represented as well. Only the first survey has a methodology comparable to the 2015 and 2023 Youth Surveys, so we will exclusively rely on that data and ignore the survey involving older young people.
For the Youth Survey that took part in schools, initially schools were selected, in within those schools all eligible classes were assessed in total. The targeted initial sample size was 3000, which was distributed according to the actual distribution of students between the ages of 12 to 17 in the four types of schools included and the grade levels included (Mittelschule: grades 7 to 10, Gymnasium: grades 7 to 12, Berufs-/Fachoberschule: first and second year, Förderschule: grades 7 to 10). The corresponding schools and classrooms were then picked, prioritising schools who had participated in earlier Youth Surveys for organisational reasons. In total, there were 3459 students in the targeted classes. Of these, a total of 2411 (70%) participated in the Youth Survey and can be found in our data set. The data were collected between October 18th and November 5th 2010.
To my knowledge, no weights were generated for the official report issued by the city.
# Read 2010 data
youth2010 <- readRDS("Files/umfschule2010.rds")
# prepare some basic variables
# add year
youth2010$year <- 2010
# schooltype
# existing variable
table(youth2010$`@schultyp`)
##
## 0 1 2 3
## 681 767 862 101
# 0: Mittelschule, secondary school (grade 7 to 10)
# 1: Gymnasium, grammar school (grade 7 to 12)
# 2: Berufs-/Fachoberschule, vocational school (1st and 2nd year)
# 3: Förderschule, special-needs school (grade 7 to 10)
youth2010$schooltype <- NA
youth2010$schooltype[youth2010$`@schultyp` == 0] <- 1 # Mittelschule
youth2010$schooltype[youth2010$`@schultyp` == 1] <- 2 # Gymnasium
youth2010$schooltype[youth2010$`@schultyp` == 2] <- 3 # Berufs-/Fachoberschule
youth2010$schooltype[youth2010$`@schultyp` == 3] <- 4 # Förderschule
# gender
table(youth2010$geschl) # original gender variable
##
## 1 2
## 1210 1191
youth2010$gender <- NA # generate new gender variable
youth2010$gender[youth2010$geschl == 1] <- "male"
youth2010$gender[youth2010$geschl == 2] <- "female"
table(youth2010$gender)
##
## female male
## 1191 1210
# age
table(youth2010$alter)
##
## 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
## 2 199 431 332 268 297 292 162 99 107 51 42 33 28 18 9 7
youth2010$age <- youth2010$alter
# migback
# migration background was assessed by asking respondents
# whether they and their parents were born in Germany
# self born in Germany? if no, which country
table(youth2010$s23ad, youth2010$s23aa, useNA = "always")
##
## 121 126 129 134 137 140 142 146 150 151 152 158 160 163
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 2 3 1 1 1 1 3 1 1 1 2 1 24 8
##
## 166 169 170 221 245 326 335 348 351 361 368 386 423 425
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 21 1 2 1 1 1 1 1 2 1 1 1 7 1
##
## 430 432 434 436 437 438 439 444 450 451 461 475 476 477
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 2 8 1 1 1 12 1 21 1 1 1 1 1 3
##
## 536 998 <NA>
## 1 0 0 2243
## <NA> 1 2 18
# father born in Germany? if no, which country
table(youth2010$s23bd, youth2010$s23ba, useNA = "always")
##
## 0 121 122 125 126 129 130 131 132 134 137 140 142 144
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 4 3 1 3 1 1 1 1 1 1 6 1 3 2
##
## 148 150 151 152 153 154 157 158 159 160 161 163 165 166
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 1 1 2 10 4 1 2 1 2 31 1 20 4 17
##
## 168 169 170 195 221 223 225 238 248 252 254 262 269 276
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 2 1 2 1 9 2 1 1 1 4 7 1 1 1
##
## 282 285 287 289 326 332 348 351 361 367 368 423 425 430
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 1 2 3 1 1 2 1 6 5 1 3 8 3 2
##
## 431 432 434 436 437 438 439 444 445 450 451 458 461 475
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 1 46 1 6 1 13 1 21 2 1 2 1 2 4
##
## 476 477 479 996 998 <NA>
## 1 0 0 0 0 0 2030
## <NA> 1 3 1 1 11 63
# mother born in Germany? if no, which country
table(youth2010$s23cd, youth2010$s23ca, useNA = "always")
##
## 121 125 126 129 130 131 134 140 142 146 151 152 155 158
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 2 5 1 1 2 1 2 1 3 1 2 16 1 1
##
## 159 160 161 163 164 165 166 169 170 223 227 262 289 326
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 2 29 1 10 2 1 25 1 4 1 1 1 1 1
##
## 327 332 361 423 425 430 432 434 436 437 438 439 444 450
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 1 1 1 10 1 3 40 1 3 1 12 2 18 1
##
## 451 461 462 470 475 476 477 996 998 <NA>
## 1 0 0 0 0 0 0 0 0 0 2138
## <NA> 1 1 1 2 1 2 2 1 10 38
# always lived in Germany?
table(youth2010$s24a, useNA = "always")
##
## 1 <NA>
## 2225 186
# in Germany since age...
table(youth2010$s24b, useNA = "always")
##
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## 14 13 12 14 10 12 9 9 10 15 11 5 8 5 3 3
## 18 19 <NA>
## 1 1 2256
youth2010$migback <- NA
# Self, father, mother born in Germany
youth2010$migback[!is.na(youth2010$s23ad) & !is.na(youth2010$s23bd) & !is.na(youth2010$s23cd)] <- "none"
# Self born in Germany, father mother not born in Germany
youth2010$migback[!is.na(youth2010$s23ad) & !is.na(youth2010$s23ba) & !is.na(youth2010$s23ca)] <- "both"
# Self born in Germany, father not born in Germany, mother born in Germany
youth2010$migback[!is.na(youth2010$s23ad) & !is.na(youth2010$s23ba) & !is.na(youth2010$s23cd)] <- "father"
# Self born in Germany, father born in Germany, mother not born in Germany
youth2010$migback[!is.na(youth2010$s23ad) & !is.na(youth2010$s23bd) & !is.na(youth2010$s23ca)] <- "mother"
# Self not born in Germany
youth2010$migback[!is.na(youth2010$s23aa)] <- "self"
# If both parents in Germany, assume self is also born in germany
youth2010$migback[!is.na(youth2010$s23bd) & !is.na(youth2010$s23cd)] <- "none"
table(youth2010$migback, useNA = "always")
##
## both father mother none self <NA>
## 66 123 35 1983 145 59
# Dichotomous indicator of Migration background/German not main language
# we will need this later because in 2015, migration background was
# not assessed in the same manner
youth2010$mig_lang[youth2010$migback == "none"|youth2010$migback == "father"|youth2010$migback == "mother"] <- 0
## Warning: Unknown or uninitialised column: `mig_lang`.
youth2010$mig_lang[youth2010$migback == "self"|youth2010$migback == "both"] <- 1
table(youth2010$mig_lang, useNA = "always")
##
## 0 1 <NA>
## 2141 211 59
# Satisfaction items
# Students were asked for their satisfaction with various things
# Here, we will recode the items so that higher values indicate more satisfaction
# For all items that are comparable between the 2010, 2015 and 2023 Youth Surveys
youth2010$satis <- 6 - youth2010$s02a
youth2010$satis_money <- 6 - youth2010$s02b
youth2010$satis_friends <- 6 - youth2010$s02c
youth2010$satis_mom <- 6 - youth2010$s02d
youth2010$satis_dad <- 6 - youth2010$s02e
youth2010$satis_leisure <- 6 - youth2010$s02g
youth2010$satis_dwell <- 6 - youth2010$s02h
youth2010$satis_grades <- 6 - youth2010$s02f
table(youth2010$gender, useNA = "always")
##
## female male <NA>
## 1191 1210 10
table(youth2010$schooltype, useNA = "always")
##
## 1 2 3 4 <NA>
## 681 767 862 101 0
table(youth2010$migback, useNA = "always")
##
## both father mother none self <NA>
## 66 123 35 1983 145 59
table(youth2010$satis, useNA = "always")
##
## 1 2 3 4 5 <NA>
## 28 136 532 1152 551 12
# Grade level
table(youth2010$klasse)
##
## A B C D E F G H I K L M N
## 5 422 448 310 247 80 44 116 349 165 115 69 41
# A: 6, B: 7, C: 8, D: 9, E: 10, F: 11, G: 12
youth2010$grade_level <- NA
youth2010$grade_level[youth2010$klasse == "A"] <- 6
youth2010$grade_level[youth2010$klasse == "B"] <- 7
youth2010$grade_level[youth2010$klasse == "C"] <- 8
youth2010$grade_level[youth2010$klasse == "D"] <- 9
youth2010$grade_level[youth2010$klasse == "E"] <- 10
youth2010$grade_level[youth2010$klasse == "F"] <- 11
youth2010$grade_level[youth2010$klasse == "G"] <- 12
# Gender
# Absolute numbers
table(youth2010$gender)
##
## female male
## 1191 1210
# Proportions
round(prop.table(table(youth2010$gender)), digits = 2)
##
## female male
## 0.5 0.5
# Age
table(youth2010$age)
##
## 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
## 2 199 431 332 268 297 292 162 99 107 51 42 33 28 18 9 7
summary(youth2010$age)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 11.00 13.00 15.00 15.83 17.00 27.00 34
sd(youth2010$age, na.rm = TRUE)
## [1] 3.014138
hist(youth2010$age)
axis(1, at = seq(min(youth2010$age, na.rm = TRUE), max(youth2010$age, na.rm = TRUE), by = 1))
# School types
table(youth2010$schooltype)
##
## 1 2 3 4
## 681 767 862 101
round(prop.table(table(youth2010$schooltype)), digits = 2)
##
## 1 2 3 4
## 0.28 0.32 0.36 0.04
# 1: Mittelschule, secondary school (grade 7 to 10)
# 2: Gymnasium, grammar school (grade 7 to 12)
# 3: Berufs-/Fachoberschule, vocational school (1st and 2nd year)
# 4: Förderschule, special-needs school (grade 7 to 10)
# Migration background
table(youth2010$migback)
##
## both father mother none self
## 66 123 35 1983 145
round(prop.table(table(youth2010$migback)), digits = 2)
##
## both father mother none self
## 0.03 0.05 0.01 0.84 0.06
# Dichotomous indicator
table(youth2010$mig_lang)
##
## 0 1
## 2141 211
round(prop.table(table(youth2010$mig_lang)), digits = 2)
##
## 0 1
## 0.91 0.09
The next Youth Survey was conducted five years later. The following information was taken from the official report: “Jugend in Leipzig – Ergebnisse einer Befragung 2015 [08/2015]” issued by Stadt Leipzig, Amt für Statistik und Wahlen in Kooperation mit dem Amt für Jugend, Familie und Bildung.
In 2015, only one survey took place, targeting students within their respective schools.
Again, schools were initially selected, and within those schools whole classes were assessed for reasons of efficiency. The targeted initial sample size was again 3000, which was again distributed according to the actual distribution of students across the included types of schools and grade levels (Oberschule, formerly called Mittelschule: grades 7 to 10, Gymnasium: grades 7 to 11, Berufs-/Fachoberschule: first, second and third year, Förderschule: grades 7 to 10). In total, 3298 students were in the targeted classes. Of these, a total of 2255 (75%) participated in the Youth Survey and can be found in our data set. The data were collected between May 7th and June 1st 2015, which is why the students in grade 12 at Gymnasium are missing – they already finished their final examinations (Abitur).
To my knowledge, no weights were generated for the official report issued by the city.
# Read 2015 data
youth2015 <- read_spss("Files/jugend2015.sav")
# prepare some basic variables
# add year
youth2015$year <- 2015
# schooltype
# existing variable
table(youth2015$schulart)
##
## 1 2 3 4
## 950 660 570 71
# 1: Gymnasium
# 2: Oberschule
# 3: Berufs-/Fachoberschule
# 4: Förderschule
youth2015$schooltype <- NA
youth2015$schooltype[youth2015$schulart == 2] <- 1 # Mittelschule/Oberschule
youth2015$schooltype[youth2015$schulart == 1] <- 2 # Gymnasium
youth2015$schooltype[youth2015$schulart == 3] <- 3 # Berufs-/Fachoberschule
youth2015$schooltype[youth2015$schulart == 4] <- 4 # Förderschule
# gender
table(youth2015$geschlecht)
##
## 1 2
## 1029 1207
youth2015$gender <- NA
youth2015$gender[youth2015$geschlecht == 1] <- "male"
youth2015$gender[youth2015$geschlecht == 2] <- "female"
table(youth2015$gender, youth2015$geschlecht)
##
## 1 2
## female 0 1207
## male 1029 0
# age
table(youth2015$alter)
##
## 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32
## 36 306 405 417 353 333 168 67 42 29 18 17 13 10 4 7 2 3 4 4
## 33 34 35 38 40
## 2 2 2 1 1
youth2015$age <- youth2015$alter
# migback
# in 2015, no detailed information on migration background was collected
# but only information on the main language spoken at home
# according to personal communications, this decision was made
# (1) to increase comparability with other youth surveys and
# (2) to ask in a more child-friendly manner
youth2015$migback <- NA
table(youth2015$f19)
##
## 1 2
## 2029 208
youth2015$german_at_home <- ifelse(youth2015$f19 == 1, 1, 0)
table(youth2015$german_at_home)
##
## 0 1
## 208 2029
youth2015$mig_lang <- 1 - youth2015$german_at_home
# Satisfaction items
# Students were asked for their satisfaction with various things
# Here, we will recode the items so that higher values indicate more satisfaction
# For all items that are comparable between the 2010, 2015 and 2023 Youth Surveys
youth2015$satis <- 6 - youth2015$f02a
youth2015$satis_money <- 6 - youth2015$f02b
youth2015$satis_friends <- 6 - youth2015$f02c
youth2015$satis_mom <- 6 - youth2015$f02d
youth2015$satis_dad <- 6 - youth2015$f02e
youth2015$satis_leisure <- 6 - youth2015$f02g
youth2015$satis_dwell <- 6 - youth2015$f02h
youth2015$satis_grades <- 6 - youth2015$f02f
# Grade-level
table(youth2015$Klasse)
##
## 1 2 3 4 5 7 8 9 11
## 360 410 465 251 195 297 142 101 30
# 1: 7, 2: 8, 3: 9, 4: 10, 5: 11, 6: 12
youth2015$grade_level <- NA
youth2015$grade_level[youth2015$Klasse == 1] <- 7
youth2015$grade_level[youth2015$Klasse == 2] <- 8
youth2015$grade_level[youth2015$Klasse == 3] <- 9
youth2015$grade_level[youth2015$Klasse == 4] <- 10
youth2015$grade_level[youth2015$Klasse == 5] <- 11
youth2015$grade_level[youth2015$Klasse == 6] <- 12
# Gender
# Absolute numbers
table(youth2015$gender)
##
## female male
## 1207 1029
# Proportions
round(prop.table(table(youth2015$gender)), digits = 2)
##
## female male
## 0.54 0.46
# Age
table(youth2015$age)
##
## 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32
## 36 306 405 417 353 333 168 67 42 29 18 17 13 10 4 7 2 3 4 4
## 33 34 35 38 40
## 2 2 2 1 1
summary(youth2015$age)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 12.0 14.0 15.0 15.9 17.0 40.0 9
sd(youth2015$age, na.rm = TRUE)
## [1] 2.857354
hist(youth2015$age)
axis(1, at = seq(min(youth2015$age, na.rm = TRUE), max(youth2015$age, na.rm = TRUE), by = 1))
# School types
table(youth2015$schooltype)
##
## 1 2 3 4
## 660 950 570 71
round(prop.table(table(youth2015$schooltype)), digits = 2)
##
## 1 2 3 4
## 0.29 0.42 0.25 0.03
# 1: Mittelschule, secondary school (grade 7 to 10)
# 2: Gymnasium, grammar school (grade 7 to 11)
# 3: Berufs-/Fachoberschule, vocational school (1st, 2nd, 3rd year)
# 4: Förderschule, special-needs school (grade 7 to 10)
# Migration background
# not assessed
# And the language at home
table(youth2015$mig_lang)
##
## 0 1
## 2029 208
round(prop.table(table(youth2015$mig_lang)), digits = 2)
##
## 0 1
## 0.91 0.09
The next Youth Survey was supposed to happen in 2020 but was delayed by 3 years due to the COVID-19 pandemic. The following information was taken from the official report: “Jugend in Leipzig 2023” issued by Stadt Leipzig, Amt für Statistik und Wahlen/Amt für Jugend un Familie/Amt für Schule.
In 2023, the sampling procedures were adjusted. Instead of first selecting schools and then assessing the relevant classrooms within those schools, classrooms were drawn across schools. This change was implemented to increase the variability in the data and improve the representativeness of the results. Furthermore, students from special-needs schools were intentionally oversampled, and weights were generated to account for this overrepresentation.
A total of 212 classrooms across 68 schools were initially selected for the cluster sample, covering a total of 5000 students, which was anticipated to result in a sample size of 3000 students given previous experiences with response rates. When school headmaster refused to participate (which happened for a total of 9 schools), reserve schools were contacted. According to the official report, for pragmatic reasons there were some deviations from the initially intended sample. A total of 3053 questionnaires was filled out of which 3 had to be removed due to nonresponse of obviously fake answers.
The data were collected between March 1st and April 28th 2023, which means that students in grade 12 at Gymnasium could be included. Approximately 65% of students filled out the questionnaire on a tablet as opposed to on paper.
# Read 2023 data
library(haven)
youth2023 <- readRDS("Files/jugend2023.rds")
# prepare some basic variables
# add year
youth2023$year <- 2023
# schooltype
# existing variable
table(youth2023$schulart)
##
## 1 2 3 4 5
## 491 474 144 1244 683
# 1: Beruchsfachschule
# 2: Berufsschule
# 3: Förderschule
# 4: Gymnasium
# 5: Oberschule
youth2023$schooltype <- NA
youth2023$schooltype[youth2023$schulart == 5] <- 1 # Mittelschule/Oberschule
youth2023$schooltype[youth2023$schulart == 4] <- 2 # Gymnasium
youth2023$schooltype[youth2023$schulart == 1 | youth2023$schulart == 2] <- 3 # Berufs-/Fachoberschule
youth2023$schooltype[youth2023$schulart == 3] <- 4 # Förderschule
# gender
table(youth2023$geschl)
##
## 1 2 3
## 1394 1520 83
youth2023$gender <- NA
youth2023$gender[youth2023$geschl == 1] <- "male"
youth2023$gender[youth2023$geschl == 2] <- "female"
youth2023$gender[youth2023$geschl == 3] <- "diverse"
table(youth2023$gender, youth2023$geschl)
##
## 1 2 3
## diverse 0 0 83
## female 0 1520 0
## male 1394 0 0
# age
table(youth2023$alter)
##
## 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
## 118 396 446 421 366 295 274 161 125 99 76 51 28 19 20 16 8 5 4 3
## 32 33 34 35 36 37 38 39 41 42 43 44 45 46 49
## 3 4 5 3 4 3 2 2 2 2 1 2 1 1 1
youth2023$age <- youth2023$alter
# migback
# country of birth, Germany or other
table(youth2023$staat_geb_person) # self
##
## 1 2
## 2728 235
table(youth2023$staat_geb_vater) # father
##
## 1 2
## 2437 487
table(youth2023$staat_geb_mutter) # mother
##
## 1 2
## 2539 444
youth2023$migback <- NA
# Self, father, mother born in Germany
youth2023$migback[youth2023$staat_geb_person == 1 & youth2023$staat_geb_vater == 1 & youth2023$staat_geb_mutter == 1] <- "none"
# Self born in Germany, father mother not born in Germany
youth2023$migback[youth2023$staat_geb_person == 1 & youth2023$staat_geb_vater == 2 & youth2023$staat_geb_mutter == 2] <- "both"
# Self born in Germany, father not born in Germany, mother born in Germany
youth2023$migback[youth2023$staat_geb_person == 1 & youth2023$staat_geb_vater == 2 & youth2023$staat_geb_mutter == 1] <- "father"
# Self born in Germany, father born in Germany, mother not born in Germany
youth2023$migback[youth2023$staat_geb_person == 1 & youth2023$staat_geb_vater == 1 & youth2023$staat_geb_mutter == 2] <- "mother"
# Self not born in Germany
youth2023$migback[youth2023$staat_geb_person == 2] <- "self"
# If both parents in Germany, assume self is also born in germany
# Only relevant for missing reports of own country
youth2023$migback[youth2023$staat_geb_vater == 1 & youth2023$staat_geb_mutter == 1] <- "none"
table(youth2023$migback, useNA = "always")
##
## both father mother none self <NA>
## 146 133 84 2337 221 115
# Dichotomous variable
youth2023$mig_lang <- NA
youth2023$mig_lang[youth2023$migback == "none"|youth2023$migback == "mother"|youth2023$migback == "father"] <- 0
youth2023$mig_lang[youth2023$migback == "self"|youth2023$migback == "both"] <- 1
table(youth2023$mig_lang, useNA = "always")
##
## 0 1 <NA>
## 2554 367 115
# Satisfaction items
# Students were asked for their satisfaction with various things
# Here, we will recode the items so that higher values indicate more satisfaction
# For all items that are comparable between the 2010, 2015 and 2023 Youth Surveys
youth2023$satis <- 6 - youth2023$f02a
youth2023$satis_money <- 6 - youth2023$f02b
youth2023$satis_friends <- 6 - youth2023$f02c
youth2023$satis_mom <- 6 - youth2023$f02d
youth2023$satis_dad <- 6 - youth2023$f02e
youth2023$satis_leisure <- 6 - youth2023$f02h
youth2023$satis_dwell <- 6 - youth2023$f02i
youth2023$satis_grades <- 6 - youth2023$f02f
# Grade-level
table(youth2023$klassenstufe)
##
## 1 2 3 4 5 6 7 8 9
## 531 477 432 345 179 129 540 269 134
# 1: 7, 2: 8, 3: 9, 4: 10, 5: 11, 6: 12
youth2023$grade_level <- NA
youth2023$grade_level[youth2023$klassenstufe == 1] <- 7
youth2023$grade_level[youth2023$klassenstufe == 2] <- 8
youth2023$grade_level[youth2023$klassenstufe == 3] <- 9
youth2023$grade_level[youth2023$klassenstufe == 4] <- 10
youth2023$grade_level[youth2023$klassenstufe == 5] <- 11
youth2023$grade_level[youth2023$klassenstufe == 6] <- 12
# Gender
# Absolute numbers
table(youth2023$gender)
##
## diverse female male
## 83 1520 1394
# Proportions
round(prop.table(table(youth2023$gender)), digits = 2)
##
## diverse female male
## 0.03 0.51 0.47
# Age
table(youth2023$age)
##
## 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
## 118 396 446 421 366 295 274 161 125 99 76 51 28 19 20 16 8 5 4 3
## 32 33 34 35 36 37 38 39 41 42 43 44 45 46 49
## 3 4 5 3 4 3 2 2 2 2 1 2 1 1 1
summary(youth2023$age)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 12.00 14.00 16.00 16.66 18.00 49.00 69
sd(youth2023$age, na.rm = TRUE)
## [1] 3.977811
hist(youth2023$age)
axis(1, at = seq(min(youth2023$age, na.rm = TRUE), max(youth2023$age, na.rm = TRUE), by = 1))
# School types
table(youth2023$schooltype)
##
## 1 2 3 4
## 683 1244 965 144
round(prop.table(table(youth2023$schooltype)), digits = 2)
##
## 1 2 3 4
## 0.22 0.41 0.32 0.05
# 1: Mittelschule, secondary school (grade 7 to 10)
# 2: Gymnasium, grammar school (grade 7 to 11)
# 3: Berufs-/Fachoberschule, vocational school (1st, 2nd, 3rd year)
# 4: Förderschule, special-needs school (grade 7 to 10)
# Migration background
table(youth2023$migback)
##
## both father mother none self
## 146 133 84 2337 221
round(prop.table(table(youth2023$migback)), digits = 2)
##
## both father mother none self
## 0.05 0.05 0.03 0.80 0.08
# And the assumed language at home
table(youth2023$mig_lang)
##
## 0 1
## 2554 367
round(prop.table(table(youth2023$mig_lang)), digits = 2)
##
## 0 1
## 0.87 0.13
# And here are the weights
summary(youth2023$wph)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.3326 0.7908 0.8463 0.9335 1.1023 1.4810
# Reverse-engineering what went into the weights
summary(lm(wph ~ as.factor(gender)*as.factor(schooltype)*as.factor(klassenstufe), data = youth2023))$r.squared
## [1] 0.9998635
# As far as I can tell, the weights are a function of gender, schooltype and grade level (except for some minor deviations, which may be miscodings or result from assigning gender diverse students to one of the two groups)
Generate a variable that identifies each unique classroom in the data.
# youth2010: schule, klasse A/B/C
table(youth2010$klasse)
##
## A B C D E F G H I K L M N
## 5 422 448 310 247 80 44 116 349 165 115 69 41
# I think Klasse within Schule identifies unique classrooms
youth2010$unique_classroom <- paste0(youth2010$schule, youth2010$klasse)
table(youth2010$unique_classroom)
##
## 0B 0C 0E 10C 10D 10E 11B 1B 1C 1D 20B 20C 20D 20E 20F 21B 21C 22B 22C 22D
## 11 7 29 39 33 37 23 12 13 16 20 22 13 18 46 25 21 18 20 15
## 22E 22F 22G 23B 23C 23D 23E 23G 24B 24C 24D 24E 24F 24G 25B 25C 25D 25E 25G 26B
## 20 9 4 37 49 36 1 19 19 22 24 11 18 15 15 22 18 16 6 21
## 26C 26D 27B 27C 28B 28C 2B 2C 2D 2E 30I 31F 31H 31L 32H 32I 32K 33H 33I 33K
## 17 19 36 45 24 26 15 17 8 24 6 7 15 25 13 42 57 18 48 41
## 34I 35H 36L 37H 37I 38L 38M 39I 3B 3C 3D 3E 40I 40L 40M 40N 41H 41I 41K 42H
## 41 17 29 32 47 41 21 78 19 11 16 18 27 20 26 41 5 38 67 16
## 42I 42M 4B 4C 4D 4E 50B 50C 50D 51C 51D 51E 53A 53B 53C 54B 54C 54D 54E 5B
## 22 22 24 15 18 14 10 10 6 5 25 10 5 6 6 5 3 4 6 23
## 5C 6B 6C 6D 7B 7C 7D 7E 8B 8D 9B 9C 9D 9E
## 23 8 15 12 20 21 20 16 11 13 20 19 14 27
length(unique(youth2010$unique_classroom))
## [1] 114
# 114 classrooms in
#table(youth2010$schule)
length(unique(youth2010$schule)) # 38 schools
## [1] 38
str(youth2010$schule) # no labels attached
## num [1:2411] 53 53 53 53 53 1 1 1 1 1 ...
## - attr(*, "label")= chr "Schule:"
## - attr(*, "format.spss")= chr "F2.0"
# generate IDs that contain the year
youth2010$school <- paste("2010", youth2010$schule, sep = "_")
youth2010$unique_classroom <- paste("2010", youth2010$unique_classroom, sep = "_")
# youth2015
# kennung, schulart, ortsteil, Klasse
# class from 1 to 11
length(unique(youth2015$kennung))
## [1] 114
# 114 distinct values -- these are most likely classrooms?
# this variable is schulart + ortsteil + klasse and should identify unique classrooms
# schulart + ortsteil should uniquely identify schools
# only exception: documentation looks like there are two Berufs/fachoberschulen
# in 02 (Zentrum-Suedost)
youth2015$school <- paste0("2015_", youth2015$ortsteil, youth2015$schulart)
table(youth2015$school)
##
## 2015_131 2015_142 2015_212 2015_224 2015_23 2015_233 2015_271 2015_301
## 102 47 65 19 9 46 107 94
## 2015_304 2015_323 2015_401 2015_402 2015_41 2015_412 2015_432 2015_52
## 18 103 131 64 128 53 62 58
## 2015_521 2015_532 2015_533 2015_543 2015_643 2015_651 2015_652 2015_654
## 42 74 86 11 54 123 66 34
## 2015_703 2015_711 2015_723 2015_742 2015_812 2015_901 2015_902 2015_912
## 48 116 51 49 40 107 34 48
## 2015_933 2015_NANA
## 162 4
youth2015$school[youth2015$school == "NANA"] <- NA
length(unique(youth2015$school)) # 34 schools
## [1] 34
youth2015$unique_classroom <- paste(2015, youth2015$kennung, sep = "_")
# youth2023
names(youth2023)
## [1] "rawid" "pseudonym"
## [3] "password" "language"
## [5] "source" "filename"
## [7] "filenames" "zeit"
## [9] "duration_seconds" "f01a"
## [11] "f01b" "f01c"
## [13] "f01d" "f01e"
## [15] "f01f" "f01g"
## [17] "f01h" "f01i"
## [19] "f01j" "f01k"
## [21] "f01l" "f01m"
## [23] "f01n" "f01o"
## [25] "f02a" "f02b"
## [27] "f02c" "f02d"
## [29] "f02e" "f02f"
## [31] "f02g" "f02h"
## [33] "f02i" "f03a"
## [35] "f03b" "f03c"
## [37] "f03d" "f03e"
## [39] "f04a" "f04b"
## [41] "f04c" "f04d"
## [43] "f04e" "f04f"
## [45] "f04g" "f04h"
## [47] "f04i" "f04j"
## [49] "f04k" "f05a"
## [51] "f05b" "f05c"
## [53] "f05d" "f05e"
## [55] "f05f" "f05g"
## [57] "f05h" "f05i"
## [59] "f06" "f07_15_text"
## [61] "f08_02_text" "f09_02_text"
## [63] "f10_02_text" "f11_02_text"
## [65] "f12a_01" "f12a_02"
## [67] "f12b_01" "f12b_02"
## [69] "f12c_01" "f12c_02"
## [71] "f12d_01" "f12d_02"
## [73] "f13_text" "f14"
## [75] "f15_01" "f15_02"
## [77] "f15_03" "f15_04"
## [79] "f15_05" "f15_06"
## [81] "f15_07" "f15_08"
## [83] "f15_09" "f15_10"
## [85] "f15_11" "f15_13"
## [87] "f15_14" "f15_15"
## [89] "f15_16" "f15_17"
## [91] "f15_18" "f15_19"
## [93] "f15_20" "f15_21"
## [95] "f15_22" "f15_23"
## [97] "f15_24" "f15_25"
## [99] "f15_26" "f15_27"
## [101] "f15_28" "f15_29"
## [103] "f15_30" "f15_31"
## [105] "f15_text" "f16_01"
## [107] "f16_02" "f16_02_text"
## [109] "f17_01" "f17_02"
## [111] "f17_03" "f17_04"
## [113] "f17_05" "f17_06"
## [115] "f17_07" "f17_08"
## [117] "f17_09" "f17_11"
## [119] "f17_13" "f17_14"
## [121] "f17_15" "f17_16"
## [123] "f17_17" "f17_19"
## [125] "f17_21" "f17_22"
## [127] "f17_07_text" "f18_01"
## [129] "f18_02" "f18_03"
## [131] "f18_04" "f18_05"
## [133] "f18_06" "f18_07"
## [135] "f18_08" "f18_09"
## [137] "f18_10" "f18_11"
## [139] "f18_12" "f18_13"
## [141] "f18_text" "f19a_01"
## [143] "f19a_02" "f19b_01"
## [145] "f19b_02" "f19c_01"
## [147] "f19c_02" "f19d_01"
## [149] "f19d_02" "f19e_01"
## [151] "f19e_02" "f19f_text"
## [153] "f20_01" "f20_02"
## [155] "f20_03" "f20_04"
## [157] "f20_05" "f20_06"
## [159] "f20_07" "f20_08"
## [161] "f20_09" "f20_10"
## [163] "f20_11" "f20_12"
## [165] "f20_05_text" "f21"
## [167] "f22a_01" "f22a_02"
## [169] "f22a_03" "f22a_04"
## [171] "f22b_01" "f22b_02"
## [173] "f22b_03" "f22b_04"
## [175] "f22c_01" "f22c_02"
## [177] "f22c_03" "f22c_04"
## [179] "f23a" "f23b"
## [181] "f23c" "f23d"
## [183] "f23e" "f23f"
## [185] "f23g" "f23h"
## [187] "f23i_text" "f23i_01"
## [189] "f23i_02" "f23i_03"
## [191] "f23i_04" "f23i_05"
## [193] "f23i_06" "f23i_07"
## [195] "f23i_08" "f23i_09"
## [197] "f23i_10" "f23i_11"
## [199] "f23i_12" "f23i_13"
## [201] "f23i_14" "f23i_15"
## [203] "f23i_16" "f23i_17"
## [205] "f23i_18" "f24a_01"
## [207] "f24a_02" "f24b_01"
## [209] "f24b_02" "f24c_01"
## [211] "f24c_02" "f25a_roh"
## [213] "f25b_roh" "f26_01"
## [215] "f26_02" "f26_03"
## [217] "f26_04" "f26_05"
## [219] "f26_06" "f26_07"
## [221] "f26_08" "f26_09"
## [223] "f26_10" "f26_11"
## [225] "f26_12" "f26_13"
## [227] "f26_14" "f26_15"
## [229] "f26_16" "f26_17"
## [231] "f26_18" "f26_19"
## [233] "f26_20" "f26_21"
## [235] "f26_22" "f26_23"
## [237] "f26_11_text" "geschl"
## [239] "alter" "plz"
## [241] "staat_geb_person" "staat_geb_mutter"
## [243] "staat_geb_vater" "hhstat"
## [245] "hhstat_text" "f32"
## [247] "f33a" "f33b"
## [249] "f34" "f35"
## [251] "f36" "f37_01"
## [253] "f37_02" "f37_03"
## [255] "f37_04" "f37_05"
## [257] "f38" "f39a"
## [259] "f39b" "f39c"
## [261] "f39d" "f39e"
## [263] "f39f" "f39g"
## [265] "f39h_text" "f39h_01"
## [267] "f39h_02" "f39h_03"
## [269] "f39h_04" "f39h_05"
## [271] "f39h_06" "f39h_07"
## [273] "f39h_08" "f39h_09"
## [275] "f39h_10" "f39h_11"
## [277] "f39h_12" "f39h_13"
## [279] "f39h_14" "f39h_15"
## [281] "f39h_16" "f39h_17"
## [283] "f39h_18" "f39h_19"
## [285] "f39h_20" "f39h_21"
## [287] "f39h_22" "f39h_23"
## [289] "f40_01" "f40_02"
## [291] "f40_03" "f40_04"
## [293] "f40_05" "f40_06"
## [295] "f40_07" "f40_08"
## [297] "f40_09" "f40_10"
## [299] "f40_11" "f40_12"
## [301] "f40_13" "f40_14"
## [303] "f40_06_text" "f41a"
## [305] "f41b" "f41c"
## [307] "f41d" "f41e"
## [309] "f41f" "f41g"
## [311] "f41h" "f41i"
## [313] "f41j" "f41k"
## [315] "f41l_text" "f42_01"
## [317] "f42_02" "f42_03"
## [319] "f43" "f44"
## [321] "f45a" "f45b"
## [323] "f45c" "f45d"
## [325] "f45e" "f45f"
## [327] "f45g" "f45h_text"
## [329] "f46a" "f46b"
## [331] "f46c" "f46d"
## [333] "f46e" "f46f"
## [335] "f46g" "f46h"
## [337] "f47a" "f47b"
## [339] "f47c" "f47d"
## [341] "f47e" "f47a_dich"
## [343] "f47b_dich" "f47c_dich"
## [345] "f47d_dich" "f47e_dich"
## [347] "f48" "f49"
## [349] "f50" "f51a_01"
## [351] "f51a_02" "f51b_01"
## [353] "f51b_02" "f51c_01"
## [355] "f51c_02" "f51d_01"
## [357] "f51d_02" "f51e_01"
## [359] "f51e_02" "f51f_01"
## [361] "f51f_02" "f51g_01"
## [363] "f51g_02" "f51h_01"
## [365] "f51h_02" "f51i_01"
## [367] "f51i_02" "f52a"
## [369] "f52b" "f52c"
## [371] "f52d" "f52e"
## [373] "f52f" "f52g"
## [375] "f52h" "f53a"
## [377] "f53b" "f53c"
## [379] "f53d" "f53e"
## [381] "f54_text" "f54_01"
## [383] "f54_02" "f54_03"
## [385] "f54_04" "f54_05"
## [387] "f54_06" "f54_07"
## [389] "f54_08" "f54_09"
## [391] "f54_10" "f54_11"
## [393] "f54_12" "f54_13"
## [395] "f54_14" "f54_15"
## [397] "f54_16" "f54_17"
## [399] "f54_18" "f54_19"
## [401] "f54_20" "f54_21"
## [403] "f55_text" "f55_01"
## [405] "f55_02" "f55_03"
## [407] "f55_04" "f55_05"
## [409] "f55_06" "f55_07"
## [411] "f55_08" "f55_09"
## [413] "f55_10" "f55_11"
## [415] "f55_12" "f55_13"
## [417] "f55_14" "f55_15"
## [419] "f55_16" "f55_17"
## [421] "f55_18" "f55_19"
## [423] "f55_20" "f55_21"
## [425] "f55_22" "f55_23"
## [427] "f55_24" "datum_amt51"
## [429] "schule_amt51" "ort_amt51"
## [431] "tablet_amt51" "klasse_amt51"
## [433] "schulart_amt51" "zeit_amt51"
## [435] "bildungsgang_amt51" "f25a"
## [437] "f25b" "klassenstufe"
## [439] "klassenstufe_klasse" "altersgruppe_klasse"
## [441] "schulart" "altgr"
## [443] "geschl_altgr" "schulart2"
## [445] "f07_01" "f07_02"
## [447] "f07_03" "f07_04"
## [449] "f07_05" "f07_06"
## [451] "f07_07" "f07_08"
## [453] "f07_09" "f07_10"
## [455] "f07_11" "f07_12"
## [457] "f07_13" "f07_14"
## [459] "f07_15" "f07_16"
## [461] "f07_17" "f07_18"
## [463] "f07_19" "f07_20"
## [465] "f07_21" "f07_22"
## [467] "f07_23" "f07_24"
## [469] "f07_25" "f08_01"
## [471] "f08_02" "f08_02_01"
## [473] "f08_02_02" "f08_02_03"
## [475] "f08_02_04" "f08_02_05"
## [477] "f08_02_06" "f08_02_07"
## [479] "f08_02_08" "f08_02_10"
## [481] "f08_02_11" "f08_02_13"
## [483] "f08_02_14" "f08_02_16"
## [485] "f08_02_17" "f08_02_18"
## [487] "f08_02_19" "f08_02_20"
## [489] "f08_02_21" "f08_02_22"
## [491] "f08_02_23" "f08_02_24"
## [493] "f09_01" "f09_02"
## [495] "f09_02_01" "f09_02_02"
## [497] "f09_02_03" "f09_02_04"
## [499] "f09_02_05" "f09_02_06"
## [501] "f09_02_07" "f09_02_08"
## [503] "f09_02_10" "f09_02_11"
## [505] "f09_02_13" "f09_02_14"
## [507] "f09_02_16" "f09_02_17"
## [509] "f09_02_18" "f09_02_19"
## [511] "f09_02_20" "f09_02_21"
## [513] "f09_02_22" "f09_02_23"
## [515] "f09_02_24" "f09_02_25"
## [517] "f10_01" "f10_02"
## [519] "f10_02_01" "f10_02_02"
## [521] "f10_02_03" "f10_02_04"
## [523] "f10_02_05" "f10_02_06"
## [525] "f10_02_07" "f10_02_08"
## [527] "f10_02_10" "f10_02_11"
## [529] "f10_02_13" "f10_02_16"
## [531] "f10_02_17" "f10_02_18"
## [533] "f10_02_19" "f10_02_20"
## [535] "f10_02_21" "f10_02_22"
## [537] "f10_02_23" "f10_02_24"
## [539] "f10_02_25" "f11_01"
## [541] "f11_02" "f11_02_01"
## [543] "f11_02_02" "f11_02_03"
## [545] "f11_02_04" "f11_02_05"
## [547] "f11_02_06" "f11_02_07"
## [549] "f11_02_08" "f11_02_10"
## [551] "f11_02_13" "f11_02_14"
## [553] "f11_02_16" "f11_02_17"
## [555] "f11_02_18" "f11_02_19"
## [557] "f11_02_20" "f11_02_21"
## [559] "f11_02_22" "f11_02_23"
## [561] "f11_02_24" "f11_02_25"
## [563] "errors_before" "kommentar"
## [565] "historie" "stadt"
## [567] "bundesland" "plz_diff"
## [569] "planungsraum_schueler" "sbz_schule"
## [571] "planungsraum_schule" "f10_02_12"
## [573] "f10_02_14" "f11_02_12"
## [575] "f32_chop" "klassenstufe2"
## [577] "schulart_orig" "schulart3"
## [579] "schulart_klasse" "altgr2"
## [581] "altgr3" "altgr1"
## [583] "geschl_mw" "arbzeit_eltern"
## [585] "f32_diff" "einwanderungsgeschichte"
## [587] "einwanderungsgeschichte2" "zufr"
## [589] "sport_aktiv" "sport_mitglied"
## [591] "jugendtreffbesucher" "engagement_jugend_org"
## [593] "familie_finanz" "f35_diff"
## [595] "nachhilfe" "schulessen"
## [597] "mobbing" "schulabsent"
## [599] "diskriminierung" "raucher"
## [601] "trinker" "trinker_dich"
## [603] "drogenkonsum" "schulweg"
## [605] "f49_chop" "id"
## [607] "f08_02_copy" "f09_02_copy"
## [609] "f10_02_copy" "f11_02_copy"
## [611] "wph" "f13_01"
## [613] "f13_02" "f13_03"
## [615] "f13_04" "f13_05"
## [617] "f13_06" "f13_07"
## [619] "f13_08" "f13_09"
## [621] "f13_10" "f13_11"
## [623] "f13_12" "f13_13"
## [625] "f13_14" "f13_15"
## [627] "f13_16" "f13_17"
## [629] "f13_18" "f13_19"
## [631] "f13_20" "f13_21"
## [633] "f13_22" "f13_23"
## [635] "f13_24" "f13_25"
## [637] "f13_26" "f13_27"
## [639] "f13_28" "f13_29"
## [641] "f13_30" "year"
## [643] "schooltype" "gender"
## [645] "age" "migback"
## [647] "mig_lang" "satis"
## [649] "satis_money" "satis_friends"
## [651] "satis_mom" "satis_dad"
## [653] "satis_leisure" "satis_dwell"
## [655] "satis_grades" "grade_level"
# klassenstufe, schulart, schule_amt51, klasse_amt51, schulart
#table(youth2023$schule_amt51, useNA = "always")
#table(youth2023$klasse_amt51, useNA = "always")
youth2023$test <- paste0("2023_", youth2023$schule_amt51, youth2023$klasse_amt51)
length(unique(youth2023$test)) # 168 -- these must identify unique classrooms
## [1] 168
youth2023$unique_classroom <- youth2023$test
youth2023$school <- paste0("2023_", youth2023$schule_amt51)
In 2023, some students answered the survey on tablets. Let’s generate a source variable for the other years as well (everybody was assessed on paper).
# mode variable
youth2010$source <- "paper"
youth2015$source <- "paper"
Generate a variable that identifies each identifies identical schools across years.
mapping <- read.csv("Mapping_schools.csv", sep = ";")
# 2010
mapping_2010 <- mapping[mapping$Year == 2010,]
names(mapping_2010)[names(mapping_2010) == "Code"] <- "schule"
mapping_2010 <- mapping_2010[, c("schule", "school_id")]
youth2010 <- merge(youth2010, mapping_2010, by = "schule")
# all successfully matched
# 2015
library(haven)
youth2015_school <- read_spss("Files/jugend2015Schule.sav")
mapping_2015 <- mapping[mapping$Year == 2015,]
# First three numbers of kennung identify schools
youth2015_school$schule <- substr(youth2015_school$kennung, 1, 3)
names(mapping_2015)[names(mapping_2015) == "Code"] <- "schule"
mapping_2015 <- mapping_2015[, c("schule", "school_id")]
youth2015_school <- merge(youth2015_school, mapping_2015, by = "schule", all.x = TRUE)
youth2015_school <- youth2015_school[, c("rawid", "school_id")]
youth2015 <- merge(youth2015, youth2015_school, by = "rawid", all.x = TRUE)
rm(youth2015_school)
# 2023: Here, we do have a proper variable
# in the main dataset, containing all names
mapping_2023 <- mapping[mapping$Year == 2023,]
names(mapping_2023)[names(mapping_2023) == "Name"] <- "schule_amt51"
mapping_2023 <- mapping_2023[, c("schule_amt51", "school_id")]
youth2023 <- merge(youth2023, mapping_2023, by = "schule_amt51", all.x = TRUE)
table(youth2023[is.na(youth2023$school_id), "schule_amt51"])
##
## Förderzentrum FS Sprache "Käthe Kollwitz"
## 7
## Ruth-Pfau-Schule, BSZ für Gesundheit und Sozialwesen der Stadt Leipzig\r\n
## 89
# Two schools have not been successfully matched due to special characters in their names
# Manually fix those
youth2023$school_id[youth2023$schule_amt51 == "Förderzentrum FS Sprache \"Käthe Kollwitz\""] <- 35
youth2023$school_id[youth2023$schule_amt51 == "Ruth-Pfau-Schule, BSZ für Gesundheit und Sozialwesen der Stadt Leipzig\r\n"] <- 29
Let’s create one dataframe for everything we will need later.
# Add unique ids
intersect(youth2010$pnum, youth2015$rawid)
## numeric(0)
intersect(youth2010$pnum, youth2023$rawid)
## numeric(0)
intersect(youth2023$rawid, youth2015$rawid)
## numeric(0)
# none of these values intersect, so we can use them
youth2010$id <- youth2010$pnum
youth2015$id <- youth2015$rawid
youth2023$id <- youth2023$rawid
vars <- c("id", "year", "schooltype", "gender", "age", "mig_lang", "migback",
"satis", "satis_money", "satis_friends", "satis_mom", "satis_dad",
"satis_leisure", "satis_dwell", "satis_grades", "school", "unique_classroom", "school_id", "source", "grade_level")
combined <- rbind(youth2010[, vars], youth2015[, vars], youth2023[, vars])
# Anonymize unique_classrooms
combined$unique_classroom <- as.factor(combined$unique_classroom)
combined$unique_classroom <- factor(combined$unique_classroom,
levels = levels(combined$unique_classroom),
labels = seq_along(levels(combined$unique_classroom)))
table(youth2010$gender)
##
## female male
## 1191 1210
table(youth2015$gender)
##
## female male
## 1207 1029
table(youth2023$gender)
##
## diverse female male
## 83 1520 1394
To simply the research question somewhat, we will limit ourselves to students in particular schooltypes, of certain ages. In the German system and in Leipzig, the standard is that after primary school, students attend either Mittelschule or Gymnasium. Special needs school target a different population that may have shifted over time, due to both changes in the criteria for special schools, and to intentional changes to the survey design (the 2023 Survey intentionally oversampled students from Förderschule). Students who finished Mittelschule (or, less frequently, Gymnasium), may move on to Berufs-/Fachoberschule. But this is a heterogeneous crowd, mixing people living at home and those who have moved out. So, our analysis will focus on Mittelschule and Gymnasium – and within those, students with typical ages
combined_original <- combined
##################
# Numbers included in Table 1: Data set
##################
# Total n per year
table(combined_original$year)
##
## 2010 2015 2023
## 2411 2255 3036
# Classrooms per year
length(unique(combined_original$unique_classroom[combined_original$year == 2010]))
## [1] 114
length(unique(combined_original$unique_classroom[combined_original$year == 2015]))
## [1] 114
length(unique(combined_original$unique_classroom[combined_original$year == 2023]))
## [1] 168
# Schools per year
length(unique(combined_original$school[combined_original$year == 2010]))
## [1] 38
length(unique(combined_original$school_id[combined_original$year == 2015]))
## [1] 31
length(unique(combined_original$school[combined_original$year == 2023]))
## [1] 64
# Schooltype
round(prop.table(table(combined_original$schooltype[combined_original$year == 2010], useNA = "always")), 2)
##
## 1 2 3 4 <NA>
## 0.28 0.32 0.36 0.04 0.00
round(prop.table(table(combined_original$schooltype[combined_original$year == 2015], useNA = "always")), 2)
##
## 1 2 3 4 <NA>
## 0.29 0.42 0.25 0.03 0.00
round(prop.table(table(combined_original$schooltype[combined_original$year == 2023], useNA = "always")), 2)
##
## 1 2 3 4 <NA>
## 0.22 0.41 0.32 0.05 0.00
# Gender
round(prop.table(table(combined_original$gender[combined_original$year == 2010], useNA = "always")), 2)
##
## female male <NA>
## 0.49 0.50 0.00
round(prop.table(table(combined_original$gender[combined_original$year == 2015], useNA = "always")), 2)
##
## female male <NA>
## 0.54 0.46 0.01
round(prop.table(table(combined_original$gender[combined_original$year == 2023], useNA = "always")), 2)
##
## diverse female male <NA>
## 0.03 0.50 0.46 0.01
# Age
combined_original$age[combined_original$age <= 11] <- 11
combined_original$age[combined_original$age >= 19] <- 19
round(prop.table(table(combined_original$age[combined_original$year == 2010], useNA = "always")), 2)
##
## 11 12 13 14 15 16 17 18 19 <NA>
## 0.00 0.08 0.18 0.14 0.11 0.12 0.12 0.07 0.16 0.01
round(prop.table(table(combined_original$age[combined_original$year == 2015], useNA = "always")), 2)
##
## 12 13 14 15 16 17 18 19 <NA>
## 0.02 0.14 0.18 0.18 0.16 0.15 0.07 0.10 0.00
round(prop.table(table(combined_original$age[combined_original$year == 2023], useNA = "always")), 2)
##
## 12 13 14 15 16 17 18 19 <NA>
## 0.04 0.13 0.15 0.14 0.12 0.10 0.09 0.21 0.02
# Mig
round(prop.table(table(combined_original$mig_lang[combined_original$year == 2010], useNA = "always")), 2)
##
## 0 1 <NA>
## 0.89 0.09 0.02
round(prop.table(table(combined_original$mig_lang[combined_original$year == 2015], useNA = "always")), 2)
##
## 0 1 <NA>
## 0.90 0.09 0.01
round(prop.table(table(combined_original$mig_lang[combined_original$year == 2023], useNA = "always")), 2)
##
## 0 1 <NA>
## 0.84 0.12 0.04
# Exclusion criteria/filter
# Reporting a different gender was not possible in 2010 and 2015
# We thus cannot compare the gender diverse students in 2023 to gender diverse students in earlier years
# Which is why we unfortunately have to exclude them for the present purposes
combined$gender[combined$gender == "diverse"] <- NA
# only keep known gender
combined <- combined[!is.na(combined$gender),]
# known migback
combined <- combined[!is.na(combined$mig_lang),]
# known age
combined <- combined[!is.na(combined$age),]
# known schooltype
combined <- combined[!is.na(combined$schooltype),]
# known outcome
combined <- combined[!is.na(combined$satis),]
combined$gender <- as.factor(combined$gender)
combined$school <- as.factor(combined$school)
combined$unique_classroom <- as.factor(combined$unique_classroom)
# Limit age range
combined <- combined[combined$age >= 12 & combined$age <= 18,]
# Generate a copy with all school types that we will need for something else
combined_all_schooltypes <- combined
# Main analysis sample
combined <- combined[combined$schooltype == 1 | combined$schooltype == 2,]
table(combined$age)
##
## 12 13 14 15 16 17 18
## 336 1051 1066 973 727 438 173
hist(combined$age)
# Standardize the outcome across everyone
combined$satis_std <- scale(combined$satis)
##################
# Numbers included in Table 1: Analysis
##################
# Total n per year
table(combined$year)
##
## 2010 2015 2023
## 1383 1578 1803
# Classrooms per year
length(unique(combined$unique_classroom[combined$year == 2010]))
## [1] 73
length(unique(combined$unique_classroom[combined$year == 2015]))
## [1] 84
length(unique(combined$unique_classroom[combined$year == 2023]))
## [1] 110
# Schools per year
length(unique(combined$school[combined$year == 2010]))
## [1] 21
length(unique(combined$school[combined$year == 2015]))
## [1] 21
length(unique(combined$school[combined$year == 2023]))
## [1] 33
# Schooltype
round(prop.table(table(combined$schooltype[combined$year == 2010], useNA = "always")), 2)
##
## 1 2 <NA>
## 0.46 0.54 0.00
round(prop.table(table(combined$schooltype[combined$year == 2015], useNA = "always")), 2)
##
## 1 2 <NA>
## 0.41 0.59 0.00
round(prop.table(table(combined$schooltype[combined$year == 2023], useNA = "always")), 2)
##
## 1 2 <NA>
## 0.35 0.65 0.00
# Gender
round(prop.table(table(combined$gender[combined$year == 2010], useNA = "always")), 2)
##
## female male <NA>
## 0.51 0.49 0.00
round(prop.table(table(combined$gender[combined$year == 2015], useNA = "always")), 2)
##
## female male <NA>
## 0.55 0.45 0.00
round(prop.table(table(combined$gender[combined$year == 2023], useNA = "always")), 2)
##
## female male <NA>
## 0.5 0.5 0.0
# Age
combined$age[combined$age <= 11] <- 11
combined$age[combined$age >= 19] <- 19
round(prop.table(table(combined$age[combined$year == 2010], useNA = "always")), 2)
##
## 12 13 14 15 16 17 18 <NA>
## 0.14 0.29 0.21 0.16 0.10 0.06 0.03 0.00
round(prop.table(table(combined$age[combined$year == 2015], useNA = "always")), 2)
##
## 12 13 14 15 16 17 18 <NA>
## 0.02 0.18 0.24 0.25 0.18 0.11 0.02 0.00
round(prop.table(table(combined$age[combined$year == 2023], useNA = "always")), 2)
##
## 12 13 14 15 16 17 18 <NA>
## 0.06 0.20 0.22 0.20 0.17 0.10 0.06 0.00
# Mig
round(prop.table(table(combined$mig_lang[combined$year == 2010], useNA = "always")), 2)
##
## 0 1 <NA>
## 0.9 0.1 0.0
round(prop.table(table(combined$mig_lang[combined$year == 2015], useNA = "always")), 2)
##
## 0 1 <NA>
## 0.91 0.09 0.00
round(prop.table(table(combined$mig_lang[combined$year == 2023], useNA = "always")), 2)
##
## 0 1 <NA>
## 0.87 0.13 0.00
# Fix some data types
# combined$year <- as.factor(combined$year)
combined$satis <- as.numeric(combined$satis)
save.image("prep.RData")