class: middle, right, title-slide # Inferenzstatistik mit Simulationstechniken ## Einführung ### Sebastian Sauer ### Dozententage 2020 --- layout: true <div class="my-header"></div> <!-- the following lines define the header and the footer line: --> <div class="my-header"></div> <!-- the following lines define the header and the footer line: --> <div class="my-footer"><span>Dozententage 2020      </span></div> <div class="footer-line"></div> <!-- Define an automatic count for header 1/2/exercises --> --- ## Agenda .right-column[ .vcenter[ ### .grey[1]. Wozu Simulationstechniken? ### .grey[2]. Der Biertest -- Konfidenzintervall ### .grey[3]. Der Pringels-Test -- Hypothesen testen, Teil 1 ### .grey[4]. Die Lächelstudie -- Hypothesen testen, Teil 2 ### .grey[5]. Fazit ] ] --- class: section # .grey.xlarge[1] Wozu Simulationstechniken? --- ## Simu ... was? </br> </br> ### Simulationstechniken in der Datenanalyse nutzen die Stichprobendaten, um inferenzstatistische Schlüsse zu ziehen. .pull-left[ ### *Didaktiver* Nutzen: A) weniger abstrakt B) EIN Verfahren für (fast) alle Situationen ] .pull-right[ ### *Inhaltlicher* Nutzen A) Manchmal präziser B) Manchmal gibt es keine andere Möglichkeit] --- ## Verteilungsbasiert vs. simulationsbasiert </br> </br> </br> <img src="img/simu-vs-analyse-1.png" width="90%" style="display: block; margin: auto;" /> --- ## Verteilungsannahmen ### ... können falsch sein <img src="img/bootstrap-percent-data.png" width="70%" style="display: block; margin: auto;" /> .footnote[Rousselet, G. A., Pernet, C. R., & Wilcox, R. R. (2019). A practical introduction to the bootstrap: A versatile method to make inferences by using data-driven simulations [Preprint]. PsyArXiv. https://doi.org/10.31234/osf.io/h8ft7] --- ## Der *t*-Test bei schiefen Verteilungen (I/II) <img src="SBI-Workshop-2020-02_files/figure-html/cow1-1.png" width="70%" style="display: block; margin: auto;" /> 95%-KI auf Basis der der *t*-Verteilung mit 29 df: ``` #> [1] 0.9037929 2.3149338 #> attr(,"conf.level") #> [1] 0.95 ``` --- ## Der *t*-Test bei schiefen Verteilungen (II/II) <img src="SBI-Workshop-2020-02_files/figure-html/cow2-1.png" width="90%" style="display: block; margin: auto;" /> .footnote[Rousselet, G. A., Pernet, C. R., & Wilcox, R. R. (2019). A practical introduction to the bootstrap: A versatile method to make inferences by using data-driven simulations [Preprint]. PsyArXiv. https://doi.org/10.31234/osf.io/h8ft7] --- ## Simulationstechniken sind nicht per se robuster </br> </br> <img src="img/figure_notrobust.png" width="90%" style="display: block; margin: auto;" /> .footnote[Rousselet, G. A., Pernet, C. R., & Wilcox, R. R. (2019). A practical introduction to the bootstrap: A versatile method to make inferences by using data-driven simulations [Preprint]. PsyArXiv. https://doi.org/10.31234/osf.io/h8ft7] --- ## Repro-Krise? </br> </br> </br> <img src="img/repro-crisis.jpg" width="70%" style="display: block; margin: auto;" /> .footnote[Fanelli, D. (2018). Opinion: Is science really facing a reproducibility crisis, and do we need it to? Proceedings of the National Academy of Sciences, 115(11), 2628–2631. https://doi.org/10.1073/pnas.1708272114] --- ## The Introductory Statistics Course: A Ptolemaic Curriculum? </br> </br> </br> > What we teach is largely the technical machinery of numerical approximations based on the normal distribution and its many subsidiary cogs. This machinery was once necessary, because the conceptually simpler alternative based on permutations was computationally beyond our reach. Before computers statisticians had no choice. These days we have no excuse. Randomization-based inference makes a direct connection between data production and the logic of inference that deserves to be at the core of every introductory course. Technology allows us to do more with less: more ideas, less technique. .footnote[Cobb, G. W. (2007). The introductory statistics course: A Ptolemaic curriculum? Technology Innovations in Statistics Education, 1(1).] --- ## Teach statistical thinking </br> </br> ### Emphasize Statistical Thinking </br> </br> ### More Data and Concepts, Less Theory and Fewer Recipes Almost any course in statistics can be improved by more emphasis on data and concepts, and less emphasis on theory and recipes. .footnote[GAISE College Report ASA Revision Committee, “Guidelines for Assessment and Instruction in Statistics Education College Report 2016,” http://www.amstat.org/education/gaise.] --- class: section # .grey.xlarge[2] Der Biertest -- Konfidenzintervall ### .grey[Live-Experiment: Biersorte erschmecken] --- ## Erschmecke das "Biligbier" </br> </br> </br> </br> </br> </br> .center[
   
   
] --- ## Du hast die Wahl <img src="img/Lidl-WR20160919.png" width="50%" style="display: block; margin: auto;" /> Im Rahmen des ~~normalen Unterrichts~~ einer Sonderveranstaltung der FOM wurde der Versuch durchgeführt: - `\(n=34\)` Versuchspersonen<sup>*</sup> - `\(x=12\)` Treffer .footnote[<sup>*</sup> Selbstloser Einsatz für die Wissenschaft] --- class:middle, right ## OK, kein Bier, nur Pringels --- ## Ablauf: Schmeck den Pringel heraus! .left-column[ </br> </br>
   
   
] .right-column[ </br> </br> 1. Je zwei Personen, `\(A\)` und `\(B\)` finden sich in Pärchen 3. `\(A\)` wählt 1 Pringel-Chip und 2 Noname-Chips 2. `\(A\)` reicht `\(B\)` nacheinander die 3 Chips in zufälliger Reihenfolge, `\(B\)` hat dabei die Augen geschlossen 3. `\(B\)` entscheidet sich, welcher Chips vermutlich der Pringle-Chip ist 5. Das Ergebnis (Treffer ja/nein) kann hier eingetragen werden: https://forms.gle/w1bUMGvdDofadih68 6. Bitte notieren Sie das Ergebnis (Treffer ja/nein) auch auf einen Zettel (den zusammenfalten) ] Barcode zum Link: <img src="img/barcode.png" width="80%" style="display: block; margin: auto;" /> --- ## Was ist der wahre Erschmecker-Anteil? .pull-left[ ### Anteil Stichprobe: 12/34 </br> </br> </br> </br> <img src="SBI-Workshop-2020-02_files/figure-html/waffle1-1.png" width="70%" style="display: block; margin: auto;" /> ] .pull-right[ ### Anteil in Population der FOM-Profs??? <img src="SBI-Workshop-2020-02_files/figure-html/normal1-1.png" width="70%" height="200px" style="display: block; margin: auto;" /> ] --- ## Idee 1: Wir testen alle FOM-Profs! .pull-left[  ] .pull-right[ </br>  ### super. Dauert aber. ] --- ## Idee 2: Wir wiederholen der Versuch oft! </br> ### z.B. 100 Mal: <img src="SBI-Workshop-2020-02_files/figure-html/plot-stiprovert-1.png" width="70%" style="display: block; margin: auto;" /> ### super. Dauert aber. --- ## Idee 3: Der Münchhausen-Trick </br> </br> <img src="SBI-Workshop-2020-02_files/figure-html/bootstrap-illustration-1.png" width="70%" style="display: block; margin: auto;" /> --- ## Ziele *viele* Stichproben mit Zurücklegen ### Voila -- Die Bootstrap-Verteilung: <img src="SBI-Workshop-2020-02_files/figure-html/bootvtlg-plot-1.png" width="70%" style="display: block; margin: auto;" /> --- ## Auf Errisch geht das so... .pull-left[ ```r library(mosaic) # unsere Stichprobe: stipro <- rep(factor(c("f","r")), c(22, 12)) # 3 Bootstrap-Stichproben: boot1 <- mosaic::do(3) * prop( ~ resample(stipro), success = "r") boot1 #> prop_r #> 1 0.3529412 #> 2 0.3823529 #> 3 0.3529412 ``` ] .pull-right[ ```r # Histogramm zeichnen: gf_bar( ~ prop_r, data = Bootvtlg) ``` <img src="SBI-Workshop-2020-02_files/figure-html/unnamed-chunk-18-1.png" width="100%" style="display: block; margin: auto;" /> ] --- ## Bootstrap-Kochrezept ### Voraussetzungen - Zufallsstichprobe - Nicht zu kleine Stichprobe, `\(n\ge35\)` </br> </br> ### Ablauf 1. Ziehe 1000 Bootstrap-Stichproben 2. Berechne jeweils Statistik (z.B. Anteil) 3. Sortiere die Stichproben nach ihrem Wert 3. Zeichne Histogram 4. Schneide links/rechts jeweils 25 Stichproben ab --- ### Übung: Ist 1/3 ein plausibler Wert in der FOM-Prof-Population? .xlarge[🏋️♀️] </br> </br> </br> </br> ```r boot2 <- mosaic::do(1000) * prop( ~ resample(stipro), success = "r") confint(boot2) #> name lower upper level method estimate #> 1 prop_r 0.2058824 0.5294118 0.95 percentile 0.3529412 ``` </br> </br> --- class: section # .grey.xlarge[3] Der Pringels-Test -- Hypothesen testen, Teil 1 ### .grey[Echte Pringels kann man nicht rausschmecken (?)] --- ### Übung: Rate-Wahrscheinlichkeit </br> .xlarge[🏋️♀️] </br> .left-column[ </br>
] .right-column[ Wie groß ist die Wahrscheinlichkeit `\(\pi\)`, einen Pringel unter drei Proben rein *zufällig*, also durch Raten, herauszuschmecken? A. `\(\pi = 0\)` B. `\(\pi = 1/3\)` C. `\(\pi = 1/2\)` D. `\(\pi = 2/3\)` B. `\(\pi = 1\)` ] --- ## "Pringels kann man nicht rausschmecken!" </br> </br> .pull-left[ <iframe src="https://giphy.com/embed/wYyTHMm50f4Dm" width="480" height="277" frameBorder="0" class="giphy-embed" allowFullScreen></iframe><p><a href="https://giphy.com/gifs/mrw-oc-asks-wYyTHMm50f4Dm">via GIPHY</a></p> ] .pull-right[ </br> `\(H_0: \pi \le 1/3\)`. `\(H_A: \pi > 1/3\)`. ] --- ## Angenommen, Pringels schmecken genau wie NoName-Chips </br> </br> </br> </br> .pull-left[ .center[
   
   
] ] .pull-right[ ### dann: Trefferchance = 1/3 ] </br> </br> </br> </br> --- ## Stellen wir den Versuch anhand von Münzwürfen nach ### Werfen wir *eine* gezinkte Münze (Trefferquote 1/3): ```r rflip(prob = 1/3) #> #> Flipping 1 coin [ Prob(Heads) = 0.333333333333333 ] ... #> #> T #> #> Number of Heads: 0 [Proportion Heads: 0] ``` ### Jetzt `\(n=34\)` gezinkte Münzen: ```r rflip(n = 34, prob = 1/3) #> #> Flipping 34 coins [ Prob(Heads) = 0.333333333333333 ] ... #> #> T T T T T T T T H T H T T H H T T H H T H H T T H T H T T T T T T T #> #> Number of Heads: 10 [Proportion Heads: 0.294117647058824] ``` --- ### Wir simulieren den Versuch ~~oft~~ ein paar Mal ```r rflip(n = 34, prob = 1/3) #> #> Flipping 34 coins [ Prob(Heads) = 0.333333333333333 ] ... #> #> T H T H T T H T T T T H T T T T T T H H H T H H T T H T H H T T H T #> #> Number of Heads: 13 [Proportion Heads: 0.382352941176471] rflip(n = 34, prob = 1/3) #> #> Flipping 34 coins [ Prob(Heads) = 0.333333333333333 ] ... #> #> T H H T T T T T T H H T H H T H H T T T T T T H T T T T H T H T H H #> #> Number of Heads: 13 [Proportion Heads: 0.382352941176471] ``` ... --- ## Wir erzeugen 1000 Rate-Stichproben ```r Nullvtlg <- mosaic::do(10000) * rflip(n = 34, prob = 1/3) gf_bar( ~ heads, data = Nullvtlg ) ``` <img src="SBI-Workshop-2020-02_files/figure-html/unnamed-chunk-23-1.png" width="70%" style="display: block; margin: auto;" /> --- ## Die Blaupause eines (jeden) statistisches Tests </br> </br> </br> </br> <img src="https://lh4.googleusercontent.com/Bud31guq0w0FvylY57VMR0zHkYqxIpYAfOqgZietyvv1n2ToNEHwHKZWYix8pwct8kDKsZKiwvOWm6PIFEL3gBIQmbakQYHwVT02nn9_H8Fht_zaSBlrRNcqwZa950Vb5nt-5B84" width="90%" style="display: block; margin: auto;" /> --- ## p-Wert ### p-Wert: Anteil der Stichproben mit mindestens 12 Treffer: .pull-left[ ```r gf_bar( ~ heads, data = Nullvtlg) ``` ] .pull-right[ <img src="SBI-Workshop-2020-02_files/figure-html/muenze-null-graph-1.png" width="90%" style="display: block; margin: auto;" /> ] ```r prop( ~ heads >= 12, data = Nullvtlg) #> prop_TRUE #> 0.4644 ``` --- ## Als sehr, sehr wichtig <img src="https://i.imgflip.com/22q4jc.jpg" width="40%" style="display: block; margin: auto;" /> </br> ### ... wird der p-Wert von vielen erachtet. --- ## Die Daten sind plausibel unter der Nullhypothese. .pull-left[ <img src="SBI-Workshop-2020-02_files/figure-html/unnamed-chunk-28-1.png" width="90%" style="display: block; margin: auto;" /> ] .pull-right[ </br> </br> ### Die Daten sind mit der `\(H_0\)` kompatibel. </br> </br> ] </br> </br> ### Wir können die Nullhypothese also nicht ablehnen. --- ## p-Wert: Eine gute Geschichte ### ... verdient, aufgebauscht zu werden (?) <img src="https://imgs.xkcd.com/comics/p_values_2x.png" width="30%" style="display: block; margin: auto;" /> .footnote[[www.xkcd.com/about](xkcd.com) .xsmall[Note: You are welcome to reprint occasional comics pretty much anywhere (presentations, papers, blogs with ads, etc). If you're not outright merchandizing, you're probably fine. Just be sure to attribute the comic to xkcd.com.]] --- ## Forschung über dem 5%-Niveau .pull-left[ <img src="https://sciences.adelaide.edu.au/sites/default/files/styles/ua_image/public/media/images/2019-06/ronald-fisher-4-uofa.jpg?itok=I9g1VlER" width="50%" style="display: block; margin: auto;" /> "Mein p-Wert ist der ~~größte~~ kleinste." [Bildquelle](https://sciences.adelaide.edu.au/sites/default/files/styles/ua_image/public/media/images/2019-06/ronald-fisher-4-uofa.jpg?itok=I9g1VlER) ] "... some statisticians prefer to supplement or even replace p-values with other approaches. These include methods that emphasize estimation over testing, such as confidence ... intervals ..." "Good statistical practice ... emphasizes principles of good study design ... , a variety of numerical and graphical summaries of data, understanding of the phenomenon under study, interpretation of results in context, complete reporting and proper logical and quantitative understanding of what data summaries mean." ### ... No single index should substitute for scientific reasoning. .footnote[Ronald L. Wasserstein & Nicole A. Lazar (2016) The ASA Statement on p-Values: Context, Process, and Purpose, The American Statistician, 70:2, 129-133, DOI: 10.1080/00031305.2016.1154108] --- ## Gott liebt </br> </br> ### ... 0.051 fast genauso sehr wie 0.049 </br> </br> ### Im Übrigen ... <blockquote class="twitter-tweet"><p lang="en" dir="ltr">I have no interest in you or your life.</p>— God (@TheTweetOfGod) <a href="https://twitter.com/TheTweetOfGod/status/1081033733040271360?ref_src=twsrc%5Etfw">January 4, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> .footnote[Gelman, A., & Stern, H. (2006). The Difference Between “Significant” and “Not Significant” is not Itself Statistically Significant. The American Statistician, 60(4), 328–331. https://doi.org/10.1198/000313006X152649 ] --- class: section # .grey.xlarge[4] Die Lächelstudie -- Hypothesen testen, Teil 2 ### .grey[Stimmt Lächeln nachsichtiger?] --- ## Stimmt Lächeln nachsichtiger? .pull-left[  [Bildquelle](https://news.developer.nvidia.com/this-ai-selfie-transformation-app-can-even-make-mona-lisa-smile/) ] .pull-right[ ### Skeptiker: ### "Lächeln bringt doch nichts!" ### `\(H_0: \mu_{\text{Lächeln}} \le \mu_{\text{Neutral}}\)` ### `\(H_A: \mu_{\text{Lächeln}} > \mu_{\text{Neutral}}\)` .footnote[LaFrance, M., & Hecht, M. A. (1995). Why smiles generate leniency. Personality and Social Psychology Bulletin, 21(3), 207-214, https://doi.org/10.1177%2F0146167295213002] ] --- ## Finde den echten Datensatz .large.green[11] Datensätze wurden so simuliert, dass es keinen Unterschied in den Mittelwerten der Populationen gibt, .large.green[1] Datensatz ist echt. <img src="SBI-Workshop-2020-02_files/figure-html/smile-1.png" width="80%" style="display: block; margin: auto;" /> --- ## Angenommen, es gäbe keinen Zusammenhang ### ... von Lächeln und Nachsichtigkeit. Wie häufig wäre unser empirischer Wert in diesen Stichproben? <img src="SBI-Workshop-2020-02_files/figure-html/smiledot-1.png" width="70%" style="display: block; margin: auto;" /> --- ## Der p-Wert schlägt zurück .pull-left[ <img src="https://sciences.adelaide.edu.au/sites/default/files/styles/ua_image/public/media/images/2019-06/ronald-fisher-4-uofa.jpg?itok=I9g1VlER" width="60%" style="display: block; margin: auto;" /> "Wer die Definition vergisst, dem tättoviere ich *p-value* auf den Unterarm." [Bildquelle](https://sciences.adelaide.edu.au/sites/default/files/styles/ua_image/public/media/images/2019-06/ronald-fisher-4-uofa.jpg?itok=I9g1VlER) ] .pull-right[ </br> </br> ### *Wenn* die Daten aus einer Population stammen, in der die Nullhypothese stimmt, *dann* ist unser empirisches Ergebnis *selten* (unplausibel). ### Auf dieser Basis entscheiden wir uns in diesem Fall, die `\(H_0\)` zu verwerfen (bzw. nicht mehr so stark wie vorher an sie zu glauben). ] --- ## Wie stellt man die Nullverteilung her? .pull-left[ </br> </br> </br> .grey.xlarge[1.] ## Man reist in ein Land, in dem es keinen Zusammenhang gibt (zwischen Lächeln und Nachsichtigkeit) und zieht dort viele Stichproben. </br> </br> ] .pull-right[ <img src="SBI-Workshop-2020-02_files/figure-html/unnamed-chunk-32-1.png" width="90%" height="80%" style="display: block; margin: auto;" /> ] --- ## ... Oder man mischt eine Spalte .pull-left[ </br> </br> </br> .grey.xlarge[2.] ## Man mischt die Spalte (z.B. UV) durch, so dass der Zusammenhang zwischen der Spalte UV under einer anderen Spalte (AV) aufgelöst wird. ] .pull-right[ </br> </br> <img src="img/shuffle.001.jpeg" width="100%" style="display: block; margin: auto;" /> ] --- ## So mischt man eine Spalte mit R ```r Nullvtlg_gesicht <- mosaic::do(100)*diffmean(nachsichtigkeit ~ shuffle(gesicht), data = Laecheln) ``` gesicht gesicht_gemischt nachsichtigkeit -------- ----------------- ---------------- lächeln neutral 7.0 lächeln neutral 3.0 lächeln lächeln 6.0 lächeln lächeln 4.5 lächeln neutral 3.5 lächeln lächeln 4.0 --- ## Übung: Konsumieren Raucher im Schnitt mehr? (1/3) ### `\(H0: \mu_R = \mu_{NR}\)` ### `\(H_A: \mu_r \ne \mu_{NR}\)` .pull-left[ Daten laden: ```r download.file("https://goo.gl/whKjnl", destfile = "tips.csv") tips <- read.csv2("tips.csv") ``` Nullverteilung berechnen: ```r library(mosaic) Nullvtlg_Raucher <- mosaic::do(1000) * diffmean(total_bill ~ shuffle(smoker), data = tips) ``` ] .pull-right[ Die ersten paar Werte aus den Stichproben der Nullverteilung: | diffmean| |----------:| | -1.2006729| | 1.5180254| | 2.1377989| | 0.2732657| | 1.6922987| | 0.0890885| ] --- ## Übung: Konsumieren Raucher im Schnitt mehr? (2/3) `\(H_0\)`-Verteilung visualisieren: ```r gf_histogram( ~ diffmean, data = Nullvtlg_Raucher) %>% gf_vline(xintercept = ~diffmean(total_bill ~ smoker, data = tips)) ``` <img src="SBI-Workshop-2020-02_files/figure-html/unnamed-chunk-40-1.png" width="70%" style="display: block; margin: auto;" /> --- ## Übung: Konsumieren Raucher im Schnitt mehr? (2/3) .pull-left[ Empirische Differenz/Wert in der Stichprobe: ``` #> diffmean #> 1.568066 ``` Anteil der Stichproben, die mind. so groß sind wie der emp. Wert: ``` #> prop_TRUE #> 0.099 ``` Mal zwei nehmen, da ungerichtete Hypothese: ``` #> prop_TRUE #> 0.198 ``` ] .pull-right[ <img src="SBI-Workshop-2020-02_files/figure-html/unnamed-chunk-44-1.png" width="100%" style="display: block; margin: auto;" /> ] --- class: section # .grey.xlarge[5] Fazit ### .grey[Wie war das nochmal im Mittelteil?] --- ## Verteilungsbasiert vs. simulationsbasiert </br> </br> </br> <img src="img/simu-vs-analyse-1.png" width="90%" style="display: block; margin: auto;" /> --- ## Drei Varianten von Simulationstechniken </br> </br> .xlarge.grey[1.] **Bootstrapping**: Ziehe viele Stichproben mit Zurücklegen aus Originalstichprobe, um Konfidenzintervall zu erhalten </br> </br> .xlarge.grey[2.] **Permutationtest**: Testen von Zusammenhangs-/Unterschiedshypothesen </br> </br> .xlarge.grey[3.] **Einfache Simulation**: Führe den Versuch oft durch, unter Annahme von `\(H_0\)` --- ## Drei Varianten von Simulationstechniken -- mit R </br> </br> .xlarge.grey[1.] **Bootstrapping**: Ziehe viele Stichproben mit Zurücklegen aus Originalstichprobe, um Konfidenzintervall zu erhalten ```r do(oft) * statistik(y ~ x, data = resample(Daten)) ``` </br> .xlarge.grey[2.] **Permutationtest**: Testen von Zusammenhangs-/Unterschiedshypothesen ```r do(oft) * statistik(y ~ shuffle(x), data = Daten) ``` </br> .xlarge.grey[3.] **Einfache Simulation**: Führe den Versuch oft durch, unter Annahme von `\(H_0\)` ```r do(oft) * ziehe_aus_verteilung(n, parameterwerte) ``` --- ## Übersicht Teststatistiken (Auswahl) <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Y </th> <th style="text-align:left;"> X </th> <th style="text-align:left;"> Statistik </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;width: 2cm; "> binär </td> <td style="text-align:left;width: 2cm; "> NA </td> <td style="text-align:left;width: 14cm; "> Anteil `\(p\)` </td> </tr> <tr> <td style="text-align:left;width: 2cm; "> kategorial </td> <td style="text-align:left;width: 2cm; "> NA </td> <td style="text-align:left;width: 14cm; "> Verhältnis beobachtet/erwartet: `\(\chi^2\)` </td> </tr> <tr> <td style="text-align:left;width: 2cm; "> kategorial </td> <td style="text-align:left;width: 2cm; "> NA </td> <td style="text-align:left;width: 14cm; "> Verhältnis beobachtet/erwartet": `\(\chi^2\)` </td> </tr> <tr> <td style="text-align:left;width: 2cm; "> numerisch </td> <td style="text-align:left;width: 2cm; "> NA </td> <td style="text-align:left;width: 14cm; "> Mittelwert `\(\bar{x}\)` </td> </tr> <tr> <td style="text-align:left;width: 2cm; "> binär </td> <td style="text-align:left;width: 2cm; "> binär </td> <td style="text-align:left;width: 14cm; "> Differenz der Anteile `\(p_B-p_A\)` </td> </tr> <tr> <td style="text-align:left;width: 2cm; "> numerisch </td> <td style="text-align:left;width: 2cm; "> binär </td> <td style="text-align:left;width: 14cm; "> Differenz der Mittelwerte `\(\bar{x}_B-\bar{x}_A\)` </td> </tr> <tr> <td style="text-align:left;width: 2cm; "> kategorial </td> <td style="text-align:left;width: 2cm; "> kategorial </td> <td style="text-align:left;width: 14cm; "> Verhältnis beobachtet/erwartet: `\(\chi^2\)` </td> </tr> <tr> <td style="text-align:left;width: 2cm; "> numerisch </td> <td style="text-align:left;width: 2cm; "> kategorial </td> <td style="text-align:left;width: 14cm; "> Verhältnis Varianz zwischen/innerhalb der Gruppen: `\(F\)` </td> </tr> <tr> <td style="text-align:left;width: 2cm; "> numerisch </td> <td style="text-align:left;width: 2cm; "> numerisch </td> <td style="text-align:left;width: 14cm; "> Korrelation oder Regression `\(r \hat{\beta}\)` </td> </tr> <tr> <td style="text-align:left;width: 2cm; "> kategorial </td> <td style="text-align:left;width: 2cm; "> numerisch </td> <td style="text-align:left;width: 14cm; "> Regression `\(\hat{\beta}\)` (logistische oder multinomiale Regression) </td> </tr> </tbody> </table> --- ### Übersicht Inferenzverfahren R mosaic (Auswahl) <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Y </th> <th style="text-align:left;"> X </th> <th style="text-align:left;"> simulationsbasiert </th> <th style="text-align:left;"> konventionell </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;width: 1.8cm; "> binär </td> <td style="text-align:left;width: 1.8cm; "> . </td> <td style="text-align:left;width: 5cm; width: 5cm; "> prop() </td> <td style="text-align:left;"> binom.test() </td> </tr> <tr> <td style="text-align:left;width: 1.8cm; "> kategorial </td> <td style="text-align:left;width: 1.8cm; "> . </td> <td style="text-align:left;width: 5cm; width: 5cm; "> xchisq.test() </td> <td style="text-align:left;"> xchisq.test() </td> </tr> <tr> <td style="text-align:left;width: 1.8cm; "> kategorial </td> <td style="text-align:left;width: 1.8cm; "> . </td> <td style="text-align:left;width: 5cm; width: 5cm; "> chisq.test() </td> <td style="text-align:left;"> chisq.test() </td> </tr> <tr> <td style="text-align:left;width: 1.8cm; "> numerisch </td> <td style="text-align:left;width: 1.8cm; "> . </td> <td style="text-align:left;width: 5cm; width: 5cm; "> mean() </td> <td style="text-align:left;"> t.test() </td> </tr> <tr> <td style="text-align:left;width: 1.8cm; "> binär </td> <td style="text-align:left;width: 1.8cm; "> binär </td> <td style="text-align:left;width: 5cm; width: 5cm; "> diffprop() </td> <td style="text-align:left;"> prop.test() </td> </tr> <tr> <td style="text-align:left;width: 1.8cm; "> numerisch </td> <td style="text-align:left;width: 1.8cm; "> binär </td> <td style="text-align:left;width: 5cm; width: 5cm; "> diffmean() </td> <td style="text-align:left;"> t.test() </td> </tr> <tr> <td style="text-align:left;width: 1.8cm; "> kategorial </td> <td style="text-align:left;width: 1.8cm; "> kategorial </td> <td style="text-align:left;width: 5cm; width: 5cm; "> xchisq.test() </td> <td style="text-align:left;"> xchisq.test() </td> </tr> <tr> <td style="text-align:left;width: 1.8cm; "> numerisch </td> <td style="text-align:left;width: 1.8cm; "> kategorial </td> <td style="text-align:left;width: 5cm; width: 5cm; "> aov() </td> <td style="text-align:left;"> aov() </td> </tr> <tr> <td style="text-align:left;width: 1.8cm; "> numerisch </td> <td style="text-align:left;width: 1.8cm; "> numeric </td> <td style="text-align:left;width: 5cm; width: 5cm; "> cor(), lm() </td> <td style="text-align:left;"> cor.test(), lm() </td> </tr> <tr> <td style="text-align:left;width: 1.8cm; "> kategorial </td> <td style="text-align:left;width: 1.8cm; "> numerisch </td> <td style="text-align:left;width: 5cm; width: 5cm; "> glm(family= 'binomial') </td> <td style="text-align:left;"> glm(family= 'binomial') </td> </tr> </tbody> </table> --- ## Nutzen und Grenzen </br> </br> .pull-left[
- *Ein* Prinzip für alle gängigen Verfahren - *Wenige* Voraussetzungen - *Einfach*, wenig abstrakt ] .pull-right[
- Zur *Anschlussfähigkeit* sollten Namen konventioneller Verfahren (wie *t*-Test) weiterhin gelehrt werden ] --- ## Sinnbild: Bootstrap </br> </br> <img src="img/bootstrapping-sinnbild-crop.png" width="70%" style="display: block; margin: auto;" /> --- ## Sinnbild: Zusammenhang zweier Variablen (Permutationstest) </br> <img src="img/shuffle.001.jpeg" width="70%" style="display: block; margin: auto;" /> --- ## Sinnbild: Test auf bestimmten Wert einer Variablen <img src="img/simu-einfach-crop.png" width="70%" style="display: block; margin: auto;" /> --- ## Fragen, Feedback, Feierlichkeiten? </br> </br> .right[ ### Sprechen Sie uns an!
sebastian.sauer@fom.de </br> </br> Diese Folien wurden von Autor*innen der FOM https://www.fom.de/ entwickelt und stehen unter der Lizenz CC-BY-SA-NC 3.0 de: https://creativecommons.org/licenses/by-nc-sa/3.0/de/ ] --- ## Technical details - Last update: 2020-02-03 - Slides built with `xaringan`, based on `rmarkdown` - Packages: assertthat 0.2.1, backports 1.1.5, broom 0.5.3, cellranger 1.1.0, cli 2.0.1, codetools 0.2-16, colorspace 1.4-1, cowplot 1.0.0, crayon 1.3.4, crosstalk 1.0.0, curl 4.3, DBI 1.1.0, dbplyr 1.4.2, digest 0.6.23, dplyr 0.8.3, DT 0.11, emo 0.0.0.9000, evaluate 0.14, extrafont 0.17, extrafontdb 1.0, fansi 0.4.1, fastmap 1.0.1, forcats 0.4.0, fs 1.3.1, generics 0.0.2, ggdendro 0.1-20, ggformula 0.9.2, ggplot2 3.2.1, ggrepel 0.8.1, ggstance 0.3.3, glue 1.3.1.9000, gridExtra 2.3, gtable 0.3.0, haven 2.2.0, highr 0.8, hms 0.5.3, htmltools 0.4.0, htmlwidgets 1.5.1, httpuv 1.5.2, httr 1.4.1, icon 0.1.0, jsonlite 1.6, kableExtra 1.1.0, knitr 1.27, later 1.0.0, lattice 0.20-38, lazyeval 0.2.2, leaflet 2.0.3, lifecycle 0.1.0, lubridate 1.7.4, magrittr 1.5, MASS 7.3-51.5, Matrix 1.2-17, mime 0.8, modelr 0.1.5, mosaic 1.5.0, mosaicCore 0.6.0, mosaicData 0.17.0, munsell 0.5.0, nlme 3.1-143, pillar 1.4.3, pkgconfig 2.0.3, promises 1.1.0, purrr 0.3.3, R6 2.4.1, RColorBrewer 1.1-2, Rcpp 1.0.3, readr 1.3.1, readxl 1.3.1, reprex 0.3.0, rlang 0.4.2, rmarkdown 2.0, rstudioapi 0.10, Rttf2pt1 1.3.8, rvest 0.3.5, scales 1.1.0, sessioninfo 1.1.1, shiny 1.4.0, stringi 1.4.5, stringr 1.4.0, tibble 2.1.3, tidyr 1.0.0, tidyselect 0.2.5, tidyverse 1.3.0, vctrs 0.2.1, viridisLite 0.3.0, waffle 1.0.1, webshot 0.5.2, withr 2.1.2, xaringan 0.13, xfun 0.12, xml2 1.2.2, xtable 1.8-4, yaml 2.2.0, zeallot 0.1.0 - For detailed `session_info()` check out this [text file](https://data-se.netlify.com/slides/papers-publizieren/session_info.txt). - Thanks to all the open source developers.