LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wilcoxon sign ranked test

hi i am trying to do a program which does a wilcoxon signed ranked test . However i discover that the result from labview differs from that for matlab . Is that some possible reason ?

 

Data Used 

 

A : 5 6 3 6 7 2 5 6 8

B : 8 6 0 7 4 5 9 3 7  

 

labview p value 0.0468

matlab p value 0.9036

 

Thank you.

0 Kudos
Message 1 of 11
(2,945 Views)

Hi seanpps2,

 

don't you think we could evaluate your example much better/easier if you would attach both the VI and the m-code you used to get those rank numbers?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(2,930 Views)

Hi GerdW,

 

I have attached the file as requested . As i am unable to attach the . file the code is as follows ,

 

x = [ 5 6 3 6 7 2 5 6 8];
y = [8 6 0 7 4 5 9 3 7 ];
[p, h] = signrank(x,y,'alpha',0.05);
disp(p);
disp(h);

 

Thank you .

 

I have made a mistake regarding the p values it should be 0.9219 -> matlab , 0.7421 -> labview . 

0 Kudos
Message 3 of 11
(2,923 Views)

Hi seanpps2,

 

It does seem strange that these two pieces of software get different answers.

 

Do you know which one is the answer you expect?

 

I have submitted this issue to R&D for investigation.

0 Kudos
Message 4 of 11
(2,896 Views)

Hi Alisha, 

 

Unfortunately i do not have a standard answer for the stats. test. Do you have any idea of a posible timeline with regards to the problem as we are looking to integrate this into our product. Thank you for your assistance.

0 Kudos
Message 5 of 11
(2,887 Views)

Hi sean,

 

maybe you could provide a dataset with known results? Then a comparison of LV vs Matlab would be easier...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(2,875 Views)

Hi sean,

 

At this point, we don't have much knowledge about what is going on, whether there is anything wrong with this calculation or not so we don't have any timeline at this point. 

 

A dataset with known results would indeed be helpful.

 

0 Kudos
Message 7 of 11
(2,868 Views)

Hi , 

 

I have tested with several stats. software such as SPSS and miniTab . It seems that for the above mentioned dataset different result are obtained. That why it is rather hard to provide a sample dataset with a known value . 

 

For instance for the below dataset 

 

X : 12 13 15 19 20 21 27

Y : 18 23 24 30 32 35 40

 

BOTH labview and matlab obtained a result of 0.0156. However , this dataset is obtained from a college textbook(reliable source i believed) , Statistic for Engineer and Scientist (William Navidi) and it shows an answer of 0.0174.

 

Thank you .

0 Kudos
Message 8 of 11
(2,842 Views)

There are some serious flaws in the LV implementation.  Your last dataset is immune because the values for the differences are unique.  The serious issues with the LV version include:

 

1.  The rank of multiple ties is averaged, all zeros should be ignored.  Instead the rank of two ties are each 0.5, the rank of three ties is 2.  This error propogates through the remaining rank values.  The lowest non-tied value should have rank 1.

3.  The ranks are converted to I32 after the Rank Transformation VI, this rounds off the 0.5 values from ties and again gives erroneous results.

4.  For some reason the rank is incremented after it is converted to I32, this probably worked in some special case, but not in general.

5.  In the lookup table (for small samples like this), the index array should probably be Interpolate 1D array instead.  In cases with ties, you get a better match.

 

With these fixed I get reasonable, but not perfect agreement with Matlab (I get p=0.8945 for your first dataset).  Mathematica gives me slightly different results still, actually closer to the LV value (p=0.8854). 

0 Kudos
Message 9 of 11
(2,836 Views)

Hi Darin , 

 

Thank you for your explaination. Do you mind if you share your implementation ?

 

Regards 

0 Kudos
Message 10 of 11
(2,819 Views)