I just discovered when working on Copulae that it was common knowledge that if $X$ is a continuous random variable with probability density function $F_{X}$, then $Y=F_{X}(x)$ follows a uniform distribution.

Before finding the proof online I was trying to empirically verify the above statement in R, but couldn't seem to succeed. Could someone please tell me what is wrong in my approach? In the code below I am plotting the histograms (empirical PDFs) of $10^3$ values sampled from the Normal CDF and of $10^3$ values sampled from the Cauchy CDF. Instead of observing uniform distributions, here is what I am getting:


enter image description here

I was not expecting perfectly uniform distributions, but $10^3$ values should be enough to at least approach something that looks uniform. So what is wrong?

  • $\begingroup$ What do you mean "sampled from the Normal and Cauchy CDFs. One set of points cannot be sampled from both. ppoints seems to be a built in function, but I don't really understand its documentation. $\endgroup$ Commented Oct 15, 2015 at 21:08
  • $\begingroup$ It was clear from my code. But anyway, I edited my question for clarity. Thanks. $\endgroup$
    – Antoine
    Commented Oct 15, 2015 at 21:09
  • 1
    $\begingroup$ R has so many built in functions that it's often not clear to me what is a variable name that someone has assigned but not provided, and what is a built in I've never heard of. $\endgroup$ Commented Oct 15, 2015 at 21:12
  • $\begingroup$ You're not generating random variables. See rnorm. $\endgroup$ Commented Oct 15, 2015 at 21:16
  • 3
    $\begingroup$ ppoints (roughly speaking) generates expected uniform quantiles, not normal (or whatever) random numbers $\endgroup$
    – Glen_b
    Commented Oct 15, 2015 at 21:17

1 Answer 1


I believe your code just does not do what you want it to do. Here's what you want:

x <- rnorm(10000)

This histogram looks uniform.

I believe

plot(ppoints(1000), pnorm(ppoints(1000)))

results in a plot of a portion of the graph of the normal cdf.

Here's a quick verification

plot((1:100 - 50)/25, pnorm((1:100 - 50)/25)) 
points(ppoints(25), pnorm(ppoints(25)), col="blue")

enter image description here

  • 3
    $\begingroup$ +1 Yep, That's the way to do it. More generally p<thing>(r<thing>(n)) will be uniform for some distribution <thing> and sample size n. $\endgroup$
    – Glen_b
    Commented Oct 15, 2015 at 21:18
  • 1
    $\begingroup$ thanks. What misled me is that in the documentation for pnorm it is said that the argument $q$ that should be passed is a vector of quantiles. $\endgroup$
    – Antoine
    Commented Oct 15, 2015 at 21:21
  • $\begingroup$ @Glen_b That looks like C++ template. $\endgroup$ Commented Oct 15, 2015 at 21:23
  • $\begingroup$ @Antoine the normal use case for pnorm is when you want to use it to get the probabilty associated with a quantile, but you're using it as a transformation. $\endgroup$
    – Glen_b
    Commented Oct 15, 2015 at 21:33

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.