# A random sample of n=25 observations x <- c(-19.8, -18.1, -13.9, -10.2, -6.3, -2.7, -2.6, -0.7, 2.6, 2.9, 4.7, 4.9, 5.1, 5.7, 5.8, 6.0, 6.8, 7.0, 11.8, 13.0, 15.2, 16.0, 24.2, 26.2, 28.9) # Compute sample mean and sample standard deviation xmean <- mean(x) xmean xstd <- sqrt(var(x)) xstd # Examine a normal probability plot frame( ) par(fin=c(8,8),cex=1.4,mex=2.0,lwd=3,pch=2,mkh=0.1) qqnorm(x, xlab="Standard normal quantiles", ylab="Observations", main="Normal Probability Plot") qqline(x) # Estimate the 75-th percentile x75 <- quantile(x, 0.75) x75 # Obtain 1000 bootstrap replicates of the # estimate of the 75-the population percentile y <- quantile(rnorm(25, xmean, xstd), 0.75) for(i in 1:999) { y <- c(y, quantile(rnorm(25, xmean, xstd), 0.75) )} # Construct a histogram par(fin=c(8,8),cex=1.2) lab <- "1000 Bootstrap Estimates (n=25)" hist(y, nclass=20, main=lab) # Obtain the average of the bootstrap replicates mean(y) # Obtain the standard error of the 1000 # bootstrap replicates sqrt(var(y)) # Obtain a 95% bootstrap confidence interval # for the 75-th percentile of the population quantile(y, c(0.025, 0.975)) # Report the point estimate of the 75-th # percentile of the population x75 <- quantile(x, 0.75) x75