class: center, middle, inverse, title-slide # Das Experiment --- ## Warum sollten wir _randomisieren_? Das Fundamentale Problem der _kausalen_ Inferenz: - Auf individueller Ebene können keine kausalen Effekte beobachtet werden - Es gibt keine individuellen Alternativszenarien (außer in "Zurück in die Zukunft") .instructions[Dies bedeutet wir müssen uns durchschnittliche Effekte auf Gruppenebene anschauen!] -- .alert[Wenn wir durchschnittliche Effekte zwischen Gruppen von Personen betrachten wollen, dann funktioniert dies nur, wenn die Gruppen die gleichen Eigenschaften haben.] --- ## Warum sollten wir _randomisieren_? Mit einer ausreichend großen Stichprobe erhalten Sie durch Randomisierung Gruppen, die in ihren (pre-Treatment) Charakteristika gleich sind. Übertragen auf ihr DAG bedeutet die Randomisierung: .alert[Confounder beeinflussen ihr Treatment nicht!] -- .pull-left[ <img src="Experiment_slides_files/figure-html/confounding_fam1-1.png" width="100%" style="display: block; margin: auto;" /> ] -- .pull-right[ <img src="Experiment_slides_files/figure-html/confounding_fam2-1.png" width="100%" style="display: block; margin: auto;" /> ] --- ## Wie wird randomisiert? <img src="./figs/Randomisierung_Schema.png" width="70%" style="display: block; margin: auto;" /> --- ## Validität **Interne Validität:** Misst ihre Methodik das was sie tatsächlich herausfinden wollen? D.h. können Sie die Änderung von Y _kausal_ auf die Änderung von X zurückführen? **Externe Validität:** Lassen sich die Ergebnisse auch auf andere Datensätze übertragen/generalisieren? -- .center[.instructions[Uns interessiert insbesondere die _interne Validität_ unserer Ergebnisse!]] --- ## Probleme für die interne Validität - **Omitted Variables Bias**: Selbstselektion, Attrition (Schwund) - **Trends in den Daten**: Reifung, Globale Trends, Saisonalität, Wiederholung, Regression zur Mitte - **Kalibrierung der Studie**: Messfehler, Zeitrahmen - **Kontamination**: Hawthorne, John Henry, Spillovers --- ## Ommitted Variable Bias **Selbstselektion** - Problem: Personen können selbst entscheiden ob (oder wann) Sie an einem Programm teilnehmen oder nicht - Lösung: Randomisierung in Treatment und Kontrollgruppe und über die Zeit **Attrition (Schwund)** - Problem: Personen die das Experiment verlassen sind unterschiedlich zu denen die bleiben - _Überprüfung_: Wie ähnlich sind die Personen die bleiben zu denen die gehen auf Basis beobachtbarer Charakteristika? --- ## Trends in den Daten **Reifung** - Problem: Personen ändern sich alleine durch zunehmendes Alter zwischen zwei Messungen - Lösung: Kontrollgruppe verwenden um den Trend heraus rechnen zu können **Globale Trends** - Problem: Globale Ereignisse können die Änderung in den Daten erklären - Lösung: Kontrollgruppe verwenden um den Trend heraus rechnen zu können **Saisonalität** - Problem: Änderungen in den Daten basieren auf saisonalen Schwankungen - Lösung: Beobachtungen aus der gleichen Periode miteinander vergleichen --- ## Trends in den Daten **Wiederholung** - Problem: Personen lernen natürlicherweise, wenn Sie immer den gleichen Fragen/Aufgaben ausgesetzt sind - Lösung: Tests verändern, Kontrollgruppen verwenden **Regression zur Mitte** - Problem: Extreme Beobachtungen werden mit der Zeit weniger Extrem (Glück, Pech ...) - Lösung: Keine Ausreiser selektieren, Randomisierung --- ## Kalibrierung der Studie **Falsche Messung** - Problem: Der Output wird nicht richtig gemessen - Lösung: Output muss richtig gemessen werden **Zeitrahmen** - Problem: Studie ist zu kurz (oder zu lange) angelegt - Lösung: Richtigen Zeitrahmen anlegen --- ## Kontamination **Hawthorne Effekt** - Problem: Personen verhalten sich unterscheidlich wenn diese beobachtet werden - Lösung: Versteckte Kontrollgruppen verwenden? **John Henry Effekt** - Problem: Kontrollgruppe arbeitet sehr hart um zu zeigen das sie so gut wie die Treatment Gruppe sind - Lösung: Kontroll und Treatmentgruppe separat halten **Spillover Effekt** - Problem: Kontrollgruppe lernt über die Zeit von der Treatment Gruppe - Lösung: Räumlich getrennte Kontrollgruppen verwenden --- ## Randomisiertes Experiment .alert[Randomisierung löst viele Probleme der internen Validität!] .question[Wie lassen sich die Ergebnisse eines Experiments interpretieren?] -- Schritt 1: Untersuchen Sie ob die demographischen Faktoren und andere Charakteristika zwischen Treatment und Kontrollgruppe ähnlich sind (gebalanced) Schritt 2: Untersuchen Sie die durchschnittlichen Differenzen im Ergebnis zwischen Treatment und Kontrollgruppe --- ## Experiment - Wochenbettdepressionen .alert[Wir wollen uns einem Experiment zuwenden, dessen zeitliche Abfolge Sie hier sehen:] <img src="./figs/Experiment.png" width="70%" style="display: block; margin: auto;" /> .small[Quelle: Baranov, Victoria, Sonia Bhalotra, Pietro Biroli, and Joanna Maselko. 2020. "Maternal Depression, Women's Empowerment, and Parental Investment: Evidence from a Randomized Controlled Trial." American Economic Review, 110 (3): 824-59.] --- ## Experiment - Wochenbettdepressionen **Was sind Wochenbettdepressionen?** **Postpartale Stimmungskrisen** (von lat. partus Geburt, Entbindung) beschreiben psychische Zustände oder Störungen, die in einem **zeitlichen Zusammenhang mit dem Wochenbett** auftreten (lat. post = nach; partus = Entbindung, Trennung).[1] Die Bandbreite der im Wochenbett auftretenden affektiven Zustände reicht von einer leichten Traurigkeit über Depressionen bis hin zu schweren psychotischen Erkrankungen. Quelle: Wikipedia -- .alert[Die Folgen einer Wochenbettdepression können langfristige Effekte auf die ganze Familie haben. Neben den negativen Folgen für die Gesundheit der Frau und des Kindes, verursachen Depressionen auch hohe wirtschaftliche Kosten.] --- ## Experiment - Wochenbettdepressionen ```r thp <- read_csv("../case-study/data/THP_clean.csv") thp %>% select(treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% glimpse() ``` ``` Rows: 1,203 Columns: 10 $ treat <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, … $ depressed_1y <dbl> 1, 0, NA, 0, NA, 1, 1, 0, 0, 0, NA, 0, 0, 0, 0, … $ age_baseline <dbl> 28, 37, NA, 29, NA, 23, 30, 22, 30, 25, NA, 27, … $ kids_no <dbl> 3, 6, NA, 2, NA, 1, 3, 0, 4, 1, NA, 2, 2, 1, 2, … $ first_child <dbl> 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, … $ employed_mo_baseline <dbl> 0, 0, NA, 0, NA, 0, 0, 0, 0, 0, NA, 0, 0, 0, 0, … $ MIL <dbl> 1, 0, NA, 0, NA, 1, 0, 0, 0, 1, NA, 0, 1, 1, 0, … $ maternalgma <dbl> 0, 0, NA, 0, NA, 0, 0, 0, 0, 0, NA, 1, 0, 0, 0, … $ edu_fa_baseline <dbl> 10, 8, NA, 10, NA, 10, 0, 7, 8, 10, NA, 10, 10, … $ employed_fa_baseline <dbl> 1, 0, NA, 1, NA, 1, 1, 1, NA, 1, NA, 1, 0, 1, 1,… ``` --- ## Schritt 1: Unterschiede untersuchen count: false .panel1-balancing-auto[ ```r *thp ``` ] .panel2-balancing-auto[ ``` # A tibble: 1,203 x 394 newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 NA NA 1 <NA> <NA> NA <NA> <NA> 2 226 1 1 No No 0 60 Very good 3 222 6 1 Yes No 0 200 Moderate 4 3 1 1 No No 0 150 Good 5 217 3 1 No No 0 250 0 6 354 1 1 Yes No 0 110 Very good 7 NA NA 1 <NA> <NA> NA <NA> <NA> 8 NA NA 1 <NA> <NA> NA <NA> <NA> 9 225 4 1 No No 0 60 Very good 10 2 4 1 Yes No 0 60 Good # … with 1,193 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-balancing-auto[ ```r thp %>% * filter(THP_sample==1) ``` ] .panel2-balancing-auto[ ``` # A tibble: 903 x 394 newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 NA NA 1 <NA> <NA> NA <NA> <NA> 2 226 1 1 No No 0 60 Very good 3 3 1 1 No No 0 150 Good 4 354 1 1 Yes No 0 110 Very good 5 NA NA 1 <NA> <NA> NA <NA> <NA> 6 NA NA 1 <NA> <NA> NA <NA> <NA> 7 225 4 1 No No 0 60 Very good 8 2 4 1 Yes No 0 60 Good 9 729 1 1 No No 0 65 Good 10 NA NA 1 <NA> <NA> NA <NA> <NA> # … with 893 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% * select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) ``` ] .panel2-balancing-auto[ ``` # A tibble: 903 x 10 treat depressed_1y age_baseline kids_no first_child employed_mo_bas… MIL <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 1 1 28 3 0 0 1 2 1 0 37 6 0 0 0 3 1 0 29 2 0 0 0 4 1 1 23 1 0 0 1 5 1 1 30 3 0 0 0 6 1 0 22 0 1 0 0 7 1 0 30 4 0 0 0 8 1 0 25 1 0 0 1 9 1 0 27 2 0 0 0 10 1 0 26 2 0 0 1 # … with 893 more rows, and 3 more variables: maternalgma <dbl>, # edu_fa_baseline <dbl>, employed_fa_baseline <dbl> ``` ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% * pivot_longer(cols = -treat, names_to = "variable", values_to = "value") ``` ] .panel2-balancing-auto[ ``` # A tibble: 8,127 x 3 treat variable value <dbl> <chr> <dbl> 1 1 depressed_1y 1 2 1 age_baseline 28 3 1 kids_no 3 4 1 first_child 0 5 1 employed_mo_baseline 0 6 1 MIL 1 7 1 maternalgma 0 8 1 edu_fa_baseline 10 9 1 employed_fa_baseline 1 10 1 depressed_1y 0 # … with 8,117 more rows ``` ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% * group_nest(variable) ``` ] .panel2-balancing-auto[ ``` # A tibble: 9 x 2 variable data * <chr> <list<tibble>> 1 age_baseline [903 × 2] 2 depressed_1y [903 × 2] 3 edu_fa_baseline [903 × 2] 4 employed_fa_baseline [903 × 2] 5 employed_mo_baseline [903 × 2] 6 first_child [903 × 2] 7 kids_no [903 × 2] 8 maternalgma [903 × 2] 9 MIL [903 × 2] ``` ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% * mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) ``` ] .panel2-balancing-auto[ ``` # A tibble: 9 x 3 variable data t.test * <chr> <list<tibble>> <list> 1 age_baseline [903 × 2] <tibble [1 × 10]> 2 depressed_1y [903 × 2] <tibble [1 × 10]> 3 edu_fa_baseline [903 × 2] <tibble [1 × 10]> 4 employed_fa_baseline [903 × 2] <tibble [1 × 10]> 5 employed_mo_baseline [903 × 2] <tibble [1 × 10]> 6 first_child [903 × 2] <tibble [1 × 10]> 7 kids_no [903 × 2] <tibble [1 × 10]> 8 maternalgma [903 × 2] <tibble [1 × 10]> 9 MIL [903 × 2] <tibble [1 × 10]> ``` ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% * unnest(t.test) ``` ] .panel2-balancing-auto[ ``` # A tibble: 9 x 12 variable data estimate estimate1 estimate2 statistic p.value parameter <chr> <list<ti> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 age_bas… [903 × 2] 0.505 27 26.5 1.48 1.38e- 1 897. 2 depress… [903 × 2] 0.316 0.589 0.273 9.43 4.57e-20 770. 3 edu_fa_… [903 × 2] 0.134 7.09 6.95 0.507 6.12e- 1 900. 4 employe… [903 × 2] 0.0124 0.913 0.901 0.635 5.26e- 1 888. 5 employe… [903 × 2] 0.0125 0.0341 0.0216 1.14 2.56e- 1 841. 6 first_c… [903 × 2] -0.00586 0.186 0.192 -0.225 8.22e- 1 900. 7 kids_no [903 × 2] 0.172 2.33 2.16 1.43 1.52e- 1 898. 8 materna… [903 × 2] -0.0299 0.05 0.0799 -1.83 6.77e- 2 877. 9 MIL [903 × 2] -0.0642 0.402 0.467 -1.95 5.16e- 2 900. # … with 4 more variables: conf.low <dbl>, conf.high <dbl>, method <chr>, # alternative <chr> ``` ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% unnest(t.test) %>% * mutate( Mean_Treatment = round(estimate2, 2), * Mean_Kontrolle = round(estimate1, 2), * Differenz = -round(estimate, 2), * Signifikanz = round(p.value,2)) ``` ] .panel2-balancing-auto[ ``` # A tibble: 9 x 16 variable data estimate estimate1 estimate2 statistic p.value parameter <chr> <list<ti> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 age_bas… [903 × 2] 0.505 27 26.5 1.48 1.38e- 1 897. 2 depress… [903 × 2] 0.316 0.589 0.273 9.43 4.57e-20 770. 3 edu_fa_… [903 × 2] 0.134 7.09 6.95 0.507 6.12e- 1 900. 4 employe… [903 × 2] 0.0124 0.913 0.901 0.635 5.26e- 1 888. 5 employe… [903 × 2] 0.0125 0.0341 0.0216 1.14 2.56e- 1 841. 6 first_c… [903 × 2] -0.00586 0.186 0.192 -0.225 8.22e- 1 900. 7 kids_no [903 × 2] 0.172 2.33 2.16 1.43 1.52e- 1 898. 8 materna… [903 × 2] -0.0299 0.05 0.0799 -1.83 6.77e- 2 877. 9 MIL [903 × 2] -0.0642 0.402 0.467 -1.95 5.16e- 2 900. # … with 8 more variables: conf.low <dbl>, conf.high <dbl>, method <chr>, # alternative <chr>, Mean_Treatment <dbl>, Mean_Kontrolle <dbl>, # Differenz <dbl>, Signifikanz <dbl> ``` ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% unnest(t.test) %>% mutate( Mean_Treatment = round(estimate2, 2), Mean_Kontrolle = round(estimate1, 2), Differenz = -round(estimate, 2), Signifikanz = round(p.value,2)) %>% * select( Mean_Treatment, Mean_Kontrolle, Differenz, Signifikanz) -> total ``` ] .panel2-balancing-auto[ ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% unnest(t.test) %>% mutate( Mean_Treatment = round(estimate2, 2), Mean_Kontrolle = round(estimate1, 2), Differenz = -round(estimate, 2), Signifikanz = round(p.value,2)) %>% select( Mean_Treatment, Mean_Kontrolle, Differenz, Signifikanz) -> total *rownames(total) <- c("Alter der Mutter", "Depressiv (1 Jahr)", "Bildung des Vaters", "Vater beschäftigt", "Mutter beschäftigt", "Erstes Kind", "Anzahl der Kinder", "Oma im Haus", "Stiefoma im Haus") ``` ] .panel2-balancing-auto[ ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% unnest(t.test) %>% mutate( Mean_Treatment = round(estimate2, 2), Mean_Kontrolle = round(estimate1, 2), Differenz = -round(estimate, 2), Signifikanz = round(p.value,2)) %>% select( Mean_Treatment, Mean_Kontrolle, Differenz, Signifikanz) -> total rownames(total) <- c("Alter der Mutter", "Depressiv (1 Jahr)", "Bildung des Vaters", "Vater beschäftigt", "Mutter beschäftigt", "Erstes Kind", "Anzahl der Kinder", "Oma im Haus", "Stiefoma im Haus") *total ``` ] .panel2-balancing-auto[ ``` # A tibble: 9 x 4 Mean_Treatment Mean_Kontrolle Differenz Signifikanz * <dbl> <dbl> <dbl> <dbl> 1 26.5 27 -0.51 0.14 2 0.27 0.59 -0.32 0 3 6.95 7.09 -0.13 0.61 4 0.9 0.91 -0.01 0.53 5 0.02 0.03 -0.01 0.26 6 0.19 0.19 0.01 0.82 7 2.16 2.33 -0.17 0.15 8 0.08 0.05 0.03 0.07 9 0.47 0.4 0.06 0.05 ``` ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% unnest(t.test) %>% mutate( Mean_Treatment = round(estimate2, 2), Mean_Kontrolle = round(estimate1, 2), Differenz = -round(estimate, 2), Signifikanz = round(p.value,2)) %>% select( Mean_Treatment, Mean_Kontrolle, Differenz, Signifikanz) -> total rownames(total) <- c("Alter der Mutter", "Depressiv (1 Jahr)", "Bildung des Vaters", "Vater beschäftigt", "Mutter beschäftigt", "Erstes Kind", "Anzahl der Kinder", "Oma im Haus", "Stiefoma im Haus") total %>% * kbl(col.names = c("Treatment", "Kontrolle","Differenz","p-Wert"), digits = 2, format = "html", * caption = "Balancing Tabelle für die Grundcharakteristika") ``` ] .panel2-balancing-auto[ <table> <caption>Balancing Tabelle für die Grundcharakteristika</caption> <thead> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> Kontrolle </th> <th style="text-align:right;"> Differenz </th> <th style="text-align:right;"> p-Wert </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Alter der Mutter </td> <td style="text-align:right;"> 26.49 </td> <td style="text-align:right;"> 27.00 </td> <td style="text-align:right;"> -0.51 </td> <td style="text-align:right;"> 0.14 </td> </tr> <tr> <td style="text-align:left;"> Depressiv (1 Jahr) </td> <td style="text-align:right;"> 0.27 </td> <td style="text-align:right;"> 0.59 </td> <td style="text-align:right;"> -0.32 </td> <td style="text-align:right;"> 0.00 </td> </tr> <tr> <td style="text-align:left;"> Bildung des Vaters </td> <td style="text-align:right;"> 6.95 </td> <td style="text-align:right;"> 7.09 </td> <td style="text-align:right;"> -0.13 </td> <td style="text-align:right;"> 0.61 </td> </tr> <tr> <td style="text-align:left;"> Vater beschäftigt </td> <td style="text-align:right;"> 0.90 </td> <td style="text-align:right;"> 0.91 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.53 </td> </tr> <tr> <td style="text-align:left;"> Mutter beschäftigt </td> <td style="text-align:right;"> 0.02 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.26 </td> </tr> <tr> <td style="text-align:left;"> Erstes Kind </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.01 </td> <td style="text-align:right;"> 0.82 </td> </tr> <tr> <td style="text-align:left;"> Anzahl der Kinder </td> <td style="text-align:right;"> 2.16 </td> <td style="text-align:right;"> 2.33 </td> <td style="text-align:right;"> -0.17 </td> <td style="text-align:right;"> 0.15 </td> </tr> <tr> <td style="text-align:left;"> Oma im Haus </td> <td style="text-align:right;"> 0.08 </td> <td style="text-align:right;"> 0.05 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> 0.07 </td> </tr> <tr> <td style="text-align:left;"> Stiefoma im Haus </td> <td style="text-align:right;"> 0.47 </td> <td style="text-align:right;"> 0.40 </td> <td style="text-align:right;"> 0.06 </td> <td style="text-align:right;"> 0.05 </td> </tr> </tbody> </table> ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% unnest(t.test) %>% mutate( Mean_Treatment = round(estimate2, 2), Mean_Kontrolle = round(estimate1, 2), Differenz = -round(estimate, 2), Signifikanz = round(p.value,2)) %>% select( Mean_Treatment, Mean_Kontrolle, Differenz, Signifikanz) -> total rownames(total) <- c("Alter der Mutter", "Depressiv (1 Jahr)", "Bildung des Vaters", "Vater beschäftigt", "Mutter beschäftigt", "Erstes Kind", "Anzahl der Kinder", "Oma im Haus", "Stiefoma im Haus") total %>% kbl(col.names = c("Treatment", "Kontrolle","Differenz","p-Wert"), digits = 2, format = "html", caption = "Balancing Tabelle für die Grundcharakteristika") %>% * kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) ``` ] .panel2-balancing-auto[ <table class="table table-striped table-hover table-condensed table-responsive" style="margin-left: auto; margin-right: auto;"> <caption>Balancing Tabelle für die Grundcharakteristika</caption> <thead> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> Kontrolle </th> <th style="text-align:right;"> Differenz </th> <th style="text-align:right;"> p-Wert </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Alter der Mutter </td> <td style="text-align:right;"> 26.49 </td> <td style="text-align:right;"> 27.00 </td> <td style="text-align:right;"> -0.51 </td> <td style="text-align:right;"> 0.14 </td> </tr> <tr> <td style="text-align:left;"> Depressiv (1 Jahr) </td> <td style="text-align:right;"> 0.27 </td> <td style="text-align:right;"> 0.59 </td> <td style="text-align:right;"> -0.32 </td> <td style="text-align:right;"> 0.00 </td> </tr> <tr> <td style="text-align:left;"> Bildung des Vaters </td> <td style="text-align:right;"> 6.95 </td> <td style="text-align:right;"> 7.09 </td> <td style="text-align:right;"> -0.13 </td> <td style="text-align:right;"> 0.61 </td> </tr> <tr> <td style="text-align:left;"> Vater beschäftigt </td> <td style="text-align:right;"> 0.90 </td> <td style="text-align:right;"> 0.91 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.53 </td> </tr> <tr> <td style="text-align:left;"> Mutter beschäftigt </td> <td style="text-align:right;"> 0.02 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.26 </td> </tr> <tr> <td style="text-align:left;"> Erstes Kind </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.01 </td> <td style="text-align:right;"> 0.82 </td> </tr> <tr> <td style="text-align:left;"> Anzahl der Kinder </td> <td style="text-align:right;"> 2.16 </td> <td style="text-align:right;"> 2.33 </td> <td style="text-align:right;"> -0.17 </td> <td style="text-align:right;"> 0.15 </td> </tr> <tr> <td style="text-align:left;"> Oma im Haus </td> <td style="text-align:right;"> 0.08 </td> <td style="text-align:right;"> 0.05 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> 0.07 </td> </tr> <tr> <td style="text-align:left;"> Stiefoma im Haus </td> <td style="text-align:right;"> 0.47 </td> <td style="text-align:right;"> 0.40 </td> <td style="text-align:right;"> 0.06 </td> <td style="text-align:right;"> 0.05 </td> </tr> </tbody> </table> ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% unnest(t.test) %>% mutate( Mean_Treatment = round(estimate2, 2), Mean_Kontrolle = round(estimate1, 2), Differenz = -round(estimate, 2), Signifikanz = round(p.value,2)) %>% select( Mean_Treatment, Mean_Kontrolle, Differenz, Signifikanz) -> total rownames(total) <- c("Alter der Mutter", "Depressiv (1 Jahr)", "Bildung des Vaters", "Vater beschäftigt", "Mutter beschäftigt", "Erstes Kind", "Anzahl der Kinder", "Oma im Haus", "Stiefoma im Haus") total %>% kbl(col.names = c("Treatment", "Kontrolle","Differenz","p-Wert"), digits = 2, format = "html", caption = "Balancing Tabelle für die Grundcharakteristika") %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>% * kable_paper(full_width = F) ``` ] .panel2-balancing-auto[ <table class="table table-striped table-hover table-condensed table-responsive lightable-paper" style='margin-left: auto; margin-right: auto; font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;'> <caption>Balancing Tabelle für die Grundcharakteristika</caption> <thead> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> Kontrolle </th> <th style="text-align:right;"> Differenz </th> <th style="text-align:right;"> p-Wert </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Alter der Mutter </td> <td style="text-align:right;"> 26.49 </td> <td style="text-align:right;"> 27.00 </td> <td style="text-align:right;"> -0.51 </td> <td style="text-align:right;"> 0.14 </td> </tr> <tr> <td style="text-align:left;"> Depressiv (1 Jahr) </td> <td style="text-align:right;"> 0.27 </td> <td style="text-align:right;"> 0.59 </td> <td style="text-align:right;"> -0.32 </td> <td style="text-align:right;"> 0.00 </td> </tr> <tr> <td style="text-align:left;"> Bildung des Vaters </td> <td style="text-align:right;"> 6.95 </td> <td style="text-align:right;"> 7.09 </td> <td style="text-align:right;"> -0.13 </td> <td style="text-align:right;"> 0.61 </td> </tr> <tr> <td style="text-align:left;"> Vater beschäftigt </td> <td style="text-align:right;"> 0.90 </td> <td style="text-align:right;"> 0.91 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.53 </td> </tr> <tr> <td style="text-align:left;"> Mutter beschäftigt </td> <td style="text-align:right;"> 0.02 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.26 </td> </tr> <tr> <td style="text-align:left;"> Erstes Kind </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.01 </td> <td style="text-align:right;"> 0.82 </td> </tr> <tr> <td style="text-align:left;"> Anzahl der Kinder </td> <td style="text-align:right;"> 2.16 </td> <td style="text-align:right;"> 2.33 </td> <td style="text-align:right;"> -0.17 </td> <td style="text-align:right;"> 0.15 </td> </tr> <tr> <td style="text-align:left;"> Oma im Haus </td> <td style="text-align:right;"> 0.08 </td> <td style="text-align:right;"> 0.05 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> 0.07 </td> </tr> <tr> <td style="text-align:left;"> Stiefoma im Haus </td> <td style="text-align:right;"> 0.47 </td> <td style="text-align:right;"> 0.40 </td> <td style="text-align:right;"> 0.06 </td> <td style="text-align:right;"> 0.05 </td> </tr> </tbody> </table> ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% unnest(t.test) %>% mutate( Mean_Treatment = round(estimate2, 2), Mean_Kontrolle = round(estimate1, 2), Differenz = -round(estimate, 2), Signifikanz = round(p.value,2)) %>% select( Mean_Treatment, Mean_Kontrolle, Differenz, Signifikanz) -> total rownames(total) <- c("Alter der Mutter", "Depressiv (1 Jahr)", "Bildung des Vaters", "Vater beschäftigt", "Mutter beschäftigt", "Erstes Kind", "Anzahl der Kinder", "Oma im Haus", "Stiefoma im Haus") total %>% kbl(col.names = c("Treatment", "Kontrolle","Differenz","p-Wert"), digits = 2, format = "html", caption = "Balancing Tabelle für die Grundcharakteristika") %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>% kable_paper(full_width = F) %>% * add_header_above(c(" ", "Stichprobe Baseline (N = 903)" = 4)) ``` ] .panel2-balancing-auto[ <table class="table table-striped table-hover table-condensed table-responsive lightable-paper" style='margin-left: auto; margin-right: auto; font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;'> <caption>Balancing Tabelle für die Grundcharakteristika</caption> <thead> <tr> <th style="empty-cells: hide;" colspan="1"></th> <th style="padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="4"><div style="border-bottom: 1px solid #00000020; padding-bottom: 5px; ">Stichprobe Baseline (N = 903)</div></th> </tr> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> Kontrolle </th> <th style="text-align:right;"> Differenz </th> <th style="text-align:right;"> p-Wert </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Alter der Mutter </td> <td style="text-align:right;"> 26.49 </td> <td style="text-align:right;"> 27.00 </td> <td style="text-align:right;"> -0.51 </td> <td style="text-align:right;"> 0.14 </td> </tr> <tr> <td style="text-align:left;"> Depressiv (1 Jahr) </td> <td style="text-align:right;"> 0.27 </td> <td style="text-align:right;"> 0.59 </td> <td style="text-align:right;"> -0.32 </td> <td style="text-align:right;"> 0.00 </td> </tr> <tr> <td style="text-align:left;"> Bildung des Vaters </td> <td style="text-align:right;"> 6.95 </td> <td style="text-align:right;"> 7.09 </td> <td style="text-align:right;"> -0.13 </td> <td style="text-align:right;"> 0.61 </td> </tr> <tr> <td style="text-align:left;"> Vater beschäftigt </td> <td style="text-align:right;"> 0.90 </td> <td style="text-align:right;"> 0.91 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.53 </td> </tr> <tr> <td style="text-align:left;"> Mutter beschäftigt </td> <td style="text-align:right;"> 0.02 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.26 </td> </tr> <tr> <td style="text-align:left;"> Erstes Kind </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.01 </td> <td style="text-align:right;"> 0.82 </td> </tr> <tr> <td style="text-align:left;"> Anzahl der Kinder </td> <td style="text-align:right;"> 2.16 </td> <td style="text-align:right;"> 2.33 </td> <td style="text-align:right;"> -0.17 </td> <td style="text-align:right;"> 0.15 </td> </tr> <tr> <td style="text-align:left;"> Oma im Haus </td> <td style="text-align:right;"> 0.08 </td> <td style="text-align:right;"> 0.05 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> 0.07 </td> </tr> <tr> <td style="text-align:left;"> Stiefoma im Haus </td> <td style="text-align:right;"> 0.47 </td> <td style="text-align:right;"> 0.40 </td> <td style="text-align:right;"> 0.06 </td> <td style="text-align:right;"> 0.05 </td> </tr> </tbody> </table> ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% unnest(t.test) %>% mutate( Mean_Treatment = round(estimate2, 2), Mean_Kontrolle = round(estimate1, 2), Differenz = -round(estimate, 2), Signifikanz = round(p.value,2)) %>% select( Mean_Treatment, Mean_Kontrolle, Differenz, Signifikanz) -> total rownames(total) <- c("Alter der Mutter", "Depressiv (1 Jahr)", "Bildung des Vaters", "Vater beschäftigt", "Mutter beschäftigt", "Erstes Kind", "Anzahl der Kinder", "Oma im Haus", "Stiefoma im Haus") total %>% kbl(col.names = c("Treatment", "Kontrolle","Differenz","p-Wert"), digits = 2, format = "html", caption = "Balancing Tabelle für die Grundcharakteristika") %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>% kable_paper(full_width = F) %>% add_header_above(c(" ", "Stichprobe Baseline (N = 903)" = 4)) %>% * footnote(general = "Diese Tabelle testet, wie ausbalanciert die Beobachtungen in der Baseline Stichprobe sind. In den ersten beiden Spalten wird der Mittelwert für die Treatment bzw. Kontrollgruppe für die Baseline Stichprobe gezeigt. Spalte (3) zeigen die Differenz zwischen den Mittelwerten der Treatment und Kontrollgruppe für die jeweilige Stichprobe und die Spalte (4) zeigt die p-Werte und damit ob die einzelnen Mittelwerte statistisch signifikant unterschiedlich voneinander sind.") ``` ] .panel2-balancing-auto[ <table class="table table-striped table-hover table-condensed table-responsive lightable-paper" style='margin-left: auto; margin-right: auto; font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;border-bottom: 0;'> <caption>Balancing Tabelle für die Grundcharakteristika</caption> <thead> <tr> <th style="empty-cells: hide;" colspan="1"></th> <th style="padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="4"><div style="border-bottom: 1px solid #00000020; padding-bottom: 5px; ">Stichprobe Baseline (N = 903)</div></th> </tr> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> Kontrolle </th> <th style="text-align:right;"> Differenz </th> <th style="text-align:right;"> p-Wert </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Alter der Mutter </td> <td style="text-align:right;"> 26.49 </td> <td style="text-align:right;"> 27.00 </td> <td style="text-align:right;"> -0.51 </td> <td style="text-align:right;"> 0.14 </td> </tr> <tr> <td style="text-align:left;"> Depressiv (1 Jahr) </td> <td style="text-align:right;"> 0.27 </td> <td style="text-align:right;"> 0.59 </td> <td style="text-align:right;"> -0.32 </td> <td style="text-align:right;"> 0.00 </td> </tr> <tr> <td style="text-align:left;"> Bildung des Vaters </td> <td style="text-align:right;"> 6.95 </td> <td style="text-align:right;"> 7.09 </td> <td style="text-align:right;"> -0.13 </td> <td style="text-align:right;"> 0.61 </td> </tr> <tr> <td style="text-align:left;"> Vater beschäftigt </td> <td style="text-align:right;"> 0.90 </td> <td style="text-align:right;"> 0.91 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.53 </td> </tr> <tr> <td style="text-align:left;"> Mutter beschäftigt </td> <td style="text-align:right;"> 0.02 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.26 </td> </tr> <tr> <td style="text-align:left;"> Erstes Kind </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.01 </td> <td style="text-align:right;"> 0.82 </td> </tr> <tr> <td style="text-align:left;"> Anzahl der Kinder </td> <td style="text-align:right;"> 2.16 </td> <td style="text-align:right;"> 2.33 </td> <td style="text-align:right;"> -0.17 </td> <td style="text-align:right;"> 0.15 </td> </tr> <tr> <td style="text-align:left;"> Oma im Haus </td> <td style="text-align:right;"> 0.08 </td> <td style="text-align:right;"> 0.05 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> 0.07 </td> </tr> <tr> <td style="text-align:left;"> Stiefoma im Haus </td> <td style="text-align:right;"> 0.47 </td> <td style="text-align:right;"> 0.40 </td> <td style="text-align:right;"> 0.06 </td> <td style="text-align:right;"> 0.05 </td> </tr> </tbody> <tfoot> <tr><td style="padding: 0; " colspan="100%"><span style="font-style: italic;">Note: </span></td></tr> <tr><td style="padding: 0; " colspan="100%"> <sup></sup> Diese Tabelle testet, wie ausbalanciert die Beobachtungen in der Baseline Stichprobe sind. In den ersten beiden Spalten wird der Mittelwert für die Treatment bzw. Kontrollgruppe für die Baseline Stichprobe gezeigt. Spalte (3) zeigen die Differenz zwischen den Mittelwerten der Treatment und Kontrollgruppe für die jeweilige Stichprobe und die Spalte (4) zeigt die p-Werte und damit ob die einzelnen Mittelwerte statistisch signifikant unterschiedlich voneinander sind.</td></tr> </tfoot> </table> ] --- count: false .panel1-balancing-auto[ ```r thp %>% filter(THP_sample==1) %>% select( treat, depressed_1y, age_baseline, kids_no, first_child, employed_mo_baseline, MIL, maternalgma, edu_fa_baseline, employed_fa_baseline) %>% pivot_longer(cols = -treat, names_to = "variable", values_to = "value") %>% group_nest(variable) %>% mutate(t.test = map(data, ~tidy(t.test(value ~ treat, data = .x)))) %>% unnest(t.test) %>% mutate( Mean_Treatment = round(estimate2, 2), Mean_Kontrolle = round(estimate1, 2), Differenz = -round(estimate, 2), Signifikanz = round(p.value,2)) %>% select( Mean_Treatment, Mean_Kontrolle, Differenz, Signifikanz) -> total rownames(total) <- c("Alter der Mutter", "Depressiv (1 Jahr)", "Bildung des Vaters", "Vater beschäftigt", "Mutter beschäftigt", "Erstes Kind", "Anzahl der Kinder", "Oma im Haus", "Stiefoma im Haus") total %>% kbl(col.names = c("Treatment", "Kontrolle","Differenz","p-Wert"), digits = 2, format = "html", caption = "Balancing Tabelle für die Grundcharakteristika") %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>% kable_paper(full_width = F) %>% add_header_above(c(" ", "Stichprobe Baseline (N = 903)" = 4)) %>% footnote(general = "Diese Tabelle testet, wie ausbalanciert die Beobachtungen in der Baseline Stichprobe sind. In den ersten beiden Spalten wird der Mittelwert für die Treatment bzw. Kontrollgruppe für die Baseline Stichprobe gezeigt. Spalte (3) zeigen die Differenz zwischen den Mittelwerten der Treatment und Kontrollgruppe für die jeweilige Stichprobe und die Spalte (4) zeigt die p-Werte und damit ob die einzelnen Mittelwerte statistisch signifikant unterschiedlich voneinander sind.") ``` ] .panel2-balancing-auto[ <table class="table table-striped table-hover table-condensed table-responsive lightable-paper" style='margin-left: auto; margin-right: auto; font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;border-bottom: 0;'> <caption>Balancing Tabelle für die Grundcharakteristika</caption> <thead> <tr> <th style="empty-cells: hide;" colspan="1"></th> <th style="padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="4"><div style="border-bottom: 1px solid #00000020; padding-bottom: 5px; ">Stichprobe Baseline (N = 903)</div></th> </tr> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> Kontrolle </th> <th style="text-align:right;"> Differenz </th> <th style="text-align:right;"> p-Wert </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Alter der Mutter </td> <td style="text-align:right;"> 26.49 </td> <td style="text-align:right;"> 27.00 </td> <td style="text-align:right;"> -0.51 </td> <td style="text-align:right;"> 0.14 </td> </tr> <tr> <td style="text-align:left;"> Depressiv (1 Jahr) </td> <td style="text-align:right;"> 0.27 </td> <td style="text-align:right;"> 0.59 </td> <td style="text-align:right;"> -0.32 </td> <td style="text-align:right;"> 0.00 </td> </tr> <tr> <td style="text-align:left;"> Bildung des Vaters </td> <td style="text-align:right;"> 6.95 </td> <td style="text-align:right;"> 7.09 </td> <td style="text-align:right;"> -0.13 </td> <td style="text-align:right;"> 0.61 </td> </tr> <tr> <td style="text-align:left;"> Vater beschäftigt </td> <td style="text-align:right;"> 0.90 </td> <td style="text-align:right;"> 0.91 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.53 </td> </tr> <tr> <td style="text-align:left;"> Mutter beschäftigt </td> <td style="text-align:right;"> 0.02 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.26 </td> </tr> <tr> <td style="text-align:left;"> Erstes Kind </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.01 </td> <td style="text-align:right;"> 0.82 </td> </tr> <tr> <td style="text-align:left;"> Anzahl der Kinder </td> <td style="text-align:right;"> 2.16 </td> <td style="text-align:right;"> 2.33 </td> <td style="text-align:right;"> -0.17 </td> <td style="text-align:right;"> 0.15 </td> </tr> <tr> <td style="text-align:left;"> Oma im Haus </td> <td style="text-align:right;"> 0.08 </td> <td style="text-align:right;"> 0.05 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> 0.07 </td> </tr> <tr> <td style="text-align:left;"> Stiefoma im Haus </td> <td style="text-align:right;"> 0.47 </td> <td style="text-align:right;"> 0.40 </td> <td style="text-align:right;"> 0.06 </td> <td style="text-align:right;"> 0.05 </td> </tr> </tbody> <tfoot> <tr><td style="padding: 0; " colspan="100%"><span style="font-style: italic;">Note: </span></td></tr> <tr><td style="padding: 0; " colspan="100%"> <sup></sup> Diese Tabelle testet, wie ausbalanciert die Beobachtungen in der Baseline Stichprobe sind. In den ersten beiden Spalten wird der Mittelwert für die Treatment bzw. Kontrollgruppe für die Baseline Stichprobe gezeigt. Spalte (3) zeigen die Differenz zwischen den Mittelwerten der Treatment und Kontrollgruppe für die jeweilige Stichprobe und die Spalte (4) zeigt die p-Werte und damit ob die einzelnen Mittelwerte statistisch signifikant unterschiedlich voneinander sind.</td></tr> </tfoot> </table> ] <style> .panel1-balancing-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-balancing-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-balancing-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- ## Schritt 1: Unterschiede untersuchen <table class="table table-striped table-hover table-condensed table-responsive lightable-paper" style='margin-left: auto; margin-right: auto; font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;border-bottom: 0;'> <caption>Balancing Tabelle für die Grundcharakteristika</caption> <thead> <tr> <th style="empty-cells: hide;" colspan="1"></th> <th style="padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="4"><div style="border-bottom: 1px solid #00000020; padding-bottom: 5px; ">Stichprobe Baseline (N = 903)</div></th> </tr> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> Kontrolle </th> <th style="text-align:right;"> Differenz </th> <th style="text-align:right;"> p-Wert </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Alter der Mutter </td> <td style="text-align:right;"> 26.49 </td> <td style="text-align:right;"> 27.00 </td> <td style="text-align:right;"> -0.51 </td> <td style="text-align:right;"> 0.14 </td> </tr> <tr> <td style="text-align:left;"> Depressiv (1 Jahr) </td> <td style="text-align:right;"> 0.27 </td> <td style="text-align:right;"> 0.59 </td> <td style="text-align:right;"> -0.32 </td> <td style="text-align:right;"> 0.00 </td> </tr> <tr> <td style="text-align:left;"> Bildung des Vaters </td> <td style="text-align:right;"> 6.95 </td> <td style="text-align:right;"> 7.09 </td> <td style="text-align:right;"> -0.13 </td> <td style="text-align:right;"> 0.61 </td> </tr> <tr> <td style="text-align:left;"> Vater beschäftigt </td> <td style="text-align:right;"> 0.90 </td> <td style="text-align:right;"> 0.91 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.53 </td> </tr> <tr> <td style="text-align:left;"> Mutter beschäftigt </td> <td style="text-align:right;"> 0.02 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.26 </td> </tr> <tr> <td style="text-align:left;"> Erstes Kind </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.19 </td> <td style="text-align:right;"> 0.01 </td> <td style="text-align:right;"> 0.82 </td> </tr> <tr> <td style="text-align:left;"> Anzahl der Kinder </td> <td style="text-align:right;"> 2.16 </td> <td style="text-align:right;"> 2.33 </td> <td style="text-align:right;"> -0.17 </td> <td style="text-align:right;"> 0.15 </td> </tr> <tr> <td style="text-align:left;"> Oma im Haus </td> <td style="text-align:right;"> 0.08 </td> <td style="text-align:right;"> 0.05 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> 0.07 </td> </tr> <tr> <td style="text-align:left;"> Stiefoma im Haus </td> <td style="text-align:right;"> 0.47 </td> <td style="text-align:right;"> 0.40 </td> <td style="text-align:right;"> 0.06 </td> <td style="text-align:right;"> 0.05 </td> </tr> </tbody> <tfoot> <tr><td style="padding: 0; " colspan="100%"><span style="font-style: italic;">Note: </span></td></tr> <tr><td style="padding: 0; " colspan="100%"> <sup></sup> Diese Tabelle testet, wie ausbalanciert die Beobachtungen in der Baseline Stichprobe sind. In den ersten beiden Spalten wird der Mittelwert für die Treatment bzw. Kontrollgruppe für die Baseline Stichprobe gezeigt. Spalte (3) zeigen die Differenz zwischen den Mittelwerten der Treatment und Kontrollgruppe für die jeweilige Stichprobe und die Spalte (4) zeigt die p-Werte und damit ob die einzelnen Mittelwerte statistisch signifikant unterschiedlich voneinander sind.</td></tr> </tfoot> </table> --- ## Schritt 1: Unterschiede untersuchen **Wann nutzt uns eine solche Balancing Tabelle?** Wir sollten eine solche Tabelle immer dann erstellen, wenn wir uns nicht ganz sicher sein können, ob unsere Randomisierung erfolgreich war, d.h. insbesondere bei der Untersuchung von Feldexperimenten. - Wenn wir die Randomisierung nicht selbst durchgeführt haben, insbesondere in Feldexperimenten - Bei _Attrition_, d.h. Schwund bei den Teilnehmern des Experiments --- ## Schritt 1: Unterschiede untersuchen .question[Was lernen wir aus der Balancing Tabelle?] Aus dieser Balancing Tabelle lernen wir mehrere Dinge: - In den meisten Grundcharakteristika unterscheiden sich Treatment und Kontrollgruppe **nicht** voneinander. - Einige Variablen sind jedoch signifikant unterschiedlich zwischen Treatment und Kontrollgruppe, insbesondere ob die Oma väterlicherseits oder mütterlicherseits mit im Haushalt lebt. - Wir verlieren einige Teilnehmer über die Zeit (903 -> 704 -> 585 Beobachtungen), d.h. wir haben nach 7 Jahren nur noch 64,8% der Mütter, die ursprünglich am Experiment teilgenommen haben, in der Stichprobe. --- ## Schritt 2: Durchschnittliche Differenzen count: false .panel1-depressionen-auto[ ```r *thp ``` ] .panel2-depressionen-auto[ ``` # A tibble: 1,203 x 394 newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 NA NA 1 <NA> <NA> NA <NA> <NA> 2 226 1 1 No No 0 60 Very good 3 222 6 1 Yes No 0 200 Moderate 4 3 1 1 No No 0 150 Good 5 217 3 1 No No 0 250 0 6 354 1 1 Yes No 0 110 Very good 7 NA NA 1 <NA> <NA> NA <NA> <NA> 8 NA NA 1 <NA> <NA> NA <NA> <NA> 9 225 4 1 No No 0 60 Very good 10 2 4 1 Yes No 0 60 Good # … with 1,193 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-depressionen-auto[ ```r thp %>% * select(treat, depressed_6m, depressed_1y, depressed) ``` ] .panel2-depressionen-auto[ ``` # A tibble: 1,203 x 4 treat depressed_6m depressed_1y depressed <dbl> <dbl> <dbl> <dbl> 1 1 0 1 NA 2 1 0 0 0 3 1 NA NA 0 4 1 0 0 0 5 1 NA NA 0 6 1 1 1 0 7 1 1 1 NA 8 1 0 0 NA 9 1 0 0 0 10 1 0 0 0 # … with 1,193 more rows ``` ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% * mutate(Baseline = 1) ``` ] .panel2-depressionen-auto[ ``` # A tibble: 1,203 x 5 treat depressed_6m depressed_1y depressed Baseline <dbl> <dbl> <dbl> <dbl> <dbl> 1 1 0 1 NA 1 2 1 0 0 0 1 3 1 NA NA 0 1 4 1 0 0 0 1 5 1 NA NA 0 1 6 1 1 1 0 1 7 1 1 1 NA 1 8 1 0 0 NA 1 9 1 0 0 0 1 10 1 0 0 0 1 # … with 1,193 more rows ``` ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% mutate(Baseline = 1) %>% * pivot_longer( cols = -treat, names_to = "name", values_to = "depression") ``` ] .panel2-depressionen-auto[ ``` # A tibble: 4,812 x 3 treat name depression <dbl> <chr> <dbl> 1 1 depressed_6m 0 2 1 depressed_1y 1 3 1 depressed NA 4 1 Baseline 1 5 1 depressed_6m 0 6 1 depressed_1y 0 7 1 depressed 0 8 1 Baseline 1 9 1 depressed_6m NA 10 1 depressed_1y NA # … with 4,802 more rows ``` ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% mutate(Baseline = 1) %>% pivot_longer( cols = -treat, names_to = "name", values_to = "depression") %>% * mutate(name = fct_relevel(name, "Baseline", "depressed_6m", "depressed_1y", "depressed"), * name = fct_recode(name, * "6 Monate" = "depressed_6m", * "1 Jahr" = "depressed_1y", * "7 Jahre" = "depressed"), * treat_factor = as.factor(ifelse(treat == 1, "Treatment", "Kontrolle"))) ``` ] .panel2-depressionen-auto[ ``` # A tibble: 4,812 x 4 treat name depression treat_factor <dbl> <fct> <dbl> <fct> 1 1 6 Monate 0 Treatment 2 1 1 Jahr 1 Treatment 3 1 7 Jahre NA Treatment 4 1 Baseline 1 Treatment 5 1 6 Monate 0 Treatment 6 1 1 Jahr 0 Treatment 7 1 7 Jahre 0 Treatment 8 1 Baseline 1 Treatment 9 1 6 Monate NA Treatment 10 1 1 Jahr NA Treatment # … with 4,802 more rows ``` ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% mutate(Baseline = 1) %>% pivot_longer( cols = -treat, names_to = "name", values_to = "depression") %>% mutate(name = fct_relevel(name, "Baseline", "depressed_6m", "depressed_1y", "depressed"), name = fct_recode(name, "6 Monate" = "depressed_6m", "1 Jahr" = "depressed_1y", "7 Jahre" = "depressed"), treat_factor = as.factor(ifelse(treat == 1, "Treatment", "Kontrolle"))) %>% * ggplot(aes(x = name, y = depression, * color = treat_factor)) ``` ] .panel2-depressionen-auto[ <img src="Experiment_slides_files/figure-html/depressionen_auto_06_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% mutate(Baseline = 1) %>% pivot_longer( cols = -treat, names_to = "name", values_to = "depression") %>% mutate(name = fct_relevel(name, "Baseline", "depressed_6m", "depressed_1y", "depressed"), name = fct_recode(name, "6 Monate" = "depressed_6m", "1 Jahr" = "depressed_1y", "7 Jahre" = "depressed"), treat_factor = as.factor(ifelse(treat == 1, "Treatment", "Kontrolle"))) %>% ggplot(aes(x = name, y = depression, color = treat_factor)) + * scale_color_manual(values = c("#D55E00", "#0072B2")) ``` ] .panel2-depressionen-auto[ <img src="Experiment_slides_files/figure-html/depressionen_auto_07_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% mutate(Baseline = 1) %>% pivot_longer( cols = -treat, names_to = "name", values_to = "depression") %>% mutate(name = fct_relevel(name, "Baseline", "depressed_6m", "depressed_1y", "depressed"), name = fct_recode(name, "6 Monate" = "depressed_6m", "1 Jahr" = "depressed_1y", "7 Jahre" = "depressed"), treat_factor = as.factor(ifelse(treat == 1, "Treatment", "Kontrolle"))) %>% ggplot(aes(x = name, y = depression, color = treat_factor)) + scale_color_manual(values = c("#D55E00", "#0072B2")) + * stat_summary(geom = "pointrange", * fun.data = "mean_se", * fun.args = list(mult=2.33)) ``` ] .panel2-depressionen-auto[ <img src="Experiment_slides_files/figure-html/depressionen_auto_08_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% mutate(Baseline = 1) %>% pivot_longer( cols = -treat, names_to = "name", values_to = "depression") %>% mutate(name = fct_relevel(name, "Baseline", "depressed_6m", "depressed_1y", "depressed"), name = fct_recode(name, "6 Monate" = "depressed_6m", "1 Jahr" = "depressed_1y", "7 Jahre" = "depressed"), treat_factor = as.factor(ifelse(treat == 1, "Treatment", "Kontrolle"))) %>% ggplot(aes(x = name, y = depression, color = treat_factor)) + scale_color_manual(values = c("#D55E00", "#0072B2")) + stat_summary(geom = "pointrange", fun.data = "mean_se", fun.args = list(mult=2.33)) + * ylim(0,1) ``` ] .panel2-depressionen-auto[ <img src="Experiment_slides_files/figure-html/depressionen_auto_09_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% mutate(Baseline = 1) %>% pivot_longer( cols = -treat, names_to = "name", values_to = "depression") %>% mutate(name = fct_relevel(name, "Baseline", "depressed_6m", "depressed_1y", "depressed"), name = fct_recode(name, "6 Monate" = "depressed_6m", "1 Jahr" = "depressed_1y", "7 Jahre" = "depressed"), treat_factor = as.factor(ifelse(treat == 1, "Treatment", "Kontrolle"))) %>% ggplot(aes(x = name, y = depression, color = treat_factor)) + scale_color_manual(values = c("#D55E00", "#0072B2")) + stat_summary(geom = "pointrange", fun.data = "mean_se", fun.args = list(mult=2.33)) + ylim(0,1) + * theme_minimal() ``` ] .panel2-depressionen-auto[ <img src="Experiment_slides_files/figure-html/depressionen_auto_10_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% mutate(Baseline = 1) %>% pivot_longer( cols = -treat, names_to = "name", values_to = "depression") %>% mutate(name = fct_relevel(name, "Baseline", "depressed_6m", "depressed_1y", "depressed"), name = fct_recode(name, "6 Monate" = "depressed_6m", "1 Jahr" = "depressed_1y", "7 Jahre" = "depressed"), treat_factor = as.factor(ifelse(treat == 1, "Treatment", "Kontrolle"))) %>% ggplot(aes(x = name, y = depression, color = treat_factor)) + scale_color_manual(values = c("#D55E00", "#0072B2")) + stat_summary(geom = "pointrange", fun.data = "mean_se", fun.args = list(mult=2.33)) + ylim(0,1) + theme_minimal() + * theme(legend.title = element_blank(), * legend.position = "bottom") ``` ] .panel2-depressionen-auto[ <img src="Experiment_slides_files/figure-html/depressionen_auto_11_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% mutate(Baseline = 1) %>% pivot_longer( cols = -treat, names_to = "name", values_to = "depression") %>% mutate(name = fct_relevel(name, "Baseline", "depressed_6m", "depressed_1y", "depressed"), name = fct_recode(name, "6 Monate" = "depressed_6m", "1 Jahr" = "depressed_1y", "7 Jahre" = "depressed"), treat_factor = as.factor(ifelse(treat == 1, "Treatment", "Kontrolle"))) %>% ggplot(aes(x = name, y = depression, color = treat_factor)) + scale_color_manual(values = c("#D55E00", "#0072B2")) + stat_summary(geom = "pointrange", fun.data = "mean_se", fun.args = list(mult=2.33)) + ylim(0,1) + theme_minimal() + theme(legend.title = element_blank(), legend.position = "bottom") + * labs(x = NULL, * y = "Anteil an Depressionen", * title = "Treatment Effekte auf den Anteil an Depressionen", * caption = "Gezeigt wird der Mittelwert der Gruppen inklusive des 99% Konfidenzintervalls.\nEigene Analysen auf Basis von Baranov et al. (2020)") ``` ] .panel2-depressionen-auto[ <img src="Experiment_slides_files/figure-html/depressionen_auto_12_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-depressionen-auto[ ```r thp %>% select(treat, depressed_6m, depressed_1y, depressed) %>% mutate(Baseline = 1) %>% pivot_longer( cols = -treat, names_to = "name", values_to = "depression") %>% mutate(name = fct_relevel(name, "Baseline", "depressed_6m", "depressed_1y", "depressed"), name = fct_recode(name, "6 Monate" = "depressed_6m", "1 Jahr" = "depressed_1y", "7 Jahre" = "depressed"), treat_factor = as.factor(ifelse(treat == 1, "Treatment", "Kontrolle"))) %>% ggplot(aes(x = name, y = depression, color = treat_factor)) + scale_color_manual(values = c("#D55E00", "#0072B2")) + stat_summary(geom = "pointrange", fun.data = "mean_se", fun.args = list(mult=2.33)) + ylim(0,1) + theme_minimal() + theme(legend.title = element_blank(), legend.position = "bottom") + labs(x = NULL, y = "Anteil an Depressionen", title = "Treatment Effekte auf den Anteil an Depressionen", caption = "Gezeigt wird der Mittelwert der Gruppen inklusive des 99% Konfidenzintervalls.\nEigene Analysen auf Basis von Baranov et al. (2020)") ``` ] .panel2-depressionen-auto[ <img src="Experiment_slides_files/figure-html/depressionen_auto_13_output-1.png" width="70%" style="display: block; margin: auto;" /> ] <style> .panel1-depressionen-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-depressionen-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-depressionen-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- ## Schritt 2: Durchschnittliche Differenzen .pull-left[ <img src="Experiment_slides_files/figure-html/unnamed-chunk-5-1.png" width="70%" style="display: block; margin: auto;" /> ] .pull-right[ - Die Treatmentgruppe hat einen sehr raschen Rückgang bei den Depressionen - Bereits nach 6 Monaten auf rund 25% - Stagniert auf rund 25% auch nach einem Jahr - Geht zurück auf unter 20% nach sieben Jahren - Die Kontrollgruppe verzeichnet auch einen starken Rückgang der Depressionen - Nach 6 Monaten auf etwas mehr als 50% - Stagniert bei etwas über 50% auch nach einem Jahr - Geht zurück auf rund 25% nach sieben Jahren ] -- .alert[Ein naiver Vergleich nur innerhalb der Treatmentgruppe vorher/nachher würde den Effekt des Treatments stark überschätzen!] --- class: inverse, center, middle # Regressionsanalysen --- ## Schritt 2: Durchschnittliche Differenzen count: false .panel1-diffs-auto[ ```r *thp ``` ] .panel2-diffs-auto[ ``` # A tibble: 1,203 x 394 newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 NA NA 1 <NA> <NA> NA <NA> <NA> 2 226 1 1 No No 0 60 Very good 3 222 6 1 Yes No 0 200 Moderate 4 3 1 1 No No 0 150 Good 5 217 3 1 No No 0 250 0 6 354 1 1 Yes No 0 110 Very good 7 NA NA 1 <NA> <NA> NA <NA> <NA> 8 NA NA 1 <NA> <NA> NA <NA> <NA> 9 225 4 1 No No 0 60 Very good 10 2 4 1 Yes No 0 60 Good # … with 1,193 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% * filter(attrit2 == 0 & THP_sample == 1) ``` ] .panel2-diffs-auto[ ``` # A tibble: 585 x 394 newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 226 1 1 No No 0 60 Very good 2 3 1 1 No No 0 150 Good 3 354 1 1 Yes No 0 110 Very good 4 225 4 1 No No 0 60 Very good 5 2 4 1 Yes No 0 60 Good 6 729 1 1 No No 0 65 Good 7 228 4 1 No No 0 300 0 8 180 4 1 No No 0 <NA> Very good 9 178 1 1 No No 0 60 Good 10 224 7 1 Yes No 0 150 Good # … with 575 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% * group_by(treat) ``` ] .panel2-diffs-auto[ ``` # A tibble: 585 x 394 # Groups: treat [2] newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 226 1 1 No No 0 60 Very good 2 3 1 1 No No 0 150 Good 3 354 1 1 Yes No 0 110 Very good 4 225 4 1 No No 0 60 Very good 5 2 4 1 Yes No 0 60 Good 6 729 1 1 No No 0 65 Good 7 228 4 1 No No 0 300 0 8 180 4 1 No No 0 <NA> Very good 9 178 1 1 No No 0 60 Good 10 224 7 1 Yes No 0 150 Good # … with 575 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% * summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 ``` ] .panel2-diffs-auto[ ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 *thp ``` ] .panel2-diffs-auto[ ``` # A tibble: 1,203 x 394 newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 NA NA 1 <NA> <NA> NA <NA> <NA> 2 226 1 1 No No 0 60 Very good 3 222 6 1 Yes No 0 200 Moderate 4 3 1 1 No No 0 150 Good 5 217 3 1 No No 0 250 0 6 354 1 1 Yes No 0 110 Very good 7 NA NA 1 <NA> <NA> NA <NA> <NA> 8 NA NA 1 <NA> <NA> NA <NA> <NA> 9 225 4 1 No No 0 60 Very good 10 2 4 1 Yes No 0 60 Good # … with 1,193 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% * filter(attrit2 == 0 & THP_sample == 1) ``` ] .panel2-diffs-auto[ ``` # A tibble: 585 x 394 newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 226 1 1 No No 0 60 Very good 2 3 1 1 No No 0 150 Good 3 354 1 1 Yes No 0 110 Very good 4 225 4 1 No No 0 60 Very good 5 2 4 1 Yes No 0 60 Good 6 729 1 1 No No 0 65 Good 7 228 4 1 No No 0 300 0 8 180 4 1 No No 0 <NA> Very good 9 178 1 1 No No 0 60 Good 10 224 7 1 Yes No 0 150 Good # … with 575 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% * group_by(treat) ``` ] .panel2-diffs-auto[ ``` # A tibble: 585 x 394 # Groups: treat [2] newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 226 1 1 No No 0 60 Very good 2 3 1 1 No No 0 150 Good 3 354 1 1 Yes No 0 110 Very good 4 225 4 1 No No 0 60 Very good 5 2 4 1 Yes No 0 60 Good 6 729 1 1 No No 0 65 Good 7 228 4 1 No No 0 300 0 8 180 4 1 No No 0 <NA> Very good 9 178 1 1 No No 0 60 Good 10 224 7 1 Yes No 0 150 Good # … with 575 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% * summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 ``` ] .panel2-diffs-auto[ ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 *thp ``` ] .panel2-diffs-auto[ ``` # A tibble: 1,203 x 394 newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 NA NA 1 <NA> <NA> NA <NA> <NA> 2 226 1 1 No No 0 60 Very good 3 222 6 1 Yes No 0 200 Moderate 4 3 1 1 No No 0 150 Good 5 217 3 1 No No 0 250 0 6 354 1 1 Yes No 0 110 Very good 7 NA NA 1 <NA> <NA> NA <NA> <NA> 8 NA NA 1 <NA> <NA> NA <NA> <NA> 9 225 4 1 No No 0 60 Very good 10 2 4 1 Yes No 0 60 Good # … with 1,193 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% * filter(attrit2 == 0 & THP_sample == 1) ``` ] .panel2-diffs-auto[ ``` # A tibble: 585 x 394 newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 226 1 1 No No 0 60 Very good 2 3 1 1 No No 0 150 Good 3 354 1 1 Yes No 0 110 Very good 4 225 4 1 No No 0 60 Very good 5 2 4 1 Yes No 0 60 Good 6 729 1 1 No No 0 65 Good 7 228 4 1 No No 0 300 0 8 180 4 1 No No 0 <NA> Very good 9 178 1 1 No No 0 60 Good 10 224 7 1 Yes No 0 150 Good # … with 575 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% * group_by(treat) ``` ] .panel2-diffs-auto[ ``` # A tibble: 585 x 394 # Groups: treat [2] newid interviewer uc grandmother employed_mo income_mo income_hh genhealth <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> 1 226 1 1 No No 0 60 Very good 2 3 1 1 No No 0 150 Good 3 354 1 1 Yes No 0 110 Very good 4 225 4 1 No No 0 60 Very good 5 2 4 1 Yes No 0 60 Good 6 729 1 1 No No 0 65 Good 7 228 4 1 No No 0 300 0 8 180 4 1 No No 0 <NA> Very good 9 178 1 1 No No 0 60 Good 10 224 7 1 Yes No 0 150 Good # … with 575 more rows, and 386 more variables: edu_mo <dbl>, edu_fa <dbl>, # ideal_no_kids <chr>, no_kids_over5_dead <dbl>, no_kids_1_5_dead <dbl>, # no_kids_less1_dead <dbl>, mo_185 <chr>, mo_358 <chr>, mo_360 <chr>, # c_wt <dbl>, c_ht <dbl>, ch_27 <chr>, ch_28 <chr>, ch_29 <chr>, ch_30 <chr>, # ch_31 <chr>, ch_32 <chr>, ch_33 <chr>, ch_34 <chr>, ch_35 <chr>, # ch_36 <chr>, mo_ht <dbl>, mo_bmi <dbl>, hamd_baseline <dbl>, # bdq_baseline <dbl>, edu_mo_baseline <dbl>, edu_fa_baseline <dbl>, # kids_no <dbl>, var29 <dbl>, mspss_baseline <dbl>, depressed_6m <dbl>, # hamd_6m <dbl>, bdq_6m <dbl>, mspss_6m <dbl>, ses_6m <dbl>, c_wt_6m <dbl>, # c_ht_6m <dbl>, depressed_1y <dbl>, hamd_1y <dbl>, bdq_1y <dbl>, # mspss_1y <dbl>, ses_1y <dbl>, pregnant_12m <dbl>, c_wt_1y <dbl>, # c_ht_1y <dbl>, play_mo_1y <dbl>, play_fa_1y <dbl>, var611 <dbl>, # var618 <dbl>, var619 <dbl>, var620 <dbl>, var621 <dbl>, c_age_int <dbl>, # vci <dbl>, vsi <dbl>, fri <dbl>, wmi <dbl>, psi <dbl>, fsiq <dbl>, # sdq_emo <dbl>, sdq_cond <dbl>, sdq_hyper <dbl>, sdq_peer <dbl>, # sdq_pro <dbl>, sdq_sum <dbl>, home_res <dbl>, home_mat <dbl>, # home_emo <dbl>, home_learn <dbl>, home_enrich <dbl>, home_f_comp <dbl>, # home_f_inter <dbl>, home_env <dbl>, home <dbl>, stroop <dbl>, panic <dbl>, # separation <dbl>, injury_fear <dbl>, social_phobia <dbl>, obc <dbl>, # gad <dbl>, spence <dbl>, three_groups <dbl>, treat <dbl>, attrit <dbl>, # dep_sample <dbl>, Group <dbl>, intervr_1 <dbl>, intervr_2 <dbl>, # intervr_3 <dbl>, intervr_4 <dbl>, intervr_5 <dbl>, intervr_6 <dbl>, # intervr_7 <dbl>, intervr_8 <dbl>, intervr_9 <dbl>, lhw_1 <dbl>, # lhw_2 <dbl>, lhw_3 <dbl>, lhw_4 <dbl>, … ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% * summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 ``` ] .panel2-diffs-auto[ ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 *dep1 ``` ] .panel2-diffs-auto[ ``` # A tibble: 2 x 2 treat dep6m_avg * <dbl> <dbl> 1 0 0.522 2 1 0.201 ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 dep1 %>% * bind_rows(dep2) ``` ] .panel2-diffs-auto[ ``` # A tibble: 4 x 3 treat dep6m_avg depressed_1y <dbl> <dbl> <dbl> 1 0 0.522 NA 2 1 0.201 NA 3 0 NA 0.583 4 1 NA 0.249 ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 dep1 %>% bind_rows(dep2) %>% * bind_rows(dep3) ``` ] .panel2-diffs-auto[ ``` # A tibble: 6 x 4 treat dep6m_avg depressed_1y depressed_avg <dbl> <dbl> <dbl> <dbl> 1 0 0.522 NA NA 2 1 0.201 NA NA 3 0 NA 0.583 NA 4 1 NA 0.249 NA 5 0 NA NA 0.304 6 1 NA NA 0.239 ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 dep1 %>% bind_rows(dep2) %>% bind_rows(dep3) %>% * pivot_longer(cols = -treat, names_to = "depression", values_to = "value" ) ``` ] .panel2-diffs-auto[ ``` # A tibble: 18 x 3 treat depression value <dbl> <chr> <dbl> 1 0 dep6m_avg 0.522 2 0 depressed_1y NA 3 0 depressed_avg NA 4 1 dep6m_avg 0.201 5 1 depressed_1y NA 6 1 depressed_avg NA 7 0 dep6m_avg NA 8 0 depressed_1y 0.583 9 0 depressed_avg NA 10 1 dep6m_avg NA 11 1 depressed_1y 0.249 12 1 depressed_avg NA 13 0 dep6m_avg NA 14 0 depressed_1y NA 15 0 depressed_avg 0.304 16 1 dep6m_avg NA 17 1 depressed_1y NA 18 1 depressed_avg 0.239 ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 dep1 %>% bind_rows(dep2) %>% bind_rows(dep3) %>% pivot_longer(cols = -treat, names_to = "depression", values_to = "value" ) %>% * filter( !is.na(value) ) ``` ] .panel2-diffs-auto[ ``` # A tibble: 6 x 3 treat depression value <dbl> <chr> <dbl> 1 0 dep6m_avg 0.522 2 1 dep6m_avg 0.201 3 0 depressed_1y 0.583 4 1 depressed_1y 0.249 5 0 depressed_avg 0.304 6 1 depressed_avg 0.239 ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 dep1 %>% bind_rows(dep2) %>% bind_rows(dep3) %>% pivot_longer(cols = -treat, names_to = "depression", values_to = "value" ) %>% filter( !is.na(value) ) %>% * pivot_wider( names_from = depression, values_from = value) ``` ] .panel2-diffs-auto[ ``` # A tibble: 2 x 4 treat dep6m_avg depressed_1y depressed_avg <dbl> <dbl> <dbl> <dbl> 1 0 0.522 0.583 0.304 2 1 0.201 0.249 0.239 ``` ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 dep1 %>% bind_rows(dep2) %>% bind_rows(dep3) %>% pivot_longer(cols = -treat, names_to = "depression", values_to = "value" ) %>% filter( !is.na(value) ) %>% pivot_wider( names_from = depression, values_from = value) %>% * kbl(col.names = c("Treatment", "6 Monate","1 Jahr","7 Jahre"), digits = 3, format = "html") ``` ] .panel2-diffs-auto[ <table> <thead> <tr> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> 6 Monate </th> <th style="text-align:right;"> 1 Jahr </th> <th style="text-align:right;"> 7 Jahre </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 0.522 </td> <td style="text-align:right;"> 0.583 </td> <td style="text-align:right;"> 0.304 </td> </tr> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 0.201 </td> <td style="text-align:right;"> 0.249 </td> <td style="text-align:right;"> 0.239 </td> </tr> </tbody> </table> ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 dep1 %>% bind_rows(dep2) %>% bind_rows(dep3) %>% pivot_longer(cols = -treat, names_to = "depression", values_to = "value" ) %>% filter( !is.na(value) ) %>% pivot_wider( names_from = depression, values_from = value) %>% kbl(col.names = c("Treatment", "6 Monate","1 Jahr","7 Jahre"), digits = 3, format = "html") %>% * kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) ``` ] .panel2-diffs-auto[ <table class="table table-striped table-hover table-condensed table-responsive" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> 6 Monate </th> <th style="text-align:right;"> 1 Jahr </th> <th style="text-align:right;"> 7 Jahre </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 0.522 </td> <td style="text-align:right;"> 0.583 </td> <td style="text-align:right;"> 0.304 </td> </tr> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 0.201 </td> <td style="text-align:right;"> 0.249 </td> <td style="text-align:right;"> 0.239 </td> </tr> </tbody> </table> ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 dep1 %>% bind_rows(dep2) %>% bind_rows(dep3) %>% pivot_longer(cols = -treat, names_to = "depression", values_to = "value" ) %>% filter( !is.na(value) ) %>% pivot_wider( names_from = depression, values_from = value) %>% kbl(col.names = c("Treatment", "6 Monate","1 Jahr","7 Jahre"), digits = 3, format = "html") %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>% * kable_paper(full_width = F) ``` ] .panel2-diffs-auto[ <table class="table table-striped table-hover table-condensed table-responsive lightable-paper" style='margin-left: auto; margin-right: auto; font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;'> <thead> <tr> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> 6 Monate </th> <th style="text-align:right;"> 1 Jahr </th> <th style="text-align:right;"> 7 Jahre </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 0.522 </td> <td style="text-align:right;"> 0.583 </td> <td style="text-align:right;"> 0.304 </td> </tr> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 0.201 </td> <td style="text-align:right;"> 0.249 </td> <td style="text-align:right;"> 0.239 </td> </tr> </tbody> </table> ] --- count: false .panel1-diffs-auto[ ```r thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( dep6m_avg = round(mean(depressed_6m, na.rm = T), 3)) -> dep1 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_1y = round(mean(depressed_1y, na.rm = T), 3)) -> dep2 thp %>% filter(attrit2 == 0 & THP_sample == 1) %>% group_by(treat) %>% summarize( depressed_avg = round(mean(depressed, na.rm = T), 3)) -> dep3 dep1 %>% bind_rows(dep2) %>% bind_rows(dep3) %>% pivot_longer(cols = -treat, names_to = "depression", values_to = "value" ) %>% filter( !is.na(value) ) %>% pivot_wider( names_from = depression, values_from = value) %>% kbl(col.names = c("Treatment", "6 Monate","1 Jahr","7 Jahre"), digits = 3, format = "html") %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>% kable_paper(full_width = F) %>% * add_header_above(c(" ", "Anteil an Depressionen" = 3)) ``` ] .panel2-diffs-auto[ <table class="table table-striped table-hover table-condensed table-responsive lightable-paper" style='margin-left: auto; margin-right: auto; font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;'> <thead> <tr> <th style="empty-cells: hide;" colspan="1"></th> <th style="padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"><div style="border-bottom: 1px solid #00000020; padding-bottom: 5px; ">Anteil an Depressionen</div></th> </tr> <tr> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> 6 Monate </th> <th style="text-align:right;"> 1 Jahr </th> <th style="text-align:right;"> 7 Jahre </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 0.522 </td> <td style="text-align:right;"> 0.583 </td> <td style="text-align:right;"> 0.304 </td> </tr> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 0.201 </td> <td style="text-align:right;"> 0.249 </td> <td style="text-align:right;"> 0.239 </td> </tr> </tbody> </table> ] <style> .panel1-diffs-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-diffs-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-diffs-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- ## Schritt 2: Durchschnittliche Differenzen <table class="table table-striped table-hover table-condensed table-responsive lightable-paper" style='margin-left: auto; margin-right: auto; font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;'> <thead> <tr> <th style="empty-cells: hide;" colspan="1"></th> <th style="padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"><div style="border-bottom: 1px solid #00000020; padding-bottom: 5px; ">Anteil an Depressionen</div></th> </tr> <tr> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> 6 Monate </th> <th style="text-align:right;"> 1 Jahr </th> <th style="text-align:right;"> 7 Jahre </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 0.522 </td> <td style="text-align:right;"> 0.583 </td> <td style="text-align:right;"> 0.304 </td> </tr> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 0.201 </td> <td style="text-align:right;"> 0.249 </td> <td style="text-align:right;"> 0.239 </td> </tr> </tbody> </table> --- ## Schritt 2: Durchschnittliche Differenzen ```r reg_dep6m <- lm(depressed_6m ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_dep6m_long <- lm(depressed_6m ~ treat + age_baseline + age_baseline_sq + employed_mo_baseline + mo_emp + grandmother_baseline + MIL + wealth_baseline + edu_lvl_mo_1 + edu_lvl_mo_2 + edu_lvl_mo_3 + edu_mo_baseline + edu_fa_baseline + kids_no + first_child + hamd_baseline + mspss_baseline + month_int + month_int_sq + doi0 + intervr_1 + intervr_2 + intervr_3 +intervr_4 + intervr_5 + intervr_6 + intervr_7 + intervr_8 + intervr_9, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_dep1y <- lm(depressed_1y ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_dep1y_long <- lm(depressed_1y ~ treat + age_baseline + age_baseline_sq + employed_mo_baseline + mo_emp + grandmother_baseline + MIL + wealth_baseline + edu_lvl_mo_1 + edu_lvl_mo_2 + edu_lvl_mo_3 + edu_mo_baseline + edu_fa_baseline + kids_no + first_child + hamd_baseline + mspss_baseline + month_int + month_int_sq + doi0 + intervr_1 + intervr_2 + intervr_3 +intervr_4 + intervr_5 + intervr_6 + intervr_7 + intervr_8 + intervr_9, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_dep7y <- lm(depressed ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_dep7y_long <- lm(depressed ~ treat + age_baseline + age_baseline_sq + employed_mo_baseline + mo_emp + grandmother_baseline + MIL + wealth_baseline + edu_lvl_mo_1 + edu_lvl_mo_2 + edu_lvl_mo_3 + edu_mo_baseline + edu_fa_baseline + kids_no + first_child + hamd_baseline + mspss_baseline + month_int + month_int_sq + doi0 + intervr_1 + intervr_2 + intervr_3 +intervr_4 + intervr_5 + intervr_6 + intervr_7 + intervr_8 + intervr_9, data = filter(thp, attrit2 == 0 & THP_sample == 1)) stargazer(reg_dep6m, reg_dep6m_long, reg_dep1y, reg_dep1y_long, reg_dep7y, reg_dep7y_long, type = "html", covariate.labels = c("Treatment"), keep = "treat", dep.var.caption = "Depressionen", add.lines = list(c("Kontrollvariablen", "Nein", "Ja", "Nein", "Ja", "Nein", "Ja")), dep.var.labels = c("Nach 6 Monaten", "Nach 1 Jahr", "Nach 7 Jahren"), title = "Depression bei Müttern, mit und ohne Kontrollvariablen") ``` --- ## Schritt 2: Durchschnittliche Differenzen <table style="text-align:center"><caption><strong>Depression bei Müttern, mit und ohne Kontrollvariablen</strong></caption> <tr><td colspan="7" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td colspan="6">Depressionen</td></tr> <tr><td></td><td colspan="6" style="border-bottom: 1px solid black"></td></tr> <tr><td style="text-align:left"></td><td colspan="2">Nach 6 Monaten</td><td colspan="2">Nach 1 Jahr</td><td colspan="2">Nach 7 Jahren</td></tr> <tr><td style="text-align:left"></td><td>(1)</td><td>(2)</td><td>(3)</td><td>(4)</td><td>(5)</td><td>(6)</td></tr> <tr><td colspan="7" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">Treatment</td><td>-0.321<sup>***</sup></td><td>-0.321<sup>***</sup></td><td>-0.334<sup>***</sup></td><td>-0.308<sup>***</sup></td><td>-0.065<sup>*</sup></td><td>-0.049</td></tr> <tr><td style="text-align:left"></td><td>(0.038)</td><td>(0.039)</td><td>(0.038)</td><td>(0.039)</td><td>(0.037)</td><td>(0.037)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td colspan="7" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">Kontrollvariablen</td><td>Nein</td><td>Ja</td><td>Nein</td><td>Ja</td><td>Nein</td><td>Ja</td></tr> <tr><td style="text-align:left">Observations</td><td>584</td><td>584</td><td>584</td><td>584</td><td>585</td><td>585</td></tr> <tr><td style="text-align:left">R<sup>2</sup></td><td>0.112</td><td>0.221</td><td>0.115</td><td>0.230</td><td>0.005</td><td>0.165</td></tr> <tr><td style="text-align:left">Adjusted R<sup>2</sup></td><td>0.110</td><td>0.181</td><td>0.113</td><td>0.192</td><td>0.004</td><td>0.123</td></tr> <tr><td style="text-align:left">Residual Std. Error</td><td>0.454 (df = 582)</td><td>0.435 (df = 555)</td><td>0.465 (df = 582)</td><td>0.444 (df = 555)</td><td>0.444 (df = 583)</td><td>0.417 (df = 556)</td></tr> <tr><td style="text-align:left">F Statistic</td><td>73.131<sup>***</sup> (df = 1; 582)</td><td>5.616<sup>***</sup> (df = 28; 555)</td><td>75.318<sup>***</sup> (df = 1; 582)</td><td>5.933<sup>***</sup> (df = 28; 555)</td><td>3.157<sup>*</sup> (df = 1; 583)</td><td>3.928<sup>***</sup> (df = 28; 556)</td></tr> <tr><td colspan="7" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"><em>Note:</em></td><td colspan="6" style="text-align:right"><sup>*</sup>p<0.1; <sup>**</sup>p<0.05; <sup>***</sup>p<0.01</td></tr> </table> --- .pull-left[ <table class="table table-striped table-hover table-condensed table-responsive lightable-paper" style='margin-left: auto; margin-right: auto; font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;'> <thead> <tr> <th style="empty-cells: hide;" colspan="1"></th> <th style="padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"><div style="border-bottom: 1px solid #00000020; padding-bottom: 5px; ">Anteil an Depressionen</div></th> </tr> <tr> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> 6 Monate </th> <th style="text-align:right;"> 1 Jahr </th> <th style="text-align:right;"> 7 Jahre </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 0.522 </td> <td style="text-align:right;"> 0.583 </td> <td style="text-align:right;"> 0.304 </td> </tr> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 0.201 </td> <td style="text-align:right;"> 0.249 </td> <td style="text-align:right;"> 0.239 </td> </tr> </tbody> </table> ] .pull-right[ <table style="text-align:center"><caption><strong>Depression bei Müttern ohne Kontrollvariablen</strong></caption> <tr><td colspan="4" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td colspan="3">Depressionen</td></tr> <tr><td></td><td colspan="3" style="border-bottom: 1px solid black"></td></tr> <tr><td style="text-align:left"></td><td>Nach 6 Monaten</td><td>Nach 1 Jahr</td><td>Nach 7 Jahren</td></tr> <tr><td style="text-align:left"></td><td>(1)</td><td>(2)</td><td>(3)</td></tr> <tr><td colspan="4" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">Treatment</td><td>-0.321<sup>***</sup></td><td>-0.334<sup>***</sup></td><td>-0.065<sup>*</sup></td></tr> <tr><td style="text-align:left"></td><td>(0.038)</td><td>(0.038)</td><td>(0.037)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td></tr> <tr><td colspan="4" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">Kontrollvariablen</td><td>Nein</td><td>Nein</td><td>Nein</td></tr> <tr><td style="text-align:left">Observations</td><td>584</td><td>584</td><td>585</td></tr> <tr><td style="text-align:left">R<sup>2</sup></td><td>0.112</td><td>0.115</td><td>0.005</td></tr> <tr><td style="text-align:left">Adjusted R<sup>2</sup></td><td>0.110</td><td>0.113</td><td>0.004</td></tr> <tr><td style="text-align:left">Residual Std. Error</td><td>0.454 (df = 582)</td><td>0.465 (df = 582)</td><td>0.444 (df = 583)</td></tr> <tr><td style="text-align:left">F Statistic</td><td>73.131<sup>***</sup> (df = 1; 582)</td><td>75.318<sup>***</sup> (df = 1; 582)</td><td>3.157<sup>*</sup> (df = 1; 583)</td></tr> <tr><td colspan="4" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"><em>Note:</em></td><td colspan="3" style="text-align:right"><sup>*</sup>p<0.1; <sup>**</sup>p<0.05; <sup>***</sup>p<0.01</td></tr> </table> ] --- ## Schritt 2: Durchschnittliche Differenzen .question[Sollten wir für irgendwelche Variablen kontrollieren?] -- .alert[Nein, wir sollten für nichts kontrollieren!] Alle Pfeile in das Treatment wurden im DAG gelöscht, daher gibt es auch theoretisch keine Confounder auf die wir kontrollieren müssten. --- ## Schritt 2: Durchschnittliche Differenzen count: false .panel1-financial-auto[ ```r *reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) ``` ] .panel2-financial-auto[ ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) *reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) ``` ] .panel2-financial-auto[ ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) *reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) ``` ] .panel2-financial-auto[ ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) *reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) ``` ] .panel2-financial-auto[ ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) *reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) ``` ] .panel2-financial-auto[ ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) *tidy(reg_financial, conf.int = T) ``` ] .panel2-financial-auto[ ``` # A tibble: 2 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 0.00000000741 0.0593 0.000000125 1.00 -0.116 0.116 2 treat 0.341 0.0843 4.04 0.0000608 0.175 0.506 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% * mutate(term = ifelse( term == "treat", "fin_emp", term)) ``` ] .panel2-financial-auto[ ``` # A tibble: 2 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 0.00000000741 0.0593 0.000000125 1.00 -0.116 0.116 2 fin_emp 0.341 0.0843 4.04 0.0000608 0.175 0.506 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% * bind_rows(tidy(reg_money, conf.int = T)) ``` ] .panel2-financial-auto[ ``` # A tibble: 4 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 7.41e- 9 0.0593 0.000000125 1.00 -0.116 0.116 2 fin_emp 3.41e- 1 0.0843 4.04 0.0000608 0.175 0.506 3 (Intercept) 8.03e-10 0.0580 0.0000000138 1.00 -0.114 0.114 4 treat 3.57e- 1 0.0825 4.33 0.0000173 0.195 0.519 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% * mutate(term = ifelse( term == "treat", "money", term)) ``` ] .panel2-financial-auto[ ``` # A tibble: 4 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 7.41e- 9 0.0593 0.000000125 1.00 -0.116 0.116 2 fin_emp 3.41e- 1 0.0843 4.04 0.0000608 0.175 0.506 3 (Intercept) 8.03e-10 0.0580 0.0000000138 1.00 -0.114 0.114 4 money 3.57e- 1 0.0825 4.33 0.0000173 0.195 0.519 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% * bind_rows(tidy(reg_time, conf.int = T)) ``` ] .panel2-financial-auto[ ``` # A tibble: 6 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 7.41e- 9 0.0593 1.25e- 7 1.00 -0.116 0.116 2 fin_emp 3.41e- 1 0.0843 4.04e+ 0 0.0000608 0.175 0.506 3 (Intercept) 8.03e-10 0.0580 1.38e- 8 1.00 -0.114 0.114 4 money 3.57e- 1 0.0825 4.33e+ 0 0.0000173 0.195 0.519 5 (Intercept) -1.35e-11 0.0566 -2.39e-10 1.00 -0.111 0.111 6 treat 3.19e- 1 0.0805 3.96e+ 0 0.0000847 0.160 0.477 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% * mutate(term = ifelse( term == "treat", "time", term)) ``` ] .panel2-financial-auto[ ``` # A tibble: 6 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 7.41e- 9 0.0593 1.25e- 7 1.00 -0.116 0.116 2 fin_emp 3.41e- 1 0.0843 4.04e+ 0 0.0000608 0.175 0.506 3 (Intercept) 8.03e-10 0.0580 1.38e- 8 1.00 -0.114 0.114 4 money 3.57e- 1 0.0825 4.33e+ 0 0.0000173 0.195 0.519 5 (Intercept) -1.35e-11 0.0566 -2.39e-10 1.00 -0.111 0.111 6 time 3.19e- 1 0.0805 3.96e+ 0 0.0000847 0.160 0.477 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% * bind_rows(tidy(reg_style, conf.int = T)) ``` ] .panel2-financial-auto[ ``` # A tibble: 8 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 7.41e- 9 0.0593 1.25e- 7 1.00 -0.116 0.116 2 fin_emp 3.41e- 1 0.0843 4.04e+ 0 0.0000608 0.175 0.506 3 (Intercept) 8.03e-10 0.0580 1.38e- 8 1.00 -0.114 0.114 4 money 3.57e- 1 0.0825 4.33e+ 0 0.0000173 0.195 0.519 5 (Intercept) -1.35e-11 0.0566 -2.39e-10 1.00 -0.111 0.111 6 time 3.19e- 1 0.0805 3.96e+ 0 0.0000847 0.160 0.477 7 (Intercept) -1.69e- 9 0.0577 -2.94e- 8 1.00 -0.113 0.113 8 treat 6.31e- 2 0.0820 7.69e- 1 0.442 -0.0980 0.224 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% * mutate(term = ifelse( term == "treat", "style", term)) ``` ] .panel2-financial-auto[ ``` # A tibble: 8 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 7.41e- 9 0.0593 1.25e- 7 1.00 -0.116 0.116 2 fin_emp 3.41e- 1 0.0843 4.04e+ 0 0.0000608 0.175 0.506 3 (Intercept) 8.03e-10 0.0580 1.38e- 8 1.00 -0.114 0.114 4 money 3.57e- 1 0.0825 4.33e+ 0 0.0000173 0.195 0.519 5 (Intercept) -1.35e-11 0.0566 -2.39e-10 1.00 -0.111 0.111 6 time 3.19e- 1 0.0805 3.96e+ 0 0.0000847 0.160 0.477 7 (Intercept) -1.69e- 9 0.0577 -2.94e- 8 1.00 -0.113 0.113 8 style 6.31e- 2 0.0820 7.69e- 1 0.442 -0.0980 0.224 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% * bind_rows(tidy(reg_fertility, conf.int = T)) ``` ] .panel2-financial-auto[ ``` # A tibble: 10 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 7.41e- 9 0.0593 1.25e- 7 1.00 -0.116 0.116 2 fin_emp 3.41e- 1 0.0843 4.04e+ 0 0.0000608 0.175 0.506 3 (Intercept) 8.03e-10 0.0580 1.38e- 8 1.00 -0.114 0.114 4 money 3.57e- 1 0.0825 4.33e+ 0 0.0000173 0.195 0.519 5 (Intercept) -1.35e-11 0.0566 -2.39e-10 1.00 -0.111 0.111 6 time 3.19e- 1 0.0805 3.96e+ 0 0.0000847 0.160 0.477 7 (Intercept) -1.69e- 9 0.0577 -2.94e- 8 1.00 -0.113 0.113 8 style 6.31e- 2 0.0820 7.69e- 1 0.442 -0.0980 0.224 9 (Intercept) -2.40e- 9 0.0584 -4.11e- 8 1.00 -0.115 0.115 10 treat 1.67e- 2 0.0831 2.00e- 1 0.841 -0.147 0.180 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% bind_rows(tidy(reg_fertility, conf.int = T)) %>% * mutate(term = ifelse( term == "treat", "fertility", term)) ``` ] .panel2-financial-auto[ ``` # A tibble: 10 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 7.41e- 9 0.0593 1.25e- 7 1.00 -0.116 0.116 2 fin_emp 3.41e- 1 0.0843 4.04e+ 0 0.0000608 0.175 0.506 3 (Intercept) 8.03e-10 0.0580 1.38e- 8 1.00 -0.114 0.114 4 money 3.57e- 1 0.0825 4.33e+ 0 0.0000173 0.195 0.519 5 (Intercept) -1.35e-11 0.0566 -2.39e-10 1.00 -0.111 0.111 6 time 3.19e- 1 0.0805 3.96e+ 0 0.0000847 0.160 0.477 7 (Intercept) -1.69e- 9 0.0577 -2.94e- 8 1.00 -0.113 0.113 8 style 6.31e- 2 0.0820 7.69e- 1 0.442 -0.0980 0.224 9 (Intercept) -2.40e- 9 0.0584 -4.11e- 8 1.00 -0.115 0.115 10 fertility 1.67e- 2 0.0831 2.00e- 1 0.841 -0.147 0.180 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% bind_rows(tidy(reg_fertility, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "fertility", term)) %>% * filter( term != "(Intercept)") ``` ] .panel2-financial-auto[ ``` # A tibble: 5 x 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 fin_emp 0.341 0.0843 4.04 0.0000608 0.175 0.506 2 money 0.357 0.0825 4.33 0.0000173 0.195 0.519 3 time 0.319 0.0805 3.96 0.0000847 0.160 0.477 4 style 0.0631 0.0820 0.769 0.442 -0.0980 0.224 5 fertility 0.0167 0.0831 0.200 0.841 -0.147 0.180 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% bind_rows(tidy(reg_fertility, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "fertility", term)) %>% filter( term != "(Intercept)") %>% * mutate(term = fct_relevel(term, "fertility", "style", "time", "money", "fin_emp"), * term = fct_recode(term, * "Finanzielle Stärkung" = "fin_emp", * "Monetäre Investments" = "money", * "Zeitliche Investments" = "time", * "Erziehungsstil" = "style", * "Fruchtbarkeit" = "fertility")) ``` ] .panel2-financial-auto[ ``` # A tibble: 5 x 7 term estimate std.error statistic p.value conf.low conf.high <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 Finanzielle Stärkung 0.341 0.0843 4.04 6.08e-5 0.175 0.506 2 Monetäre Investments 0.357 0.0825 4.33 1.73e-5 0.195 0.519 3 Zeitliche Investments 0.319 0.0805 3.96 8.47e-5 0.160 0.477 4 Erziehungsstil 0.0631 0.0820 0.769 4.42e-1 -0.0980 0.224 5 Fruchtbarkeit 0.0167 0.0831 0.200 8.41e-1 -0.147 0.180 ``` ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% bind_rows(tidy(reg_fertility, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "fertility", term)) %>% filter( term != "(Intercept)") %>% mutate(term = fct_relevel(term, "fertility", "style", "time", "money", "fin_emp"), term = fct_recode(term, "Finanzielle Stärkung" = "fin_emp", "Monetäre Investments" = "money", "Zeitliche Investments" = "time", "Erziehungsstil" = "style", "Fruchtbarkeit" = "fertility")) %>% * ggplot(aes(x = term, y=estimate, ymin=conf.low, ymax=conf.high)) ``` ] .panel2-financial-auto[ <img src="Experiment_slides_files/figure-html/financial_auto_18_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% bind_rows(tidy(reg_fertility, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "fertility", term)) %>% filter( term != "(Intercept)") %>% mutate(term = fct_relevel(term, "fertility", "style", "time", "money", "fin_emp"), term = fct_recode(term, "Finanzielle Stärkung" = "fin_emp", "Monetäre Investments" = "money", "Zeitliche Investments" = "time", "Erziehungsstil" = "style", "Fruchtbarkeit" = "fertility")) %>% ggplot(aes(x = term, y=estimate, ymin=conf.low, ymax=conf.high)) + * geom_pointrange() ``` ] .panel2-financial-auto[ <img src="Experiment_slides_files/figure-html/financial_auto_19_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% bind_rows(tidy(reg_fertility, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "fertility", term)) %>% filter( term != "(Intercept)") %>% mutate(term = fct_relevel(term, "fertility", "style", "time", "money", "fin_emp"), term = fct_recode(term, "Finanzielle Stärkung" = "fin_emp", "Monetäre Investments" = "money", "Zeitliche Investments" = "time", "Erziehungsstil" = "style", "Fruchtbarkeit" = "fertility")) %>% ggplot(aes(x = term, y=estimate, ymin=conf.low, ymax=conf.high)) + geom_pointrange() + * geom_hline(yintercept = 0, col = "orange") ``` ] .panel2-financial-auto[ <img src="Experiment_slides_files/figure-html/financial_auto_20_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% bind_rows(tidy(reg_fertility, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "fertility", term)) %>% filter( term != "(Intercept)") %>% mutate(term = fct_relevel(term, "fertility", "style", "time", "money", "fin_emp"), term = fct_recode(term, "Finanzielle Stärkung" = "fin_emp", "Monetäre Investments" = "money", "Zeitliche Investments" = "time", "Erziehungsstil" = "style", "Fruchtbarkeit" = "fertility")) %>% ggplot(aes(x = term, y=estimate, ymin=conf.low, ymax=conf.high)) + geom_pointrange() + geom_hline(yintercept = 0, col = "orange") + * scale_y_continuous(breaks = c(-0.25,0,0.25,0.5)) ``` ] .panel2-financial-auto[ <img src="Experiment_slides_files/figure-html/financial_auto_21_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% bind_rows(tidy(reg_fertility, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "fertility", term)) %>% filter( term != "(Intercept)") %>% mutate(term = fct_relevel(term, "fertility", "style", "time", "money", "fin_emp"), term = fct_recode(term, "Finanzielle Stärkung" = "fin_emp", "Monetäre Investments" = "money", "Zeitliche Investments" = "time", "Erziehungsstil" = "style", "Fruchtbarkeit" = "fertility")) %>% ggplot(aes(x = term, y=estimate, ymin=conf.low, ymax=conf.high)) + geom_pointrange() + geom_hline(yintercept = 0, col = "orange") + scale_y_continuous(breaks = c(-0.25,0,0.25,0.5)) + * coord_flip() ``` ] .panel2-financial-auto[ <img src="Experiment_slides_files/figure-html/financial_auto_22_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% bind_rows(tidy(reg_fertility, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "fertility", term)) %>% filter( term != "(Intercept)") %>% mutate(term = fct_relevel(term, "fertility", "style", "time", "money", "fin_emp"), term = fct_recode(term, "Finanzielle Stärkung" = "fin_emp", "Monetäre Investments" = "money", "Zeitliche Investments" = "time", "Erziehungsstil" = "style", "Fruchtbarkeit" = "fertility")) %>% ggplot(aes(x = term, y=estimate, ymin=conf.low, ymax=conf.high)) + geom_pointrange() + geom_hline(yintercept = 0, col = "orange") + scale_y_continuous(breaks = c(-0.25,0,0.25,0.5)) + coord_flip() + * labs( * x = NULL, y = "Effektgröße als Standardabweichung der Kontrollgruppe", * title = "Effekt der Intervention auf ökonomische Entscheidungen der Mutter", * subtitle = "95% Konfidenzintervall um den Punktschätzer" * ) ``` ] .panel2-financial-auto[ <img src="Experiment_slides_files/figure-html/financial_auto_23_output-1.png" width="70%" style="display: block; margin: auto;" /> ] --- count: false .panel1-financial-auto[ ```r reg_financial <- lm(motherfinancial ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_money <- lm(parentmoney ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_time<- lm(parenttime ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_style <- lm(parentstyle ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) reg_fertility <- lm(fertility_vars ~ treat, data = filter(thp, attrit2 == 0 & THP_sample == 1)) tidy(reg_financial, conf.int = T) %>% mutate(term = ifelse( term == "treat", "fin_emp", term))%>% bind_rows(tidy(reg_money, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "money", term)) %>% bind_rows(tidy(reg_time, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "time", term)) %>% bind_rows(tidy(reg_style, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "style", term)) %>% bind_rows(tidy(reg_fertility, conf.int = T)) %>% mutate(term = ifelse( term == "treat", "fertility", term)) %>% filter( term != "(Intercept)") %>% mutate(term = fct_relevel(term, "fertility", "style", "time", "money", "fin_emp"), term = fct_recode(term, "Finanzielle Stärkung" = "fin_emp", "Monetäre Investments" = "money", "Zeitliche Investments" = "time", "Erziehungsstil" = "style", "Fruchtbarkeit" = "fertility")) %>% ggplot(aes(x = term, y=estimate, ymin=conf.low, ymax=conf.high)) + geom_pointrange() + geom_hline(yintercept = 0, col = "orange") + scale_y_continuous(breaks = c(-0.25,0,0.25,0.5)) + coord_flip() + labs( x = NULL, y = "Effektgröße als Standardabweichung der Kontrollgruppe", title = "Effekt der Intervention auf ökonomische Entscheidungen der Mutter", subtitle = "95% Konfidenzintervall um den Punktschätzer" ) + * theme_minimal() ``` ] .panel2-financial-auto[ <img src="Experiment_slides_files/figure-html/financial_auto_24_output-1.png" width="70%" style="display: block; margin: auto;" /> ] <style> .panel1-financial-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-financial-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-financial-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- ## Schritt 2: Durchschnittliche Differenzen <img src="Experiment_slides_files/figure-html/unnamed-chunk-11-1.png" width="40%" style="display: block; margin: auto;" /> --- ## Experimente als "Goldstandard"? Oft werden Experimente als "Goldstandard" für die kausale Inferenz betrachtet. -- .instructions[Experimente sind sehr schön!] .alert[Doch Experimente sind meist sehr schwer durchzuführen und in manchen Situationen gar nicht denkbar!] -- > Was uns interessiert sind kausale Effekte zu messen und dafür sind Experimente eine wichtige Säule, aber nicht die einzige Möglichkeit! --- ## Experimente und interne Validität Experimente können sehr viele Probleme bzgl. interner Validität lösen - Selektion - Treatment und Kontrollgruppen sind vergleichbar - Keine Selbstselektion - Trends - Keine Saisonalität - Keine Regression zur Mitte --- ## Experimente und interne Validität .instructions[**Jedoch:** Experimente können nicht das Problem der _Attrition_ beheben!] Wenn Attrition mit dem Treatment korreliert ist haben wir ein Problem Genauer: Wenn Personen selektiv aufhören an der Studie teilzunehmen, in Abhängigkeit davon ob sie getreatet wurden oder nicht, dann hilft uns auch ein sehr schön designtes Experiment nicht weiter. --- ## Experimente und interne Validität Für unser Experiment: - Nach 7 Jahren hatten die Autoren noch eine Befragung der Frauen durchgeführt - Wenn die Attrition in der Treatment und Kontrollgruppen über diese 7 Jahre hinweg unterschiedlich war und nun z.B. doppelt so viele Frauen aus der Kontrollgruppe in der Stichprobe sind, dann wäre die Attrition mit dem Treatment Status korreliert und unsere Aussagen nicht mehr valide --- ## Experimente und interne Validität <table class="table table-striped table-hover table-condensed table-responsive lightable-paper" style='margin-left: auto; margin-right: auto; font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;border-bottom: 0;'> <caption>Balancing Tabelle für die Grundcharakteristika</caption> <thead> <tr> <th style="empty-cells: hide;" colspan="1"></th> <th style="padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="4"><div style="border-bottom: 1px solid #00000020; padding-bottom: 5px; ">Stichprobe Baseline (N = 585)</div></th> </tr> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> Treatment </th> <th style="text-align:right;"> Kontrolle </th> <th style="text-align:right;"> Differenz </th> <th style="text-align:right;"> p-Wert </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Alter der Mutter </td> <td style="text-align:right;"> 26.71 </td> <td style="text-align:right;"> 27.03 </td> <td style="text-align:right;"> -0.32 </td> <td style="text-align:right;"> 0.44 </td> </tr> <tr> <td style="text-align:left;"> Depressiv (1 Jahr) </td> <td style="text-align:right;"> 0.25 </td> <td style="text-align:right;"> 0.58 </td> <td style="text-align:right;"> -0.33 </td> <td style="text-align:right;"> 0.00 </td> </tr> <tr> <td style="text-align:left;"> Bildung des Vaters </td> <td style="text-align:right;"> 6.98 </td> <td style="text-align:right;"> 7.20 </td> <td style="text-align:right;"> -0.22 </td> <td style="text-align:right;"> 0.48 </td> </tr> <tr> <td style="text-align:left;"> Vater beschäftigt </td> <td style="text-align:right;"> 0.90 </td> <td style="text-align:right;"> 0.90 </td> <td style="text-align:right;"> 0.00 </td> <td style="text-align:right;"> 0.88 </td> </tr> <tr> <td style="text-align:left;"> Mutter beschäftigt </td> <td style="text-align:right;"> 0.01 </td> <td style="text-align:right;"> 0.02 </td> <td style="text-align:right;"> -0.01 </td> <td style="text-align:right;"> 0.38 </td> </tr> <tr> <td style="text-align:left;"> Erstes Kind </td> <td style="text-align:right;"> 0.18 </td> <td style="text-align:right;"> 0.17 </td> <td style="text-align:right;"> 0.01 </td> <td style="text-align:right;"> 0.65 </td> </tr> <tr> <td style="text-align:left;"> Anzahl der Kinder </td> <td style="text-align:right;"> 2.08 </td> <td style="text-align:right;"> 2.42 </td> <td style="text-align:right;"> -0.34 </td> <td style="text-align:right;"> 0.02 </td> </tr> <tr> <td style="text-align:left;"> Oma im Haus </td> <td style="text-align:right;"> 0.08 </td> <td style="text-align:right;"> 0.05 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> 0.11 </td> </tr> <tr> <td style="text-align:left;"> Stiefoma im Haus </td> <td style="text-align:right;"> 0.48 </td> <td style="text-align:right;"> 0.39 </td> <td style="text-align:right;"> 0.09 </td> <td style="text-align:right;"> 0.04 </td> </tr> </tbody> <tfoot> <tr><td style="padding: 0; " colspan="100%"><span style="font-style: italic;">Note: </span></td></tr> <tr><td style="padding: 0; " colspan="100%"> <sup></sup> Diese Tabelle testet, wie ausbalanciert die Beobachtungen in der Stichprobe nach 7 Jahren sind. In den ersten beiden Spalten wird der Mittelwert für die Treatment bzw. Kontrollgruppe für die Stichprobe nach 7 Jahren gezeigt. Spalte (3) zeigen die Differenz zwischen den Mittelwerten der Treatment und Kontrollgruppe für die jeweilige Stichprobe und die Spalte (4) zeigt die p-Werte und damit ob die einzelnen Mittelwerte statistisch signifikant unterschiedlich voneinander sind.</td></tr> </tfoot> </table> --- ## Experimente und interne Validität Es ist wichtig auf Attrition zu achten: - Versuchen Sie so viele Charakteristika über ihre Teilnehmer zu bekommen wie möglich - Untersuchen Sie anhand dieser Charakteristika ob die Attrition zwischen den zwei Gruppen zufällig war - Versuchen Sie das Committment ihrer Teilnehmer am Experiment so hoch wie möglich zu halten Ein weiteres Problem des Experiments könnte sein, das die Teilnehmer sich nicht an das halten, was sie vorgeben: - Manche Teilnehmer der Treatment Gruppe werden das Treatment einfach nicht nehmen - Manche Teilnehmer der Kontrollgruppe werden eventuell doch an das Treatment kommen