Code
rate_density <- function(r) {
ifelse(r >= 2 & r <= 6, 1 / 4, 0)
}
integrate(rate_density, lower = 2, upper = 6)$value
integrate(rate_density, lower = 3, upper = 5)$valueThe preceding page explained why a continuous distribution assigns zero probability to an exact value. Suppose R is the speaking rate of an utterance in syllables per second. A table of point masses thus cannot describe how probability is arranged across its support.
A probability density function, abbreviated PDF, is a function f_R:\mathbb R\to[0,\infty) satisfying
\mathbb{P}(R\in A)=\int_A f_R(r)\,\mathrm{d}r
for every measurable set A. Probability is obtained by integration, not by reading the density at one point.
The distinction is visible in the statement
\mathbb{P}(R=4)=0
even when f_R(4) is positive. The height describes how quickly probability accumulates near 4 syllables per second.
Consider the constructed function
f_R(r)\equiv \begin{cases} \frac{1}{4} & \text{if }2\leq r\leq6,\\ 0 & \text{otherwise}. \end{cases}
The density has height 1/4 across an interval of width 6-2=4. Its total area is
4\times\frac{1}{4}=1.
Thus the function allocates one unit of total probability across its support.
What is the probability that speaking rate falls between 3 and 5 syllables per second? The interval has width 2 and density height 1/4, so its area is
\begin{aligned} \mathbb{P}(3\leq R\leq5) &=2\times\frac{1}{4}\\ &=.50. \end{aligned}
Integral notation expresses the same area calculation:
\mathbb{P}(3\leq R\leq5) =\int_3^5 f_R(r)\,\mathrm{d}r.
The integral adds the areas of narrow strips across the selected interval. In this constant height example, it reduces to width times height.
A density must be nonnegative:
f_R(r)\geq0 \qquad\text{for every }r.
Its total area must equal one:
\int_{-\infty}^{\infty}f_R(r)\,\mathrm{d}r=1.
These conditions concern area. A density height may exceed one when it is concentrated on a narrow interval. For instance, height 2 across an interval of width .5 gives area 2\times.5=1.
rate_density <- function(r) {
ifelse(r >= 2 & r <= 6, 1 / 4, 0)
}
integrate(rate_density, lower = 2, upper = 6)$value
integrate(rate_density, lower = 3, upper = 5)$valueThe returned values are one for the complete support and .5 for the selected interval.
The density f_R(r) has units reciprocal to those of R. Because R is measured in syllables per second, f_R(r) is measured in seconds per syllable. Multiplying by an interval width measured in syllables per second cancels the units and produces a unitless probability.
This unit check is another reason not to interpret density height as probability. The two objects have different units as well as different mathematical roles.
The value f_R(r) is not \mathbb{P}(R=r). If f_R(4)=.25, it is incorrect to say that the probability of exactly 4 syllables per second is .25. The point probability is zero under the continuous model.
The valid interpretation concerns a region: probability near 4 accumulates at a rate described by the density height, and an interval probability is the area across that region.
Mass and density represent probability differently. The next page gives one threshold function that applies to both representations.