10.07.2015 Views

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Using</strong> R <strong>for</strong> introductory statistics 192The quantile-quantile plot compares the distribution of the sample with a sample from thet-distribution. If you type this in you will see that the points are close to linear, as thesampling distribution is the t-distribution.To test different parent populations you can change the line x=rnorm(n) to some otherdistributions with mean a. For example, try a short-tailed distribution withx=runif(n)−1/2; a symmetric, long-tailed distribution with x =rt(n, 3); a not so long-tailed,symmetric distribution with x=rt (n, 30); and a skewed distribution with x=rexp(n)−1.7.21 We can compare the relationship of the t-distribution with n−1 degrees offreedom with the normal distribution in several ways. As n gets large, the t-distributionconverges to the standard normal. But what happens when n is “small,” and what do wemean by “large”?A few comparative graphs can give us an idea. For n=10 we can use boxplots ofsimulated data to examine the tails, or we can compare plots of theoretical quantiles ordensities. These plots are created as follows:> n = 10> boxplot(rt(1000,df=n−1),rnorm(1000))> x = seq(0,1,length=150)> plot(qt(x,df=n−1), qnorm(x));abline(0,1)> curve(dnorm(x),−3.5,3.5)> curve(dt(x,df=n−l), lty=2, add=TRUE)Repeat the above <strong>for</strong> n=3, 25, 50, and 100. What value of n seems “large” enough to saythat the two distributions are essentially the same?7.22 When the parent population is Normal(µ, σ) with known σ, then confidenceintervals of the typeare both applicable. We have that far enough in the tail, z*

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!