How to calculate the Anderson Darling Test ?

9 visualizaciones (últimos 30 días)
Amr Hashem
Amr Hashem el 11 de Nov. de 2015
Comentada: Amr Hashem el 17 de Nov. de 2015
I want to test the goodness of fit of the model , so I use A-D test
I am using matlab 2012a
I got the function from an exchange file.
I try:
paramEsts = gevfit(data); %estimate parameter data 453*1 double
xgrid = linspace(-40,70,453);
pdfEst = gevcdf(xgrid,paramEsts(1),paramEsts(2),paramEsts(3));
xnew=[data pdfEst'] % 453*2 double
[AD]=AnDarksamtest(xnew,0.05);
but i got an Error:
There must have at least two samples.
and sometimes
one or more samples have no observations.
How I can solve this problem, and calculate the p-value of A-D test?

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Nov. de 2015
"There must have at least two samples." would imply that your xnew does not have at least two rows in those cases.
For "one or more samples have no observations.": the second column of the input is expected to be the group number, which is expected to be a positive integer 1 through the number of groups. If there are any integers in the range 1 to floor(max(xnew(:,2)) which are not present in xnew(:,2) then you would receive this message.
The column 2 data that you are passing is the cdf you have calculated, which would seldom happen to be a positive integer. Neither of your columns appear to be grouping numbers.
Notice the description in the source comments:
% The Anderson-Darling k-sample test was introduced by Scholz and Stephens
% (1987) as a generalization of the two-sample Anderson-Darling test. It is
% a nonparametric statistical procedure, i.e., a rank test, and, thus,
% requires no assumptions other than that the samples are true independent
% random samples from their respective continuous populations (although
% provisions for tied observations are made). It tests the hypothesis that
% the populations from which two or more independent samples of data were
% drawn are identical.
This requires an input that tells it which population each sample is drawn from. The program uses column 2 of the data to hold that information.
Possibly you need a different test.
  6 comentarios
Walter Roberson
Walter Roberson el 13 de Nov. de 2015
Looking back over the way you set up the problem, I see that the difficulty is that you want the original Anderson Darling Test, but that the routine you are calling upon is the Anderson Darling K-sample Test. The original Anderson Darling test has been supported in MATLAB since R2013a
There are Anderson Darling tests in the File Exchange, but unfortunately they are limited to Normal distributon, Weibel distribution, or Exponential distribution.
Sorry, I think you are either going to need to upgrade to at least R2013a, or else find the appropriate code somewhere outside of Mathwork's site. (I just checked, the Octave version does not support Extreme Value.)
Amr Hashem
Amr Hashem el 17 de Nov. de 2015
Thanks

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Hypothesis Tests en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by