24

How can I find the PDF (probability density function) of a distribution given the CDF (cumulative distribution function)?

Mehper C. Palavuzlar
  • 1,086
  • 3
  • 15
  • 25
  • 8
    I am not sure I understand the difficulty. If the functional form is known just take the derivative otherwise take differences. Am I missing something here? –  Jul 19 '10 at 19:31
  • 1
    I am guessing the question is about multivariate case. – user1700890 Aug 05 '15 at 23:28

3 Answers3

25

As user28 said in comments above, the pdf is the first derivative of the cdf for a continuous random variable, and the difference for a discrete random variable.

In the continuous case, wherever the cdf has a discontinuity the pdf has an atom. Dirac delta "functions" can be used to represent these atoms.

Paul
  • 1,313
  • 1
  • 15
  • 16
  • There is a nice online textbook by Pishro-Nik [here](http://www.probabilitycourse.com/chapter4/4_3_2_delta_function.php) showing this more explicitly. – gwr Nov 28 '15 at 11:29
  • Does something similar hold for multivariate case? (I found the answer [here](http://www.cims.nyu.edu/~cfgranda/pages/DSGA1002_fall16/material/multivariate_random_variables.pdf) page 9). $f(\mathbf x) = \frac{\partial^n F(\mathbf x)}{\partial x_1 \dots \partial x_n}$ – MInner Oct 30 '17 at 15:36
  • Would you mind give an example that a cdf has a discontinuity? – whnlp Sep 27 '19 at 08:33
  • @Paul are you wrong in saying above that the discrete pdf is simply the difference of the cdf, $F(x_2) - F(x_1)$? shouldn't it be $\frac{F(x_2) - F(x_1)}{x_2 - x_1}$? – develarist Dec 05 '20 at 14:25
  • @develarist You are correct in that this is imprecise. If the discrete outcomes are consecutive integers, then the difference is sufficient. – Paul Dec 06 '20 at 01:51
12

Let $F(x)$ denote the cdf; then you can always approximate the pdf of a continuous random variable by calculating $$ \frac{F(x_2) - F(x_1)}{x_2 - x_1},$$ where $x_1$ and $x_2$ are on either side of the point where you want to know the pdf and the distance $|x_2 - x_1|$ is small.

guy
  • 7,737
  • 1
  • 26
  • 50
seancarmody
  • 788
  • 6
  • 8
  • 1
    Thats the same as taking the derivative, but just more inaccurate so why would you do it? – Matti Pastell Jul 20 '10 at 09:39
  • 6
    This would be the approach when the CDF is only approximated empirically. It gives lousy estimates of the PDF, though. – shabbychef Oct 20 '10 at 05:13
  • Given CDF percentile values, is there a better way to calculate PDF from these discrete values ? – bicepjai Jul 23 '18 at 17:41
  • In this case, are all x from x1 to xn sorted in an ascending order first so that it is always xn>x(n-1)>x(n-2)>…..x3>x2>x1? – Eric Oct 02 '18 at 14:54
0

Differentiating the CDF does not always help, consider equation:

 F(x) = (1/4) + ((4x - x*x) / 8)    ...    0 <= x < 2,  

Differentiating it you'll get:

((2 - x) / 4) 

substituting 0 in it gives value (1/2) which is clearly wrong as P(x = 0) is clearly (1 / 4).

Instead what you should do is calculate difference between F(x) and lim(F(x - h)) as h tends to 0 from positive side of (x).

Dave2e
  • 1,441
  • 4
  • 14
  • 18