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.

Simulation 1756.3 For what value of n does look approximately normal when each is Uni<strong>for</strong>m(0,1)? (Run several simulations <strong>for</strong> different n’s and decide where the switch to normalitybegins.)6.4 For what value of n does look approximately normal when each Xi is(Exponential(1) (rexp(n, 1))?6.5 For what value of n does look approximately normal when each Xi has a t-distribution with 3 degrees of freedom (rt (n, 3))?6.6 Compare the distributions of the sample mean and sample median when the X ihave the t distribution with 3 degrees of freedom and n=10. Which has a bigger spread?6.7 The χ 2 distribution arises when we add a number of independent, squared standardnormals. Instead of using rchisq() to generate samples, we can simulate by addingnormally distributed numbers. For example, we can simulate a χ 2 distribution with 4degrees of freedom with> res = c()> <strong>for</strong>(i in 1:500) res[i] = sum(rnorm(4)^2)> qqnorm(res)Repeat the above <strong>for</strong> 10, 25, and 50 degrees of freedom. Does the data ever appearapproximately normal? Why would you expect that?6.8 The correlation between and s 2 depends on the parent distribution. For a normalparent distribution the two are actually independent. For other distributions, this isn’t so.To investigate, we can simulate both statistics from a sample of size 10 andobserve their correlation with a scatterplot and the cor() function.> xbar = c();std = c()> <strong>for</strong>(i in 1:500) {+ sam = rnorm(10)+ xbar [i] = mean(sam); std[i] = sd(sam)+}> plot(xbar,std)> cor(xbar,std)[1] 0.09986The scatterplot (not shown) and small correlation is consistent with known independenceof the variables.Repeat the above with the t-distribution with 3 degrees of freedom (a longtailedsymmetric distribution) and the exponential distribution with rate 1 (a skeweddistribution). Are there differences? Explain.6.9 For a normal population the statistic has a normaldistribution. LetThat is, σ is replaced by s, the sample standard deviation. The sampling distribution of Tis different from that of Z.

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

Saved successfully!

Ooh no, something went wrong!