# LV Blatt 9 # # Aufg. 9.3 # # (i) (0,5 Punkte) zz <- rnorm(10000, 170,10) # (ii) (0,5 Punkte) sum(zz<160)/10000 # (iii) (0,5 Punkte) sum(zz>140 & zz<200)/10000 # (iv) (0,5 Punkte) max(zz) # (v) (0,5 Punkte) which(zz==max(zz)) # (vi) (1 Punkt) sum(abs(diff(zz))>sqrt(200))/10000 # (vii) (1,5 Punkt) which(abs(diff(zz)) >= sort(abs(diff(zz)),decreasing = T)[10]) # # Aufg. 9.4 # # Plots von Dichten der Hypergeometrischen-, Binomial-, und diskreten # Gleich-Verteilung # alles in ein Grafikfenster zeichnen par(mfrow=c(2,2)) # Hypergeometrische Verteilung # ---------------------------- # Hyp(60,40,10) x<-c(0,1,2,3,4,5,6,7,8,9,10) plot(x,dhyper(x,60,40,10), xlim = c(0, 10), ylim = c(0, 0.3),font.axis=2, cex.axis=1, las=1, lwd=2, xlab="", ylab="", main="H_10,60,100", xaxp=c(0,10,10)) # Binomial-Verteilung # ------------------- # Bin(10,0.5) plot(x,dbinom(x,10,0.5), xlim = c(0, 10), ylim = c(0, 0.3),font.axis=2, cex.axis=1, las=1, lwd=2, xlab="", ylab="", main="B_10,0.5") # Gleich-Verteilung auf 1,..,6 # ---------------------------- # U(1,..,6) x<-c(1,2,3,4,5,6) plot(x,rep(1/6,6), xlim = c(1, 6), ylim = c(0, 0.3),font.axis=2, cex.axis=1, las=1, lwd=2, xlab="", ylab="", main="U_1,2,3,4,5,6") # alles in ein Grafikfenster zeichnen par(mfrow=c(1,1)) ##################################################################################### # # Zweiter Teil der Aufgabe # ##################################################################################### # # Hypergeometrische Verteilung # ---------------------------- # Hyp(10,60,100) x<-c(0,1,2,3,4,5,6,7,8,9,10) plot(x,dhyper(x,60,40,10), xlim = c(0, 10), ylim = c(0, 0.3),font.axis=2, cex.axis=1, las=1, lwd=2, xlab="", ylab="", main="H_10,60,100", xaxp=c(0,10,10)) lines(c(3,3),c(0,dhyper(3,60,40,10)),col="red") lines(c(4,4),c(0,dhyper(4,60,40,10)),col="red") lines(c(5,5),c(0,dhyper(5,60,40,10)),col="red") text(3.5,0.02,"ca. 0.04",cex = 0.7,col="red") text(4.5,0.05,"ca. 0.12",cex = 0.7,col="red") text(5.5,0.1,"ca. 0.22",cex = 0.7,col="red") text(3.5,0.24,"insg.: H_10,60,100({4,5,6}) approx. 0.04+0.12+0.22=0,38",cex = 0.9,col="red") # Binomial-Verteilung # ------------------- # Bin(10,0.5) plot(x,dbinom(x,10,0.5), xlim = c(0, 10), ylim = c(0, 0.3),font.axis=2, cex.axis=1, las=1, lwd=2, xlab="", ylab="", main="B_10,0.5") lines(c(1,1),c(0,dbinom(1,10,0.5)),col="red") lines(c(3,3),c(0,dbinom(3,10,0.5)),col="red") text(1.5,0.005,"ca. 0.01",cex = 0.7,col="red") text(3.5,0.065,"ca. 0.13",cex = 0.7,col="red") text(5,0.28,"Aus Symmetriegr?nden gilt: B_10,0.5({1,3,7,9}) approx. 2*(0.01+0.13)=0,28", cex = 0.9,col="red") # Gleich-Verteilung auf 1,..,6 # ---------------------------- # U(1,..,6) x<-c(1,2,3,4,5,6) plot(x,rep(1/6,6), xlim = c(1, 6), ylim = c(0, 0.3),font.axis=2, cex.axis=1, las=1, lwd=2, xlab="", ylab="", main="U_1,2,3,4,5,6") lines(c(2,2),c(0,1/6),col="red") lines(c(6,6),c(0,1/6),col="red") text(2.2,0.08,"ca. 0.16",cex = 0.7,col="red") text(5.7,0.08,"ca. 0.16",cex = 0.7,col="red") text(3.5,0.25,"insg.: U_1,2,3,4,5,6({2,6}) approx. 0.16+0.16=0,32", cex = 0.9,col="red")