trouble in signrank function for R2011b ?

조회 수: 1 (최근 30일)
Laureline Logiaco
Laureline Logiaco 2012년 3월 30일
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 ?

채택된 답변

Tom Lane
Tom Lane 2012년 3월 30일
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개)

카테고리

Help CenterFile Exchange에서 Hypothesis Tests에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by