I have the following P.D.F function:

$$g(x)=4 \cdot 38^{4} x^{-5}, \quad x \geq 38$$

By taking the inverse of the CDF i get:

$$G^{-1}(u)=\left\{\begin{array}{ll} \sqrt[4]{-38/u}, & \text { if } u \text { > } 0 \\ -\sqrt[4]{-38/u}, & \text { if } u \text { < } 0 \end{array}\right.$$

So when I try to code this in R and use values from a uniform distribution to feed them into this inverse function

   u <- runif(1000, -1, 0)

   inverse_function_n2 <- function(u){(-38/u)^(1/4)}

   values_derived_from_inverse_CDF <- inverse_function_n2(u)

I get a nice histogram that resembles the function g(x)

curve(4*38^4*x^-5, 38, 100, add = FALSE, col = "orange", lwd=1)

But when I plug the values that derive from the inverse CDF back into g(x) I do not get a uniform distribution.


Perhaps there is something wrong with my math here?

  • 1
    $\begingroup$ Why did you expect to get a uniform? $\endgroup$
    – innisfree
    May 29, 2020 at 11:37
  • $\begingroup$ I suggest you clean the comments that are not relevant for other readers. $\endgroup$
    – Xi'an
    Jun 5, 2020 at 8:59

1 Answer 1


The Pareto distribution $\mathcal{Pa}(38,5)$ has density (pdf) $g$ and cumulative function (cdf) $$G(x)=[1-(x/38)^{-4}]\mathbb{I}_{(38,\infty)}(x)$$ Solving $G(x)=u$ thus leads to $1-u=(x/38)^{-4}$ $$G^{-1}(u)=\frac{38}{(1-u)^{1/4}}$$ Since the Uniform distribution is symmetric, simulating the Pareto distribution $\mathcal{Pa}(38,5)$ can thus be done by generating $U\sim\mathcal U(0,1)$ and taking$$X=38U^{-1/4}$$


shows a perfect fit to $g$.

However, as pointed out by @innisfree there is no reason for $g(X)$ to be Uniform. Instead, $G(X)\sim\mathcal U(0,1)$, which is the very argument for using the inverse cdf as a simulation method.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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