12
$\begingroup$

What is the difference between the density and probability?

I have tried R in which I can use both pnorm and dnorm for the normal distribution and pbinom and dbinom for the binomial distribution, etc.

I have tried reading the documentation but I don't think it's quite clear what the difference is between those two functions. I know that pnorm(x) gives me $P(X \leq x)$.

My guess is that the density is the value of $f(x)$ while the probability is $\int_\infty^x f(x) \, \mathrm{d}x$. If this is correct, I don't understand what the value of $f(x)$ gives me of information since only the area under the function gives me the probability.

I know that the interesting values are pdf=probability density function and cdf=cumulative density function. So maybe the pdf is the value from dnorm and is the area at a specific x while cdf is the value from pnorm and is the area from $\infty$ to the specific x. But I have learned that you cannot get the probability at a specific $x$ in continuous distributions so that explanation does not make sense.

$\endgroup$
1
  • $\begingroup$ Additionally, interpretation of density is discussed here and here. $\endgroup$
    – Glen_b
    Jun 14, 2015 at 8:27

3 Answers 3

16
$\begingroup$

?dnorm is the density function for the normal distribution. If you enter a quantile (i.e., a value for X), and the mean and standard deviation of the normal distribution in question, it will output the probability density.

?pnorm is the distribution function for the normal distribution. If you enter a quantile, and the mean and standard deviation of the normal distirubiton in question, it will output the probability of drawing a random variate from that distribution less than that quantile (you also have the option to specify greater than instead).

(I'll add more in a bit.)

You can also use these functions to plot the PDF and CDF of the specified distribution.

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ At this point I think it's fair to say that "a bit" of time has past. I'm curious to know what more I had intended to add here... $\endgroup$ Jul 14, 2017 at 17:46
  • 1
    $\begingroup$ Good post. pnorm is the cumulative distribution function, right? There's this "probability distribution function" term floating around too. $\endgroup$
    – Pertinax
    Jul 16, 2017 at 21:58
  • 3
    $\begingroup$ @TheThunderChimp, pnorm() is the CDF. 'Probability distribution function' is a nonstandard term; you'd have to ask whoever is using it exactly what they meant. 'Distribution function' is a common synonym for the CDF, so they may mean the CDF. What is potentially confusing is that 'probability distribution function' has the same initials as the 'probability density function' (PDF), which is a different thing from the CDF (it is the derivative). $\endgroup$ Jul 16, 2017 at 23:37
1
$\begingroup$

I think what you said was all correct.

dnorm is density function and pnorm is distribution function. Thus, pnorm is $F(x) = P(X <= x) = \int_{-\infty}^{x}f(x)$ and dnorm is $f(x)$.

Since $f(x) = \frac{dF(x)}{dx} = \lim_{\Delta x \to 0} \frac{F(x+ \Delta x) - F(x)}{\Delta x}$, the value of $f(x)$ shows the probability that a random variable falls in the small interval. (You could treat $f(x)$ as constant in a small interval.)

$\endgroup$
3
  • 3
    $\begingroup$ This strikes me as mostly reasonable, but I think it is problematic to call the density "the probability that random variable falls in the small interval". Note that the density can exceed $1$ (see the thread linked under the question). $\endgroup$ Jun 14, 2015 at 8:29
  • 1
    $\begingroup$ @gung is naturally correct. Any blurring of the dimensional difference between probability and probability density makes the distinction harder to grasp. Further, you say dnorm is ... and pnorm is ... but those are R functions for the normal (Gaussian) distribution, and your notation is more general for continuous distributions. Answers here should try not to be software-specific unless the question demands it. $\endgroup$
    – Nick Cox
    Jun 14, 2015 at 8:41
  • $\begingroup$ @gung you are right. Density is not equal to probability. If treat density as constant in small interval, I should multiply the length of interval. Maybe the word "reflect" is better "show". $\endgroup$
    – Dabiao
    Jun 14, 2015 at 8:59
0
$\begingroup$

Everything you write is correct. As far as I understand your question you are asking, you understand why pnorm(0) = 0.5, but you ask what

> pnorm(0)
[1] 0.5

> dnorm(0)
[1] 0.3989423

does the value dnorm(0) = 0.3989423, i.e. the height of the function mean, if it cannot be a probability? Since I cannot say it better, I refer to https://math.stackexchange.com/a/23401

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.