A) weniger abstrakt
B) EIN Verfahren für (fast) alle Situationen
A) Manchmal präziser
B) Manchmal gibt es keine andere Möglichkeit
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
95%-KI auf Basis der der t-Verteilung mit 29 df:
#> [1] 0.9037929 2.3149338#> attr(,"conf.level")#> [1] 0.95
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
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
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
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.
Cobb, G. W. (2007). The introductory statistics course: A Ptolemaic curriculum? Technology Innovations in Statistics Education, 1(1).
Almost any course in statistics can be improved by more emphasis on data and concepts, and less emphasis on theory and recipes.
GAISE College Report ASA Revision Committee, “Guidelines for Assessment and Instruction in Statistics Education College Report 2016,” http://www.amstat.org/education/gaise.
Im Rahmen des normalen Unterrichts einer Sonderveranstaltung der FOM wurde der Versuch durchgeführt:
* Selbstloser Einsatz für die Wissenschaft
Je zwei Personen, A und B finden sich in Pärchen
A wählt 1 Pringel-Chip und 2 Noname-Chips
A reicht B nacheinander die 3 Chips in zufälliger Reihenfolge, B hat dabei die Augen geschlossen
B entscheidet sich, welcher Chips vermutlich der Pringle-Chip ist
Das Ergebnis (Treffer ja/nein) kann hier eingetragen werden: https://forms.gle/w1bUMGvdDofadih68
Bitte notieren Sie das Ergebnis (Treffer ja/nein) auch auf einen Zettel (den zusammenfalten)
Barcode zum Link:
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
# Histogramm zeichnen:gf_bar( ~ prop_r, data = Bootvtlg)
Ziehe 1000 Bootstrap-Stichproben
Berechne jeweils Statistik (z.B. Anteil)
Sortiere die Stichproben nach ihrem Wert
Zeichne Histogram
Schneide links/rechts jeweils 25 Stichproben ab
🏋️♀️
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
🏋️♀️
Wie groß ist die Wahrscheinlichkeit π, einen Pringel unter drei Proben rein zufällig, also durch Raten, herauszuschmecken?
A. π=0
B. π=1/3
C. π=1/2
D. π=2/3
B. π=1
rflip(prob = 1/3)#> #> Flipping 1 coin [ Prob(Heads) = 0.333333333333333 ] ...#> #> T#> #> Number of Heads: 0 [Proportion Heads: 0]
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]
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]
...
Nullvtlg <- mosaic::do(10000) * rflip(n = 34, prob = 1/3)gf_bar( ~ heads, data = Nullvtlg )
gf_bar( ~ heads, data = Nullvtlg)
prop( ~ heads >= 12, data = Nullvtlg)#> prop_TRUE #> 0.4644
www.xkcd.com/about 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.
"... 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."
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
I have no interest in you or your life.
— God (@TheTweetOfGod) January 4, 2019
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
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
11 Datensätze wurden so simuliert, dass es keinen Unterschied in den Mittelwerten der Populationen gibt, 1 Datensatz ist echt.
1.
2.
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
Daten laden:
download.file("https://goo.gl/whKjnl", destfile = "tips.csv")tips <- read.csv2("tips.csv")
Nullverteilung berechnen:
library(mosaic)Nullvtlg_Raucher <- mosaic::do(1000) * diffmean(total_bill ~ shuffle(smoker), data = tips)
Die ersten paar Werte aus den Stichproben der Nullverteilung:
diffmean |
---|
-1.2006729 |
1.5180254 |
2.1377989 |
0.2732657 |
1.6922987 |
0.0890885 |
H0-Verteilung visualisieren:
gf_histogram( ~ diffmean, data = Nullvtlg_Raucher) %>%gf_vline(xintercept = ~diffmean(total_bill ~ smoker, data = tips))
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
1. Bootstrapping: Ziehe viele Stichproben mit Zurücklegen aus Originalstichprobe, um Konfidenzintervall zu erhalten
2. Permutationtest: Testen von Zusammenhangs-/Unterschiedshypothesen
3. Einfache Simulation: Führe den Versuch oft durch, unter Annahme von H0
1. Bootstrapping: Ziehe viele Stichproben mit Zurücklegen aus Originalstichprobe, um Konfidenzintervall zu erhalten
do(oft) * statistik(y ~ x, data = resample(Daten))
2. Permutationtest: Testen von Zusammenhangs-/Unterschiedshypothesen
do(oft) * statistik(y ~ shuffle(x), data = Daten)
3. Einfache Simulation: Führe den Versuch oft durch, unter Annahme von H0
do(oft) * ziehe_aus_verteilung(n, parameterwerte)
Y | X | Statistik |
---|---|---|
binär | NA | Anteil `p` |
kategorial | NA | Verhältnis beobachtet/erwartet: `χ2` |
kategorial | NA | Verhältnis beobachtet/erwartet": `χ2` |
numerisch | NA | Mittelwert `¯x` |
binär | binär | Differenz der Anteile `pB−pA` |
numerisch | binär | Differenz der Mittelwerte `¯xB−¯xA` |
kategorial | kategorial | Verhältnis beobachtet/erwartet: `χ2` |
numerisch | kategorial | Verhältnis Varianz zwischen/innerhalb der Gruppen: `F` |
numerisch | numerisch | Korrelation oder Regression `r^β` |
kategorial | numerisch | Regression `^β` (logistische oder multinomiale Regression) |
Y | X | simulationsbasiert | konventionell |
---|---|---|---|
binär | . | prop() | binom.test() |
kategorial | . | xchisq.test() | xchisq.test() |
kategorial | . | chisq.test() | chisq.test() |
numerisch | . | mean() | t.test() |
binär | binär | diffprop() | prop.test() |
numerisch | binär | diffmean() | t.test() |
kategorial | kategorial | xchisq.test() | xchisq.test() |
numerisch | kategorial | aov() | aov() |
numerisch | numeric | cor(), lm() | cor.test(), lm() |
kategorial | numerisch | glm(family= 'binomial') | glm(family= 'binomial') |
Ein Prinzip für alle gängigen Verfahren
Wenige Voraussetzungen
Einfach, wenig abstrakt
sebastian.sauer@fom.de
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/
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.
Thanks to all the open source developers.
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |