
<p>Normal, Binomial, Poisson Distribution/CLT/Normality Checking</p><p>(R Textbook Section 3.5) </p><p>Four fundamental items can be calculated for a statistical distribution:</p><p> Density or point probability (starting with d)</p><p> Cumulated probability, distribution function (starting with p)</p><p> Quantiles (starting with q)</p><p> Random numbers (starting with r)</p><p>In addition, norm represents normal distribution, binom represents binomial distribution and pois represents Poisson distribution. For example, dnorm, pnorm, qnorm, and rnorm calculate density, probability, quantile and random number from a normal distribution, respectively.</p><p>Example: </p><p> a) Let X be a normal random variable with given mean and sd. Then,</p><p> Probability that X is less than or equal to x is pnorm(x,mean,sd)</p><p> 100pth percentile of X is qnorm(p,mean,sd)</p><p> b) Let X be a binomial random variable with n trials and success rate p. Then, Probability that X is less than or equal to x is pbinom(x,n,p) 100pth percentile of X is qbinom(p,n,p) Probability that X is equal to x is dbinom(x,n,p)</p><p> c) Let X be a Poisson random variable with location parameter ld. Then, Probability that X is less than or equal to x is ppois(x,ld) 100pth percentile of X is qpois(p,ld) Probability that X is equal to x is dpois(x,ld)</p><p>Central Limit Theorem(CLT) </p><p>Consider an experiment of flipping an unbalanced coin (with .3 chance to get head up). Each time the result is either X =0 (tail) or 1 (head).</p><p> a) What is the distribution of X? Is it bell shaped (normal)?</p><p> b) Repeat the experiment 40 times. Let X-bar be the mean of the 40 results. By CLT, will it be approximately normal? </p><p> c) Simulate the distribution of X-bar. Here is the R code:</p><p># simulate 5000 sums of 40 flipping results</p><p>1 xbar<-rbinom(5000,40,.3)</p><p># mean is the sum over trial size</p><p> xbar<-xbar/40</p><p># draw the histogram of the simulated data</p><p> hist(xbar)</p><p>Exercise: Redo b) and c) with only 10 times of coin flipping. </p><p>Normality Checking </p><p> By graphs: If the data does sampled from a normal distribution, its normal Q-Q plot will be more or less a straight line.</p><p> By tests: later</p><p>Example: a) Based on the data in Table 3.1 again, check if it is reasonable to assume the math scores (of all third to fifth graders) follow a normal curve.</p><p>R Code: math<-tb3dot1$Math</p><p> qqnorm(math,main="normal Q-Q Plot of math score")</p><p> qqline(math,col=2)</p><p> b) Simulate a random sample of 20 from norm(0,1) and check the normality of the simulated data by the normal Q-Q plot. What is the result? </p><p>R Code: data<-rnorm(20,0,1)</p><p>2 qqnorm(data) qqline(data,col=2)</p><p>3</p>
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages3 Page
-
File Size-