How can I find the PDF (probability density function) of a distribution given the CDF (cumulative distribution function)?
-
8$\begingroup$ 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? $\endgroup$– user28Jul 19, 2010 at 19:31
-
2$\begingroup$ I am guessing the question is about multivariate case. $\endgroup$– user1700890Aug 5, 2015 at 23:28
3 Answers
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.
-
-
1
-
$\begingroup$ Would you mind give an example that a cdf has a discontinuity? $\endgroup$– whnlpSep 27, 2019 at 8:33
-
$\begingroup$ @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}$? $\endgroup$ Dec 5, 2020 at 14:25
-
$\begingroup$ @develarist You are correct in that this is imprecise. If the discrete outcomes are consecutive integers, then the difference is sufficient. $\endgroup$– PaulDec 6, 2020 at 1:51
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.
-
2$\begingroup$ Thats the same as taking the derivative, but just more inaccurate so why would you do it? $\endgroup$ Jul 20, 2010 at 9:39
-
6$\begingroup$ This would be the approach when the CDF is only approximated empirically. It gives lousy estimates of the PDF, though. $\endgroup$ Oct 20, 2010 at 5:13
-
$\begingroup$ Given CDF percentile values, is there a better way to calculate PDF from these discrete values ? $\endgroup$– bicepjaiJul 23, 2018 at 17:41
-
$\begingroup$ 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? $\endgroup$– EricOct 2, 2018 at 14:54
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).
-
$\begingroup$ (-1) Because this CDF does have a derivative, the random variable is continuous and clearly $P(x=0)=0.$ You appear to be confusing densities with probabilities. $\endgroup$– whuber ♦Apr 6, 2022 at 14:06