# About R: # R is a free software environment for statistical computing and graphics. # It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS. # To download R, please go to http://www.r-project.org/ # Data "OrchardSprays": # Ziel: Kann man "lime sulphur" benutzen um Honigbienen abzuschrecken? # Wichtige Variabelen: # Treatment: A = highest level of lime sulphur in sucrose solution # ... # G = lowest level of lime sulphur in sucrose solution # H = no lime sulphar # Response variable: decrease of sucrose solution # Für mehr Information: # type 'help(OrchardSprays)' help(OrchardSprays) # Wie sehen die Daten aus? OrchardSprays # Histogramm OrchardSprays: par(mfrow=c(1,1)) hist(OrchardSprays$decrease, main="Histogramm OrchardSprays", col="gray", xlab="decrease in sucrose solution") # Boxplot OrchardSprays: boxplot(decrease ~ treatment, data = OrchardSprays, log = "y", col = "bisque", main="Boxplots OrchardSprays", xlab="treatment (high dose ... low dose)", ylab="decrease in sucrose solution (log scale)") # Lime sulphur scheint die Bienen tatsächlich abzuschrecken # Normal QQ-plots, n=25 par(mfrow=c(3,3)) for (i in 1:9){ data <- rnorm(25, 0,1) qqnorm(data) qqline(data) } # Normal QQ-plots, n=250 par(mfrow=c(3,3)) for (i in 1:9){ data <- rnorm(250, 0,1) qqnorm(data) qqline(data) } # Was ist hier passiert? par(mfrow=c(2,2)) # plot 1: Daten von N(0,1) Verteilung data <- rnorm(250,0,1) qqnorm(data, xlim=c(-6,6), ylim=c(-6,6)) qqline(data) abline(h=0) abline(v=0) # plot 2: Daten von N(2,1) Verteilung qqnorm(data+2, xlim=c(-6,6), ylim=c(-6,6)) qqline(data+2) abline(h=0) abline(v=0) # plot 3: Daten von N(0,2^2) Verteilung qqnorm(2*data, xlim=c(-6,6), ylim=c(-6,6)) qqline(2*data) abline(h=0) abline(v=0) # plot 4: Daten von N(2,2^2) Verteilung qqnorm(2*data+2, xlim=c(-6,6), ylim=c(-6,6)) qqline(2*data+2) abline(h=0) abline(v=0) # => Wenn das Normal QQ-Plot aussieht wie die Linie y=x, # dann haben die Datenpunkte etwa eine N(0,1) Verteilung. # Wenn das Normal QQ-Plot aussieht wie die Linie y=a+bx, # dann haben die Datenpunkte etwa eine N(a,b^2) Verteilung. # Wie sehen die Normal QQ-Plots aus wenn die Daten nicht von # einer Normalverteilung kommen? par(mfrow=c(2,2)) # plot 1 (uniforme Verteilung, kurz-schwanzig) data <- runif(250, -2,2) qqnorm(data) qqline(data) # plot 2 (t-Verteilung, lang-schwanzig) data <- rt(250,df=3) qqnorm(data) qqline(data) # plot 3 (exponential Verteilung: asymmetrisch nach rechts) data <- rexp(250,1) qqnorm(data,ylim=c(-3,8)) qqline(data) # plot 4 (-exponential Verteilung: asymmetrisch nach links) qqnorm(-data,ylim=c(-8,3)) qqline(-data)