Chi squared test to test if data is from same distribution

20 views (last 30 days)
Hello,
I have recorded some discrete data with an unspecified distribution.
I have generated some discrete data from a model.
I looking to check to see if the generated data has the same distribution as the real data.
If the data was continious, I would use a Q-Q plot and a striaght line would indicate that it is true.
As the data is discrete, I need another test.
I was thinking a chi-squared test would be suitbale?
Would Matlab have such a function? I would be grateful if somebody could perhaps demonstrate an example?
kind regards

Accepted Answer

José-Luis
José-Luis on 8 Feb 2013
You could use a two-sample Kolmogorov-Smirnov test. This tests the hypothesis that the two samples come from the same distribution.
doc kstest2
  3 Comments
John
John on 8 Feb 2013
Thanks Jose, I confused the two terminology. That is what I wanted.
Cheers

Sign in to comment.

More Answers (1)

Sean de Wolski
Sean de Wolski on 8 Feb 2013
How abot anything here:
Or some of the anova tests:
doc anova1
doc anova2
doc anovan
  4 Comments
José-Luis
José-Luis on 8 Feb 2013
The KS test if for discrete data. What you assume is that the distribution they come from is continuous. That's a different thing.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!