I have generated a vector which has a Poisson distribution, as follows:
x = rpois(1000,10)
If I make a histogram using hist(x)
, the distribution looks like a the familiar bell-shaped normal distribution. However, a the Kolmogorov-Smirnoff test using ks.test(x, 'pnorm',10,3)
says the distribution is significantly different to a normal distribution, due to very small p
value.
So my question is: how does the Poisson distribution differ from a normal distribution, when the histogram looks so similar to a normal distribution?
Best Answer
A Poisson distribution is discrete while a normal distribution is continuous, and a Poisson random variable is always >= 0. Thus, a Kolgomorov-Smirnov test will often be able to tell the difference.
When the mean of a Poisson distribution is large, it becomes similar to a normal distribution. However,
rpois(1000, 10)
doesn't even look that similar to a normal distribution (it stops short at 0 and the right tail is too long).Why are you comparing it to
ks.test(..., 'pnorm', 10, 3)
rather thanks.test(..., 'pnorm', 10, sqrt(10))
? The difference between 3 and $\sqrt{10}$ is small but will itself make a difference when comparing distributions. Even if the distribution truly were normal you would end up with an anti-conservative p-value distribution: