## R code for Section 4.4.1 ## Example 4.4.4 Y <- c( 56, 70, 89, 94, 96, 101, 102, 102, 102, 105, 106, 108, 110, 113, 116) summary(Y) # get summary statistics boxplot(Y) # plot boxplot of Y hist(Y) # plot the histogram of Y qqnorm(Y) # normal q-q plot ## More examples on boxplot and qqplot # Sample from Normal(0,1) # symmetric distribution, log tailed plot(dnorm, -3, 3) # plot the density function Y <- rnorm(100, mean=0, sd=1) # generate random sample boxplot(Y) hist(Y) qqnorm(Y) # Sample from Uniform(0,1) # symmetric distribution, equally paced Y <- runif(100, min=0, max=1) boxplot(Y) hist(Y) qqnorm(Y) # Sample from Chi-Square(4) f <- function(x) { dchisq(x, df=4); } # define the density function plot(f, 0, 20) # plot the density function Y <- rchisq(100, df=4) boxplot(Y) hist(Y) qqnorm(Y)