Chapter 13 Continuous Random Variables
13.1 Probability Density Function (PDF) and Cumulative Distribution Function (CDF)
Uniform Distribution
Normal Distribution
Interactive Example: PDF and CDF of a Continuous RV
In this example, we compare the PDF \(f(y)\) and CDF \(F(y)\). You can select between the Uniform and Normal distributions in the left panel and then change parameters associated with those distributions or select a value of \(y\) at which to evaluate the PDF and CDF.
In the main panel, the PDF \(f(y)\) and CDF \(F(y)\) are plotted, followed by equations for each, which are in turn followed by the R commands to calculate the PDF and CDF values. The value of \(f(y)\) at the selected value of \(y\) is shown in the PDF plot as a red dot. The corresponding value of \(F(y)\) is shown in the plot of \(f(y)\) as the blue area and in the plot of \(F(y)\) as a blue dot. As you change the parameters of a distribution or the \(y\) value, the equations and R commands will update to use those values.
Interactive Example: Normal CDF and its Complement
This example compares the CDF and its complement for the Normal distribution. The Normal density \(f(y)\) is plotted in the main panel. The blue area under the curve corresponds to the CDF value \(F(y)\) evaluated at \(y\). The red area under the curve corresponds to the complement \(1-F(y)\). Equations for the Normal CDF and R commands to calculate those values are shown below the plot. You can change the expected value \(\mu\) and standard deviation \(\sigma\) of the Normal distribution, as well as the value of \(y\) at which to evaluate \(F(y)\). The plot, equations, and R commands will update as you do so.
Interactive Example: Calculating the Probability of an Interval
This example illustrates the mechanics of calculating the probability \(\Pr(y_l \le Y \le y_u)\) that a continuous RV \(Y\) will fall in some interval \([y_l, y_u]\). In the left panel, you may choose between a Uniform distribution or a Normal distribution; and you can select the interval bounds for the probability calculation.
The probability \(\Pr(y_l \le Y \le y_u)\) is calculated as \(F(y_u)-F(y_l)\). The top left graph shows the probability associated with \(F(y_l)\) as the red area under the density. The top right graph shows the probability associated with \(F(y_u)\) as the blue area under the density. The lower right graph shows \(\Pr(y_l \le Y \le y_u)\) as the green area, which is the difference \(F(y_u)-F(y_l)\). The lower left graph displays the CDF values \(F(y_l)\) and \(F(y_u)\) as red and blue dots, respectively.
The equations for the calculations and the corresponding R commands are shown below the graphs. If you change the distribution and interval bounds, the graphs, equations, and R commands will update accordingly.
13.2 Percentiles
Interactive Example: Percentiles
In this example, either a Uniform or Normal distribution is shown, along with a hypothetical cumulative probability (or percentage) in the lower or upper ends of the distribution. That probability is displayed as the blue area under the curve. The percentile associated with that probability is shown as the red dashed line.
The R command to calculate the percentile is displayed below the graph. Click Show Another four or five times, or until you understand how percentiles relate to the CDF (and vice versa).
13.3 Summary
Practice Session: Continuous Probability Distributions
This practice session tests your knowledge of the concepts and R commands presented in this chapter. In the main panel, a problem related to PDFs, CDFs, interval calculations, or percentiles is displayed. The problem will be based on either a Uniform distribution or a Normal distribution. You can calculate the answers to these problems using either the equations or R commands provided in the previous sections. Enter your answer in the box in the left panel and click Submit to check your answer. Hit Next to generate a new problem. Attempt at least ten problems before moving on.
The following R commands may prove useful:
\[\begin{array}{lccc}
&\mbox{PDF} & \mbox{CDF} &\\
\mbox{Distribution}& f(y) &F(y) & \mbox{Percentile} \\ \hline
\mbox{Uniform} & \mbox{dunif()} & \mbox{punif()} & \mbox{qunif()}\\
\mbox{Normal} & \mbox{dnorm()} & \mbox{pnorm()} & \mbox{qnorm()}
\end{array}\]