forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 2:24 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Wilcoxon test p-value different from R, help me!
PostPosted: Wed Jun 29, 2011 3:59 am 
Offline

Joined: Wed Jun 29, 2011 3:22 am
Posts: 2
Hello everyone,

I'm trying to use the wilcoxonsignedranktest in C++ but no success. In fact, it works but show incorrect values. Take a look in my test code:

Code:
double mean;
double variance;
double skewness;
double kurtosis;
double both, left, right;
real_1d_array x = "[1,2,3,4,5,6,7,8,9,10]";
samplemoments(x, mean, variance, skewness, kurtosis); //mean = 5.50
wilcoxonsignedranktest(x, 10, mean, both, left, right);


The both returns 0.999952818327035 for me.

I did the same in R and get:
Code:
> wilcox.test(1:10)

        Wilcoxon signed rank test

data:  1:10
V = 55, p-value = 0.001953
alternative hypothesis: true location is not equal to 0


Then 0.999952818327035 is different from 0.001953

Do you know where is the problem???

Thanks!


Top
 Profile  
 
 Post subject: Re: Wilcoxon test p-value different from R, help me!
PostPosted: Wed Jun 29, 2011 4:49 am 
Offline

Joined: Sun May 16, 2010 11:42 pm
Posts: 63
For the Alglib function you had an assumed median of 5.5, but for R it was 55.

With an assumed mean of 55 Alglib returns 0.001954047 for "both tails".

_________________
Doug Jenkins
http://newtonexcelbach.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Wilcoxon test p-value different from R, help me!
PostPosted: Wed Jun 29, 2011 2:23 pm 
Offline

Joined: Wed Jun 29, 2011 3:22 am
Posts: 2
Hi Doug,

It works perfectly now. I need to use mean = 0 in my case:
Code:
wilcoxonsignedranktest(x, 10, 0, both, left, right);


Thank you very much!

Daniel


Top
 Profile  
 
 Post subject: Re: Wilcoxon test p-value different from R, help me!
PostPosted: Wed Jun 29, 2011 11:30 pm 
Offline

Joined: Sun May 16, 2010 11:42 pm
Posts: 63
Daniel - you might find the spreadsheet at the link below useful:

http://newtonexcelbach.wordpress.com/20 ... functions/

It has all the Alglib statistics functions from the VBA package implemented as Excel user defined functions. Note that the VBA version is still 2.6, so there may be differences and new functionality in the latest C++ version. Certainly the listed Alglib program modules are not applicable to the current version.

_________________
Doug Jenkins
http://newtonexcelbach.wordpress.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 36 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group