1

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

haneulkim
  • 201
  • 1
  • 5
  • 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." – Henry Jul 21 '21 at 09:42
  • In addition to the duplicate, https://stats.stackexchange.com/questions/105509 and https://stats.stackexchange.com/a/224410/919 are informative. – whuber Jul 21 '21 at 12:34

1 Answers1

0

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.

Tim
  • 108,699
  • 20
  • 212
  • 390
Spätzle
  • 2,331
  • 1
  • 10
  • 25