pnorm() Function in R

pnorm() function calculates the probability of a normally distributed number q, with a specified mean and standard deviation.

Syntax

``pnorm(x, mean = , sd = , lower.tail= )``

Arguments

• q = numeric value to test for probability
• mean = mean of the distribution
• sd = standard deviation of the distribution
• lower.tail = TRUE or FALSE

The mean, sd, and lower.tail arguments are optional. If you do not pass a value to them, they will take the default values as mean = 0, sd = 1 and lower.tail = TRUE.

Given the value of q, pnorm returns the probability of that value or less. For example, letâ€™s say the snow height value is given as q. Passing the pnorm() function will return the probability of the snow height q or less, i.e., the left side of the distribution. However, to calculate the right side of the distribution or the probability of snow height q or greater, you have to change lower.tail argument to TRUE.

Examples

Suppose snow heights in your area are normally distributed with a mean of 56 inches and a standard deviation of 8.

Example 1: What is the probability that the snow height will be less than or equal to 45 inches?

``pnorm(45, mean = 56, sd = 8)``

Output

``[1] 0.08456572``

Example 2: What is the probability that the snow height will be greater than or equal to 45 inches?

``pnorm(45, mean = 56, sd = 8, lower.tail = FALSE)``

Output

``[1] 0.9154343``

In Example 2, we assigned lower.tail argument as FALSE because we wanted to calculate the right side of the distribution.