trouble in signrank function for R2011b ?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
When calling signrank(x) in the R2011b version, 0s values in x do not seem to be omitted anymore as in previous releases. These values should indeed be ignored when computing the signed rank statistics ( http://faculty.vassar.edu/lowry/ch12a.html ).
Let me give two examples, with and without 0s, which should theoretically give the same result if I understood well:
signrank([-5 -6 -7 -8 -4 2 -10])
ans =
0.0312
whereas
signrank([-5 -6 -7 -8 -4 2 -10 0 0 0])
ans =
0.0820
... And the result becomes different depending on whether the bias is for positive or negative values, while it should not be, because the test should be two sided: indeed:
signrank(-[-5 -6 -7 -8 -4 2 -10 0 0 0])
ans =
0.0156
Using a previous version of matlab (R2007b) as well as the statistical package R (<http://www.r-project.org/>) with the same vectors, I saw that:
1) all the p-values stay close to the p-value given by R2011b for the vector where 0s are manually removed (first example I gave)
2) the p-values they give are independent on the sign of the bias, as it should be.
Could this be a bug, or am I doing something wrong ?
0 commentaires
Réponse acceptée
Tom Lane
le 30 Mar 2012
This does look like a bug. If you are comfortable editing code in your MATLAB installation, I recommend editing signrank.m to change this
t = (abs(diffxy) < epsdiff);
to this
t = (abs(diffxy) <= epsdiff);
Alternatively you can do an explicit comparison with zero:
signrank([-5 -6 -7 -8 -4 2 -10 0 0 0],0)
Thanks for reporting this. I'll see that it gets fixed as soon as possible.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Hypothesis Tests dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!