# Aufgabe 17 # Daten faithful ?faithful dim(faithful) summary(faithful$eruptions) table(faithful$waiting) # Parameter xlim, ylim für Funktion plot xdim = c(40,100) ydim = c(0,.05) # a) Histogramm und Kerndichteschätzer # par(mfrow = c(2,2)) hist(faithful$waiting, freq = FALSE, ylim = ydim, xlim = xdim, main = "Histogramm: Standardeinstellung", xlab = "waiting") hist(faithful$waiting, freq = FALSE, ylim = ydim, xlim = xdim, main = "Histogramm: 'breaks = 20'", xlab = "waiting", breaks = 20) plot(density(faithful$waiting), ylim = ydim, xlim = xdim, main = "Kerndichtschätzung: Standardbandweite") plot(density(faithful$waiting, adjust = 0.5), ylim = ydim, xlim = xdim, main = "Kerndichtsch?tzung: 'adjust = 0.5'") # (Parameter adjust = '0.5' bei Dichteschätzung war gesucht) ?density # b) # QQPlot - Variable waiting vs. Normalverteilung qqplot(y = scale(faithful$waiting), x = rnorm(1000,0,1), xlim=c(-3,3), ylim=c(-3,3), xlab = "theoretische Quantile", ylab = "Quantile waiting", main = "Normal-Q-Q-Plot") abline(a = 0, b = 1)