Testing against a custom probability distribution What I want is some tool that will test an ordinal, discrete variable against a specific probability distribution, say the variable might take 4 values, 1, 2, 3, 4, and my expected probability distribution is that 10% will be 1, 50% will be 2, 30% will be 3 and 10% will be 4. 
What program, or application, need I use to check if an empirical dataset comes from the expected distribution, or if it deviates significantly from it? How do I do it?
 A: You can start with Pearson's chi-squared test. It is implemented in R, as a function chisq.test. Here is the example with fictitious data:
 set.seed(1)
 #Generate some discrete variable    
 y<-rpois(30,1)
 #Tabulate the values
 table(y)
y
 0  1  2  3  4 
10 12  5  2  1 
 ##Calculate the theoretical probabilities of the values  
 p<-dpois(0:3,1)
 p<-c(p,1-sum(p))     
 > p
[1] 0.36787944 0.36787944 0.18393972 0.06131324 0.01898816

 ##Do actual test. You need to supply the table and the corresponding probabilities
 chisq.test(table(y),p=p)

    Chi-squared test for given probabilities

data:  table(y) 
X-squared = 0.5693, df = 4, p-value = 0.9664

Message d'avis :
In chisq.test(table(y), p = p) :
  l'approximation du Chi-2 est peut-être incorrecte

See the p-value. If it is bigger than 0.05, your data conforms to the expected probability distribution. 
This is just an example, but it will get you started.     
A: Not a formal test, but to help you get a feel for how well your data matches a distribution you may want to look at a hanging rootogram, there are implementations of this in the vcd package and latticeextra pakages for R.
Also note that any formal test (the chi-squared is appropriate here as @mpiktas posted) can only rule out distributions, it can never prove that your data came from a given distribution, just show that there is not enough data to rule it out.
