# Topic 11d # Look at the Normal distribution # # First we will look at the standard normal, N(0,1) # # We will just repeat the kind of questions that # we saw in earlier distributions. # ############################################ # Using the table, find #For the standard normal distribution, N(0,1) # P(X < -0.47 ) = # P(X <= 2.38 ) = # P(X < 1.3765) = # P( X > 2.24 ) = # P( X > -1.39 ) = # P( -0.62 < X < 1.26 ) = # P( X < 0.34 or X>0.98 ) = ###################################### ###################################### # now do the same using the pnorm() function # P(X < -0.47 ) = pnorm( -0.47 ) # P(X <= 2.38 ) = pnorm( 2.38 ) # P(X < 1.3765) = pnorm( 1.3765 ) # P( X > 2.24 ) = 1 - pnorm( 2.24 ) # Is one approach pnorm( 2.24, lower.tail=FALSE ) # another way # P( X > -1.39 ) = 1 - pnorm( -1.39 ) # Is one approach pnorm( -1.39, lower.tail=FALSE ) # another way # P( -0.62 < X < 1.26 ) = pnorm(1.26) - pnorm(-0.62) # P( X < 0.34 or X>0.98 ) = pnorm(0.34) + (1-pnorm(0.98)) # is one way pnorm(0.34) + pnorm( 0.98, lower.tail=FALSE)# is another way ####################################### ## go back to the table and use it to solve: # # find the y value such that # P(X < y ) = 0.2358 y= # P(X < y ) = 0.7611 y= # P(X > y ) = 0.3520 y= # P(X > y ) = 0.9192 y= # P(X < y ) = 0.5981 y= # because a normal distribution is symmetric # P(X< -y or X>y ) = 0.0346 y=? ###################################### ###################################### # now do the same using the qnorm() function # P(X < y ) = 0.2358 y= qnorm( 0.2358 ) # P(X < y ) = 0.7611 y= qnorm( 0.7611 ) # P(X > y ) = 0.3520 y= qnorm( 1 - 0.3520 ) # is one way qnorm( 0.3520, lower.tail=FALSE ) # is another way # P(X > y ) = 0.9192 y= qnorm( 1 - 0.9192 ) # is one way qnorm( 0.9192, lower.tail=FALSE ) # is another way # P(X < y ) = 0.5981 y= qnorm( 0.5981 ) # because a normal distribution is symmetric # P(X< -y or X>y ) = 0.0346 y=? qnorm( 0.0346/2, lower.tail=FALSE) ################ ## and before we leave the standard normal ## look at some special cases ## find P( X>0 and X<1 ) pnorm(1) - pnorm(0) ## find P( -1 < X < 1 ) pnorm(1)-pnorm(-1) ## find P( 1 < X < 2 ) pnorm(2) - pnorm(1) ## find P(0 < X < 2 ) pnorm(2)-pnorm(0) ## find P( -2 < X < 2 ) pnorm(2) - pnorm(-2) ## find P( -3 < X < 3 ) pnorm(3) - pnorm(-3) ############################################# ## Now we will look at non-standard normal ## distribution. For each such non-standard ## normal distribution we need to give the ## mean and the standard deviation of that ## distribution. We will do this in the ## N(mean, standard deviation) syntax. Thus ## N(25,7) is a normal distribution with ## mean=25 and standard deviation=7. ############################################### ## # for a N(25,7) find P(X < 32) # the long way is to compute the equivalent z value # for a standard normal z <- (32 - 25)/7 z # and then find P(X < z ) for a N(0,1) pnorm( z ) # neat way in R is to use the longer pnorm() pnorm( 32, mean=25, sd=7) # for a N(9,13) find P(X<32) # the long way z <- (32-9)/13 z pnorm( z ) # the neat way pnorm( 32, mean=9, sd=13) # for N(13.7, 4.6) find P( X > 16.2 ) # the long way z <- (16.2 - 13.7)/4.6 z pnorm( z, lower.tail=FALSE) # or 1 - pnorm( z ) # the neat way pnorm( 16.2, mean=13.7, sd=4.6, lower.tail=FALSE) # or 1 - pnorm(16.2, mean=13.7, sd=4.6) # for N(-6.2, 1.34) find P( -7 < x < -5) # the long way z1 <- (-7 - -6.2)/1.34 z1 z2 <- (-5 - -6.2)/1.34 z2 pnorm( z2 ) - pnorm(z1) # the neat way pnorm( -5, mean=-6.2, sd=1.34) - pnorm( -7, mean=-6.2, sd=1.34) # portions of the SAT are created so that the # distribution of scores is normal with mean=500 # and standard deviation of 100. # # Is we select a random test taker, what is the # probability that that person's score is # more than 625? # i.e., for a N(500,100) what is P( X > 625 ) # the long way z <- (625-500)/100 z pnorm( z, lower.tail=FALSE) # the neat way pnorm( 625, 500, 100, lower.tail=FALSE) # Note that as long as you put the mean and # standard deviation in the right order you # do not need to name them. ############################################## ### Now we will go the other way. Find the ### y value such that p is the desired ### probability. # for a N(45.7,8.6 ) distribution, find y such # that P(X < y ) = 0.333 # the long way... # what is the z value in a standard normal # such that P(X < z) = 0.333 z <- qnorm( 0.333 ) z # then translate that back to our N(45.7, 8.6) z*8.6+45.7 # the neat way qnorm( 0.333, mean=45.7, sd=8.6) # for a N(-9.2, 1.6 ) distribution, find y such # that P(X > y ) = 0.219 # what is the z value in a standard normal # such that P(X > z) = 0.219 z <- qnorm( 1 - 0.219 ) z # then translate that back to our N(-9.2, 1.6 ) z*1.6 + -9.2 # the neat way qnorm( 0.219, mean=-9.2, sd=1.6, lower.tail=FALSE) # for a N(134.2, 12.43 ) distribution, # find y1 and y2 such # that P(X < y1 or X>y2 ) = 0.075 # and where abs(mean - y1 ) = abs(mean-y2) # What is the z value in a standard normal # such that P(-z < X < z) = 0.075 # # this works because the normal distribution # is symmetric z <- qnorm( 0.075/2, lower.tail=FALSE ) z # then translate z back to our N(134.2, 12.43 ) y2 <- z*12.43 + 134.2 # this is our y2 y2 # and translate -z back to our N(134.2, 12.43 ) y1 <- -z*12.43 + 134.2 # this is our y1 y1 # note abs( 134.2 - y1) abs( 134.2 - y2) # and # the neat way qnorm( 0.075/2, mean=134.2, sd=12.43, lower.tail=FALSE) # this is y2 qnorm( 0.075/2, mean=134.2, sd=12.43 ) # this is y1 # Going back to the SAT distribution, N(500,100), # find the 73rd percentile. That is just the # score that has 73% of the values be less than it. qnorm( 0.73, 500,100)