Students‘ Math Achievement and Highest Educational Level of Parents

Autor*innen: Marcus Kindlinger

Für die Grafik wurden die PISA-Teilnehmenden in zehn nach ihrer Mathematikleistung (WLE, t1) unterschiedene Gruppen (Dezile) aufgeteilt. Die Farben zeigen, wie sich das Bildungsniveau der Eltern der jeweiligen Teilnehmenden in verschiedenen Leistungsgruppen unterscheidet: Während in der leistungsschwächsten Gruppe (erstes Dezil) knapp 25% der Schüler*innen mindestens ein Elternteil mit einem Universitäts- oder vergleichbaren Abschluss vorweisen kann, steigt dieser Anteil im obersten Leistungsdezil auf fast 60%. Umgekehrt verfügen bei über 30% der Schüler*innen im untersten Leistungsdezil die Eltern höchstens über Abschlüsse der Sekundarstufe I; im obersten Leistungsdezil beträgt dieser Wert weniger als 10%.

Die Grafik wurde in Python mithilfe der libraries pandas und matplotlib erstellt.

import pandas as pd
import pyreadstat
import numpy as np
import matplotlib.pyplot as plt

data = pd.read_spss(‚PISA-Plus-2012-2013_Dataset_CF.sav‘)

scale = ‚ma_wle_t1‘
scale_name = ‚Math Achievement (WLE, 2012)‘
scale_name_short = ‚Math Achievement‘
first_cat = ‚achievement_decile‘

second_cat = ‚hisced‘
cat_name = ‚Highest Educational Level of Parents‘
cats = [‚None‘, ‚ISCED 2‘, ‚ISCED 3B, C‘, ‚ISCED 3A, 4‘, ‚ISCED 5B‘ ,’ISCED 5A, 6′]

data[first_cat] = pd.qcut(data[scale], q=10, labels=[‚1st Decile‘, ‚2nd Decile‘, ‚3rd Decile‘, ‚4th Decile‘, ‚5th Decile‘, ‚6th Decile‘, ‚7th Decile‘, ‚8th Decile‘, ‚9th Decile‘, ’10th Decile‘])

data[second_cat].astype(‚category‘)
data[second_cat].cat.set_categories(cats, inplace=True)
second_cat_nums = data[second_cat].value_counts(sort=False).values

data = data.loc[:, [first_cat, second_cat]]
data.dropna(inplace=True)
data = data.pivot(columns=“achievement_decile“, values=“hisced“)

counts = data.apply(lambda x: x.value_counts(normalize=True)).transpose()
fig, ax = plt.subplots()
counts.plot(ax=ax, kind=’bar‘, stacked=True, rot=45, cmap=’coolwarm_r‘, edgecolor=’black‘, linewidth=0.3, width=0.8)
plt.xlabel(scale_name)
handles, labels = ax.get_legend_handles_labels()
ax.xaxis.labelpad = 10
ax.legend(handles[::-1], [‚ISCED 5A, 6 (theoretically oriented tertiary \nand post-graduate, n = {})‘.format(second_cat_nums[-1]), ‚ISCED 5B (vocational tertiary, n = {})‘.format(second_cat_nums[-2]), ‚ISCED 3A, 4 (general upper secondary and/or \nnon-teriary post-secondary, n = {})‘.format(second_cat_nums[-3]), ‚ISCED 3B, C (vocational/pre-vocational\nupper secondary, n = {})‘.format(second_cat_nums[-4]), ‚ISCED 2 (lower secondary, n = {})‘.format(second_cat_nums[-5]), ‚None (n = {})‘.format(second_cat_nums[-6])], title=cat_name, prop={’size‘:8}, bbox_to_anchor=(1, 0.93), labelspacing=1.6, frameon=False)
ax.set_yticks([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
ax.set_yticklabels([‚0%‘, ‚20%‘, ‚40%‘, ‚60%‘, ‚80%‘, ‚100%‘])
ax.tick_params(‚x‘, labelsize=8)
ax.yaxis.grid(color=’gray‘)
ax.set_axisbelow(True)
plt.title(‚Students\‘ {} and {}‘.format(scale_name_short, cat_name), pad=10, loc=’left‘, fontdict={‚fontsize‘: 14})
plt.savefig(‚bars_{}_{}.png‘.format(second_cat, scale), dpi=300, bbox_inches=’tight‘)