

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: Introduction to Statistical Methods for Life and Health Sciences; Subject: Statistics; University: University of California - Los Angeles; Term: Unknown 1989;
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


This homework begins with reading Sections 3.6, 4.1-4.4 and 4.6 of your textbook. (This will help with your lab due next week also.) The text spends a fair bit of space in Section 4.3 explaining how to look up information on a normal table. This is not a skill we will emphasize in this class. Instead of understanding the mechanics of table lookup, we would prefer that you understand the relationship between a standard normal and a normal with any other mean μ and standard deviation σ.
Questions: 4.3, 4.4, 4.16, 4.
Rather than use a table to compute the probabilities the book asks for, we would prefer you use the functionality in R. Specifically, R provides four functions to help you with the normal distribution: pnorm, qnorm, dnorm and rnorm. (The “p” because it returns probabilities; the “q” because it returns quantiles – or percentiles as your book calls them; the “d” because it returns the bell curve or density; and the “r” because it generates random samples.)
First, suppose we are asked about a normal distribution with with mean μ = 5 and standard deviation σ = 2. We can find the area under the associated bell curve to the left of 6 (that is, find the chance that Y ≤ 6 if the distribution of Y has a bell shape centered at μ = 5 with σ = 2) with the command
pnorm(6,m=5,s=2)
If you leave out the arguments m and s, then R will assume you are referring to the standard normal distribution with mean 0 and standard deviation 1. As you will see in the book, you can transform the problem above to one involving a standard normal so that the command
pnorm((6-5)/2)
should give you the same answer. Before computers were so commonplace (or to help instructors give in-class exams), a lot of emphasis was placed on transforming the problem to so-called standard units and looking things up in the table. Since
you will do all your homework in R, this is a less important skill.
The function qnorm provides the so-called quantile or percentile function. Contin- uing our mean 5 and standard deviation 2 example, we can find the point below which we have 80% of the area under the curve with the command
qnorm(0.8,m=5,s=2)
Similarly, you can find the lower quartile, the median and the upper quartile (the three points that divide the area under the curve into fourths) with the commands
qnorm(0.25,m=5,s=2) qnorm(0.5,m=5,s=2) qnorm(0.75,m=5,s=2)
Or, you can compute all three at once after having “contatenated” the three values into one object c(0.25,0.5,0.75) (technically, this takes our three values and makes them into a vector).
qnorm(c(0.25,0.5,0.75),m=5,s=2)
You should now have three points in a single vector as your answer. As with pnorm, if you do not specify a mean and standard deviation, the function will assume you mean the standard normal. Using this, you can get the same answer by transforming back from standard units
2*qnorm(0.25)+
(see your text for examples). Next, you can draw the normal curve you are interested in using the command dnorm. Below, we create a sequence (a vector) of 100 numbers ranging from 5-32 = -1 to 5+32 = 11 (the mean of our normal plus or minus three standard deviations – which should cover 99% of the area)
x = seq(-1,11,length=100) y = dnorm(x,m=5,s=2) plot(x,y,type="l")
Recall that the argument type tells R you want a line plot. Finally, you can use rnorm to generate a random sample from the indicated normal distribution.