Testing if two samples have the same probability distribution I have a sample of N integer values and I would like to check the null hypothesis $H_0 \equiv $ "the sample has a Poisson($\lambda$) distribution"
This is, $p_i = P\{X=i\} = e^{-\lambda} \dfrac{\lambda^{i}}{ i!}, i=0,1,...$
So I've tried two approaches, both taken from the book "Simulation" 3rd edition from Ross.
First, I would take the sample and perform the "Chi-Square" test.
The other approach I took is generating a theoretical sample of N random variables with Poisson($\lambda$) distribution and then perform what the author calls the "Two Sample Problem" where one tests the null hypothesis
$H_0 \equiv $ "the variables from the two samples are all independent and identically distributed"
using a Rank Sum Test
The problem I'm facing is that in the Chi-Square method the p-value is high enough to accept the null hypothesis but in the two sample problem it's not.
For example, let $observedSample = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1]$ the sample I wanna see if it has a Poisson($\lambda=0.495)$ distribution.
The p-value obtained with the Chi-Square test is 0.161 which is not low enough to reject the null hypothesis (The textbook says it should be rejected when it's around 0.05 or 0.01)
Now let $theoreticalSample = [1, 1, 0, 3, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0]$ be the generated sample for the two sample test.
Here I get a p-value of 6.259e-09 which would lead to reject the null hypothesis.
Is one of these two approaches "more correct" than the other? Should I be using some other method instead?
Thanks!
 A: I will simplify your question as much as possible.
Here we are mainly looking at the very few first values of the Poisson distribution, A $\chi^2$ is suitable. To avoid any side problem let's define two categories  : $A=\{0\};B=\{>0\}$. (I don't want to bother with the >5 limit in $\chi^2$). You always have exactly 20 trials: it is enough to describe the thing with the frequency of $A$ only. Theoretical value (for Poisson with $\lambda=0.495$) is 12.2.
First, let's do a simple goodness of fit. You have observed 16 vs. theoretical 12.2: p-value = 13%. Your simulated sample is 10. It lies on the other side of the confidence interval. p-value against theoretical : 43.5%  Now, if we test 16 against 10 in a two sample test (contingency table) we get p-value = 4.7%. 
Summary :


*

*Fact 1 : probability to see a difference >3.8 when theoretical is 12.2 is 13% 

*Fact 2 : probability to see a difference >2.2 when theoretical is 12.2 is 43.5% 

*Fact 3 : probability to see a distance >6 when theoretical is 13 (avg. of 16 and 10): 4.7%


The difference between 12.2 and 13 is negligible. I suppose they're equal and won't even talk about them. Finally I round the numbers for easier reading :


*

*Fact 1 : probability that difference to theoretical value > 4 : 13%

*Fact 2 : probability that difference to theoretical value > 2 : 44%

*Fact 1 + 2 : probability to see both on two samples : $0.13 \times 0.44$ = 5.7 % (independence)

*Fact 3 : probability that difference between the two samples > 6 : 4.7%


It is logical that these two probabilities are close (without questioning geometry and logics too much).
The main reason why you reject 16 vs 10 is that the generated sample is sufficiently far from the theoretical value, (and by chance opposite to your data sample), to cause a sufficient modification of the p-value, approximately equal to multiplying it by the p-value of your generated sample.

The other approach I took is generating a theoretical sample of N
  random variables with Poisson(λ) distribution and then perform what
  the author calls the "Two Sample Problem" where one tests the null
  hypothesis

To me, this is a strange method. It brings additional random for nothing.
