Resampling-Statistik in R
Das coin-Paket bietet die Möglichkeit, eine Vielzahl von statistischen Tests auf Basis von Re-Randomisierung oder Permutation durchzuführen. Diese Tests gehen nicht von Zufallsstichproben aus wohldefinierten Populationen aus. Sie können eine sinnvolle Alternative zu klassischen Verfahren sein, wenn die Prüfannahmen nicht erfüllt werden können. Siehe münze: A Computational Framework for Conditional Inference für Details.
In den folgenden Beispielen stehen die Kleinbuchstaben für numerische Variablen und die Großbuchstaben für kategoriale Faktoren. Monte-Carlo-Simulationen sind für alle Tests verfügbar. Genaue Tests sind für 2 Gruppenverfahren verfügbar.
Unabhängige Zwei-Stichproben- und K-Stichproben-Ortstests
# Exact Wilcoxon Mann Whitney Rank Sum Test
# where y is numeric and A is a binary factor
library(coin)
wilcox_test(y~A, data=mydata, distribution="exact")
# One-Way Permutation Test based on 9999 Monte-Carlo
# resamplings. y is numeric and A is a categorical factor
library(coin)
oneway_test(y~A, data=mydata,
distribution=approximate(B=9999))
Symmetrie einer Antwort bei wiederholten Messungen
# Exact Wilcoxon Signed Rank Test
# where y1 and y2 are repeated measures
library(coin)
wilcoxsign_test(y1~y2, data=mydata, distribution="exact")
# Freidman Test based on 9999 Monte-Carlo resamplings.
# y is numeric, A is a grouping factor, and B is a
#
blocking factor.
library(coin)
friedman_test(y~A|B, data=mydata,
distribution=approximate(B=9999))
Unabhängigkeit von zwei numerischen Variablen
# Spearman Test of Independence based on 9999 Monte-Carlo
# resamplings. x and y are numeric variables.
library(coin)
spearman_test(y~x, data=mydata,
distribution=approximate(B=9999))
Unabhängigkeit in Kontingenztabellen
# Independence in 2-way Contingency Table based on
# 9999 Monte-Carlo resamplings. A and B are factors.
library(coin)
chisq_test(A~B, data=mydata,
distribution=approximate(B=9999))
# Cochran-Mantel-Haenzsel Test of 3-way Contingency Table
# based on 9999 Monte-Carlo resamplings. A, B, are
factors
# and C is a stratefying factor.
library(coin)
mh_test(A~B|C, data=mydata,
distribution=approximate(B=9999))
# Linear by Linear Association Test based on 9999
#
Monte-Carlo resamplings.
A and B are ordered factors.
library(coin)
lbl_test(A~B, data=mydata,
distribution=approximate(B=9999))
Viele andere univariate und multivariate Tests sind möglich, wenn du die Funktionen in der Münze Pakets. Weitere Informationen findest du unter Ein Lego-System für bedingte Schlussfolgerungen.
Zum Üben
Probiere die Übungen in diesem Kurs über Datenanalyse und statistische Schlussfolgerungen in R aus.