lower.tail in qnorm() and pnorm() (4 Examples)

This tutorial explains how to set and understand lower.tail in qnorm() and pnorm().

qnorm(p, mean, sd, lower.tail = TRUE, log.p = FALSE)

pnorm(q, mean, sd, lower.tail = TRUE, log.p = FALSE)

For both qnorm and pnorm, the meaning of lower.tail is the same:

  • TRUE means p=F(q). That is, cdf is calculated from -∞ to q.
  • FALSE means p=1-F(q). That is, cdf is calculated from q to +∞.

Example 1: TRUE for lower.tail in qnorm

The following qnorm() returns the quantile of 1.995393, which is very close to 2.

> qnorm(0.977, 0, 1, lower.tail = TRUE)
[1] 1.995393

From cdf perspective, the probability of 0.977 is calculated in the range of x=(-∞, 2), see below.

\[ \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{2}\exp\left\{-\frac{u^2}{2}\right\} du=0.977 \]

To understand the relationship between quantile and probability, we can plot it (see below). Visually, the area of red shaded region is 0.977, and the quantile (i.e., x-axis value) is approximate to 2.

lower.tail = TRUE for qnorm() in R

Example 2: FALSE for lower.tail in qnorm

As shown below, qnorm returns the quantile of 1.995, which is close to 2.

Thus, when lower.tail=FALSE, p=1-F(q)=1-F(1.995)=1-1.977=0.023.

> qnorm(0.023, 0, 1, lower.tail = FALSE)
[1] 1.995393

From cdf perspective, the probability of 0.023 is calculated in the range of x=(2, +∞), see below.

\[ \frac{1}{\sqrt{2 \pi}} \int_{2}^{+\infty}\exp\left\{-\frac{u^2}{2}\right\} du=0.023 \]

Visually, the following is the plot. The area of shaded region is 0.023 and the quantile is 1.995393. That is, the quantile (i.e., the value of x-asix) is approximate to 2.

lower.tail = FALSE for pnorm() in R
lower.tail = FALSE for qnorm() in R

Example 3: TRUE for lower.tail in pnorm

In the following, pnorm() returns the probability of 0.977. It corresponds with the quantile of 2. Thus, Example 3 is the inverse of Example 1 (i.e., pnorm is the inverse of qnorm.).

> pnorm(2, 0, 1, lower.tail = TRUE)
[1] 0.9772499

Example 4: FALSE for lower.tail in pnorm

Below, pnorm() returns the probability of 0.02275013. It corresponds with the quantile of 2. Thus, Example 4 is the inverse of Example 2 (again, pnorm is the inverse of qnorm.).

> pnorm(2, 0, 1,lower.tail = FALSE)
[1] 0.02275013

Further Reading

You can read the other tutorials on pnorm() and qnorm().