The R function pnorm() will be very helpful to use for
calculating probabilities. In order to use it we need to tell the
function a few specific things we are using:
Here is an example of using the pnorm() function to
calculate the probability P(X < 7) for a normal distribution with a
mean of 10 and std. dev. of 2. Note R by default finds “<”
probabilities.
pnorm(7, mean = 10, sd = 2)
## [1] 0.0668072
Here is an example of using the pnorm() function to
calculate the probability P(X > 25) for a normal distribution with
mean 30 and std. dev. 10.
pnorm(25, mean=30, sd=10, lower.tail = FALSE)
## [1] 0.6914625
# Nice
When using a standard normal distribution, we do not need to specify mean and std. dev. in the pnorm function.
pnorm(-2)
## [1] 0.02275013
pnorm(2, lower.tail=F)
## [1] 0.02275013