MATLAB Answers

Question about Anderson-Darling (adtest)

44 views (last 30 days)
BN
BN on 31 Jul 2020
Commented: BN on 31 Jul 2020
I want to check if two data sets have similar distribution. I would like to use Anderson-darling test in order to do that, But adtest() in Matlab returns a test decision for the null hypothesis that the data in vector x is from a population with a normal distribution. My question is how to check if two data sets have similar distribution or not (without specifying the nature of that distributions).
So is it possible to do that in Matlab?
Thanks

Accepted Answer

John D'Errico
John D'Errico on 31 Jul 2020
Edited: John D'Errico on 31 Jul 2020
Not using adtest. Like the Ford Model T, which Henry Ford sold in any color as long as the color you wanted was black, adtest tests to see if your distriution is any distribution, as long as normal is the distribution you want to test against.
Instead, you probably want to use a Kolmogorov-Smirnov test.
From the help for kstest2:
kstest2 Two-sample Kolmogorov-Smirnov goodness-of-fit hypothesis test.
H = kstest2(X1,X2) performs a Kolmogorov-Smirnov (K-S) test
to determine if independent random samples, X1 and X2, are drawn from
the same underlying continuous population.
  1 Comment
BN
BN on 31 Jul 2020
Thank you, more ever than what you mentioned about the Kolmogorov Smirnov test; I found a function in FEX which do something like what you said but using Anderson darling test. But this function just prints results in the workspace and not able to save p-value. I ask how to overcome this issue in another question.
Anyways Kolmogorov Smirnov test which you mentioned is perfect too.
Thank you
Best Regards

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!