1
$\begingroup$

Exponential distribution has following probability density function which explains the curvature of a line (For simplicity I am just going to work with x>=0):

f(x) = lambda e^{-lambda*x}

to find out probability we simply take the integral w.r.t. x on range of interest, ex: x=[1,3], x is a random variable.

And taking integral along whole x-axis give us Cumulative Distribution Function, but it seems like taking integral of CDF give us PDF.

when lambda = 1

cdf = -e^{-x}
integral(-e^{-x}df) = e^{-x} = pdf

and if we keep on integrating it will just go in a loop. So my understanding right now is that area under CDF represents gradients??

can someone clarify this for me please?

Here is my code:

import math

lbda = 1

def exp_pdf(x):
    return 1*math.exp(-x)

def exp_cdf(x):
    return 1-math.exp(-x)

x = np.arange(0, 10, 0.1)
y = np.vectorize(exp_pdf)(x)

fig = go.Figure()
fig.add_trace(
    go.Scatter(
        x=x,
        y=y
    )
)

xx = np.arange(1,3, 0.1)
fig.add_trace(
    go.Scatter(
        x = xx,
        y = np.vectorize(exp_pdf)(xx), 
        fill = 'tozeroy'
    )
)

fig.update_layout(
    title="PDF of Exponential distribution"
)

fig.show()

and graph of PDF and CDF. enter image description here

enter image description here

$\endgroup$
2
  • $\begingroup$ Your charts say the integral of the pdf gives the CDF (or the derivative of the CDF gives the pdf). But your question says it the other way round *"it seems like taking integral of CDF give us PDF." $\endgroup$
    – Henry
    Commented Jul 21, 2021 at 9:42
  • $\begingroup$ In addition to the duplicate, stats.stackexchange.com/questions/105509 and stats.stackexchange.com/a/224410/919 are informative. $\endgroup$
    – whuber
    Commented Jul 21, 2021 at 12:34

1 Answer 1

0
$\begingroup$

Let $x\sim Exp(\lambda)$ then the PDF is $f(x)=\lambda e^{-\lambda x}$. Integrating this:

$$P(x\le a)=\int_0^a{\lambda e^{-\lambda x}}=\lambda\int_0^a{ e^{-\lambda x}}=\lambda\left[ -\frac{1}{\lambda}e^{-\lambda x} \right]_0^a=(-e^{-\lambda a})-(-e^{-\lambda 0})=1-e^{-\lambda a}$$

Next, let's try integrating the CDF from $a$ to $b$ where $0<a<b$:

$$\int_a^b{1-e^{-\lambda x}}=\left[x -\frac{1}{\lambda}e^{-\lambda x} \right]_a^b=b-\frac{1}{\lambda}e^{-\lambda b}-a+\frac{1}{\lambda}e^{-\lambda a}=\frac{1}{\lambda}\left( \lambda(b-a) + e^{-\lambda a} -e^{-\lambda b} \right)$$

Now, If we set $\lambda=1$ we get $P(x \le a)=1-e^{-a}$ and the integral of the CDF is $\left( (b-a) + e^{- a} -e^{- b} \right)$ (definite) or $x -e^{-x}$ (indefinite). As you can see, it is not the PDF.

$\endgroup$

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