trouble in signrank function for R2011b ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Tom Lane
am 30 Mär. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Hypothesis Tests finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!