PACO-SIM – Daten einlesen & aufbereiten

Starter-Code | KI Workshop Part 2

Datensatz

paco_sim_workshop.csv — 500 Kinder, bis zu 21 Tagebuchmesspunkte pro Kind (Long-Format).

Tipp: Komposita müssen selbst gebildet werden (rowMeans über die drei Items je Konstrukt). Der Datensatz enthält nur die Einzelitems.


Starter-Code (Base-R)

# ── 1. Daten einlesen ──────────────────────────────────────────────────────────
data_raw <- read.csv("paco_sim_workshop.csv", stringsAsFactors = FALSE)

# Schulform als Faktor (sinnvolle Reihenfolge)
data_raw$school_type <- factor(
  data_raw$school_type,
  levels = c("Grundschule", "Hauptschule", "Realschule", "Gymnasium")
)

# ── 2. Überblick ───────────────────────────────────────────────────────────────
str(data_raw)
'data.frame':   8789 obs. of  18 variables:
 $ child_id            : int  1 1 1 1 1 1 1 1 1 1 ...
 $ school_type         : Factor w/ 4 levels "Grundschule",..: 4 4 4 4 4 4 4 4 4 4 ...
 $ day                 : int  1 2 3 4 5 6 7 8 9 11 ...
 $ time                : int  0 1 2 3 4 5 6 7 8 10 ...
 $ critical_event      : int  0 0 0 0 0 0 0 0 0 1 ...
 $ days_since_event    : int  0 0 0 0 0 0 0 0 0 0 ...
 $ parent_inv_1        : int  3 3 3 3 3 3 3 3 3 3 ...
 $ parent_inv_2        : int  5 5 5 5 5 5 5 5 5 5 ...
 $ parent_inv_3        : int  5 5 5 5 5 5 5 5 5 5 ...
 $ parent_overload_1   : int  4 4 4 4 4 4 4 4 4 4 ...
 $ parent_overload_2   : int  4 4 4 4 4 4 4 4 4 4 ...
 $ parent_overload_3   : int  4 4 4 4 4 4 4 4 4 4 ...
 $ child_selfefficacy_1: int  6 7 5 6 6 6 6 3 4 4 ...
 $ child_selfefficacy_2: int  4 6 7 6 4 6 6 6 4 3 ...
 $ child_selfefficacy_3: int  5 4 4 6 6 5 5 5 7 6 ...
 $ child_selfesteem_1  : int  5 5 7 2 6 2 6 6 5 3 ...
 $ child_selfesteem_2  : int  6 2 5 4 4 4 5 6 3 5 ...
 $ child_selfesteem_3  : int  6 7 6 3 7 7 5 4 6 6 ...
head(data_raw)
  child_id school_type day time critical_event days_since_event parent_inv_1
1        1   Gymnasium   1    0              0                0            3
2        1   Gymnasium   2    1              0                0            3
3        1   Gymnasium   3    2              0                0            3
4        1   Gymnasium   4    3              0                0            3
5        1   Gymnasium   5    4              0                0            3
6        1   Gymnasium   6    5              0                0            3
  parent_inv_2 parent_inv_3 parent_overload_1 parent_overload_2
1            5            5                 4                 4
2            5            5                 4                 4
3            5            5                 4                 4
4            5            5                 4                 4
5            5            5                 4                 4
6            5            5                 4                 4
  parent_overload_3 child_selfefficacy_1 child_selfefficacy_2
1                 4                    6                    4
2                 4                    7                    6
3                 4                    5                    7
4                 4                    6                    6
5                 4                    6                    4
6                 4                    6                    6
  child_selfefficacy_3 child_selfesteem_1 child_selfesteem_2 child_selfesteem_3
1                    5                  5                  6                  6
2                    4                  5                  2                  7
3                    4                  7                  5                  6
4                    6                  2                  4                  3
5                    6                  6                  4                  7
6                    5                  2                  4                  7
table(data_raw$school_type)

Grundschule Hauptschule  Realschule   Gymnasium 
       2087         525        2616        3561 

Variablenübersicht

Variable Ebene Beschreibung Wertebereich
child_id L1/L2 Personen-ID 1–500
school_type L2 Schulform Gymnasium, Realschule, Hauptschule, Grundschule
day L1 Studientag 1–21
time L1 Tag − 1 (für LMM) 0–20
critical_event L1 Vor/nach Ereignis 0 / 1
child_selfesteem_1–3 L1 Einzelitems Selbstwert 1–7
child_selfefficacy_1–3 L1 Einzelitems Selbstwirksamkeit 1–7
parent_inv_1–3 L2 Einzelitems Elterl. Beteiligung 1–7
parent_overload_1–3 L2 Einzelitems Elterl. Überforderung 1–7

Dieses Dokument ist der Einstiegspunkt für die Aufgaben auf Folie 25. Nach dem Einlesen und der Kompositumbildung könnt ihr direkt mit H1 weitermachen — oder den gesamten Block als Kontext in euren ersten Prompt einbauen.