Tutorials › Introduction to Statistics › Using Cumulative and Quantile Functions for These Distributions

t, Chi-Square and F Distributions · Tutorial 497 of 996

Using Cumulative and Quantile Functions for These Distributions

Use cumulative functions to find probabilities from values, and quantile functions to find values from probabilities, while keeping tail direction and degrees of freedom straight.

Intermediate 9 min read

What You'll Learn

  • Interpret a cumulative probability as the probability of being at or below a value.
  • Convert between lower-tail and upper-tail probabilities.
  • Use R’s cumulative and quantile functions for t, chi-square, and F distributions.
  • Choose the correct degrees-of-freedom inputs for each function.
  • Check a software result by reversing the probability–value calculation.

From Values to Probabilities and Back

A distribution describes how probability is spread across possible values. Once a random variable is specified to follow a t, chi-square, or F distribution, two questions arise repeatedly: What is the probability of being at or below a chosen value? And what value marks a chosen cumulative probability? Cumulative and quantile functions answer these questions in opposite directions.

The distinction matters because software functions usually expect a probability in a particular tail. A value such as 0.05 might mean a probability in the lower tail or the upper tail, depending on the function settings. The reliable approach is to state the probability in words first, translate it to the function’s convention, and then check the result.

Definition: For a random variable \(X\), its cumulative distribution function is \(F_X(x)=P(X\leq x)\). For a probability \(u\) between 0 and 1, the quantile function is \(Q_X(u)=\inf\{x:F_X(x)\geq u\}\). For the continuous t, chi-square, and F distributions, \(Q_X(u)\) is the value whose cumulative probability is \(u\), so \(F_X(Q_X(u))=u\).

The cumulative function takes a value as its input and returns a probability. The quantile function does the reverse: it takes a cumulative probability as its input and returns a value. The letters used in software can obscure this distinction, so always identify the kind of input before entering a command.

Lower Tails, Upper Tails, and Quantiles

The cumulative function is a lower-tail probability: it counts outcomes no greater than \(x\). The upper-tail probability is the probability of an outcome greater than \(x\). For a continuous random variable, the probability of equaling one exact value is zero, so using “greater than” or “greater than or equal to” gives the same probability.

$$ P(X>x)=1-F_X(x) $$

This complement rule is the key translation between tail directions. If a question gives an upper-tail probability \(a\) and asks for the threshold \(c\) such that \(P(X>c)=a\), then the lower-tail probability at \(c\) is \(1-a\). Thus the threshold is \(Q_X(1-a)\). Software can either be given the lower-tail probability \(1-a\), or—in R—be asked directly for the quantile associated with an upper-tail probability.

For each distribution, R uses a pair of functions. The p-function calculates cumulative probabilities from values; the q-function calculates quantiles from probabilities. The relevant forms are:

DistributionCumulative probability from a valueQuantile from a probability
t with \(df\) degrees of freedompt(x, df)qt(u, df)
Chi-square with \(df\) degrees of freedompchisq(x, df)qchisq(u, df)
F with numerator \(df_1\) and denominator \(df_2\)pf(x, df1, df2)qf(u, df1, df2)

Unless told otherwise, the p-functions return lower-tail probabilities, and the q-functions use lower-tail probability inputs. In R, adding lower.tail=FALSE requests an upper-tail probability from a p-function or gives an upper-tail probability as the input to a q-function. The degrees of freedom are part of the distribution specification, not optional labels. For an F distribution, \(df_1\) is the numerator degrees of freedom and \(df_2\) is the denominator degrees of freedom.

Worked Examples

Worked Example: A t Cumulative Probability and Quantile

Suppose a hypothetical standardized measurement \(T\) follows a t distribution with \(df=10\). Find (a) the probability that \(T\leq 1.5\), and (b) the value with 97.5% of the distribution at or below it.

(a) Probability from a value. The requested event is a lower-tail event, so the input is the value \(1.5\), with 10 degrees of freedom:

$$ P(T\leq 1.5)=\texttt{pt(1.5, df=10)}\approx 0.9177. $$

Thus approximately 91.77% of the t distribution with 10 degrees of freedom lies at or below 1.5. The corresponding upper-tail probability is \(1-0.9177=0.0823\), or about 8.23%.

(b) Value from a probability. The requested cumulative probability is 0.975, so use the q-function:

$$ Q_T(0.975)=\texttt{qt(0.975, df=10)}\approx 2.228. $$

The check is that pt(2.228, df=10) is approximately 0.975. The quantile is a t value, not a probability. Because a t distribution is symmetric about zero, its 0.975 quantile is positive; symmetry is a useful check on the direction and scale of this result.

Worked Example: A Chi-Square Upper-Tail Probability

Suppose a hypothetical statistic \(C\) follows a chi-square distribution with \(df=8\). Find the probability that \(C\) exceeds 12, and then find the value that leaves 5% of the distribution above it.

Probability above 12. The p-function ordinarily returns the probability at or below its input. The requested probability is instead in the upper tail, so either take a complement or use the upper-tail option:

$$ P(C>12)=1-P(C\leq 12) =1-\texttt{pchisq(12, df=8)} \approx 1-0.8488 =0.1512. $$

Equivalently, pchisq(12, df=8, lower.tail=FALSE) returns approximately 0.1512 directly. In context, about 15.12% of values from a chi-square distribution with 8 degrees of freedom exceed 12.

Value with 5% above it. The desired value \(c\) satisfies \(P(C>c)=0.05\), so its lower-tail probability is \(1-0.05=0.95\). Therefore:

$$ c=\texttt{qchisq(0.95, df=8)}\approx 15.507. $$

Alternatively, qchisq(0.05, df=8, lower.tail=FALSE) uses 0.05 as an upper-tail probability and returns the same value. A check is that pchisq(15.507, df=8) is approximately 0.95, while the upper-tail probability is approximately 0.05. The result is a chi-square value, not a probability.

Worked Example: An F Quantile and Its Tail Probability

Suppose a hypothetical random variable \(W\) follows an F distribution with numerator degrees of freedom \(df_1=1\) and denominator degrees of freedom \(df_2=1\). Find the 75th percentile and use it to state the corresponding upper-tail probability.

The 75th percentile is the value with cumulative probability 0.75. In R, the first degrees-of-freedom input is the numerator degrees of freedom, followed by the denominator degrees of freedom:

$$ c=\texttt{qf(0.75, df1=1, df2=1)} \approx 5.828. $$

The lower-tail probability at this value is 0.75, so the upper-tail probability is its complement:

$$ P(W>c)=1-0.75=0.25. $$

The same quantile can be requested directly as an upper-tail quantile with qf(0.25, df1=1, df2=1, lower.tail=FALSE). To check the result, pf(5.828, df1=1, df2=1) is approximately 0.75, and the upper-tail version is approximately 0.25. The quantile is expressed in F-statistic units.

Why the Two Functions Reverse One Another

For these distributions, the cumulative function increases as the value increases: a larger cutoff includes at least as much of the distribution to its left. A quantile selects the cutoff at which the cumulative probability reaches a specified level. This explains why a quantile can be checked by putting it back into the cumulative function.

For a continuous distribution with a strictly increasing cumulative function, the relationship can be stated directly. If \(c=Q_X(u)\), then \(F_X(c)=u\), and consequently the probability to the right of \(c\) is \(1-u\). Conversely, if the desired right-tail probability is \(a\), then the cutoff has cumulative probability \(1-a\):

$$ F_X(c)=u \quad\Longleftrightarrow\quad c=Q_X(u), \qquad P(X>c)=a \quad\Longleftrightarrow\quad c=Q_X(1-a). $$

This is a short but powerful justification for reversing a software calculation. If a q-function returns a value, a p-function should recover the probability used to request it. If the question was stated in the upper tail, the recovered lower-tail probability should be the complement of the requested upper-tail probability.

1
Name the distribution and degrees of freedom.
Identify whether the variable is t, chi-square, or F; for F, record numerator and denominator degrees of freedom in that order.
2
Decide whether the input is a value or a probability.
A probability requested at a cutoff calls for a p-function. A cutoff requested for a stated probability calls for a q-function.
3
Identify the tail in the question.
For an upper-tail probability, use the complement of the lower-tail probability or set lower.tail=FALSE. For an upper-tail quantile, use the upper-tail option or convert the tail probability to its lower-tail complement.
4
Check the result by reversing the calculation.
For a quantile, evaluate the cumulative probability at the returned value. For a tail probability, check that the lower and upper tails add to 1.

Common Mistakes and Practical Checks

The most common error is to enter an upper-tail probability into a function that defaults to the lower tail. For example, if a question asks for the cutoff with 5% above it, entering 0.05 into qchisq(0.05, df=8) gives the 5th percentile, not the cutoff with 5% above it. The correction is to request the 95th percentile, or to use qchisq(0.05, df=8, lower.tail=FALSE).

Other checks can catch input and interpretation errors:

  • Check whether the output should be a probability or a value. A p-function returns a number between 0 and 1; a q-function returns a point on the distribution’s scale.
  • Check the degrees of freedom. An otherwise correct command can describe the wrong distribution if a degrees-of-freedom input is missing or misplaced.
  • Check tail complements. At a fixed cutoff, the lower-tail and upper-tail probabilities should sum to 1, apart from rounding.
  • Check the distribution’s support. Chi-square and F values cannot be negative. A negative quantile from either distribution indicates an input or interpretation error.
  • Check the probability level. A larger cumulative probability should correspond to a quantile farther to the right, not farther to the left.

These functions are useful whenever a probability statement must be converted into a numerical cutoff, or a proposed cutoff must be assessed probabilistically. In each case, writing down the event first—such as \(P(X\leq x)\) or \(P(X>x)\)—keeps the software command tied to the question rather than to a memorized pattern.

Key takeaway: A p-function maps a value to a cumulative probability; a q-function maps a cumulative probability to a value. State the tail direction explicitly, use the appropriate degrees of freedom, and verify the result by reversing the calculation.

Check Your Understanding

For each question, identify the function type and tail direction before calculating.

  1. For \(T\) with \(df=12\), what R command gives \(P(T\leq 1.8)\)? What command gives \(P(T>1.8)\)?
  2. A chi-square variable has \(df=6\). Explain why the value with 10% above it is found from a lower-tail probability of 0.90.
  3. What does qf(0.95, df1=4, df2=15) return: a probability or an F value? What cumulative probability should result when that value is supplied to the corresponding p-function?
  4. What is the mistake in using qt(0.05, df=9) to find the positive t cutoff with 5% above it? State a correct command.
  5. If an upper-tail probability is 0.23 at a specified cutoff, what should the lower-tail probability be, apart from rounding?