[R] Wilcoxon signed rank test and its requirements
Joris Meys
jorismeys at gmail.com
Thu Jun 24 13:13:19 CEST 2010
One way of looking at it is doing a sign test after substraction of
the mean. For symmetrical data sets, E[X-mean(X)] = 0, so you expect
to have about as many values above as below zero. There is a sign test
somewhere in one of the packages, but it's easily done using the
binom.test as well :
> set.seed(12345)
> x1 <- rnorm(100)
> x2 <- rpois(100,2)
> binom.test((sum(x1-mean(x1)>0)),length(x1))
Exact binomial test
data: (sum(x1 - mean(x1) > 0)) and length(x1)
number of successes = 56, number of trials = 100, p-value = 0.2713
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
0.4571875 0.6591640
sample estimates:
probability of success
0.56
> binom.test((sum(x2-mean(x2)>0)),length(x2))
Exact binomial test
data: (sum(x2 - mean(x2) > 0)) and length(x2)
number of successes = 37, number of trials = 100, p-value = 0.01203
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
0.2755666 0.4723516
sample estimates:
probability of success
0.37
Cheers
Joris
On Thu, Jun 24, 2010 at 4:16 AM, Atte Tenkanen <attenka at utu.fi> wrote:
> PS.
>
> Mayby I can somehow try to transform data and check it, for example, using the skewness-function of timeDate-package?
>
>> Thanks. What I have had to ask is that
>>
>> how do you test that the data is symmetric enough?
>> If it is not, is it ok to use some data transformation?
>>
>> when it is said:
>>
>> "The Wilcoxon signed rank test does not assume that the data are
>> sampled from a Gaussian distribution. However it does assume that the
>> data are distributed symmetrically around the median. If the
>> distribution is asymmetrical, the P value will not tell you much about
>> whether the median is different than the hypothetical value."
>>
>> > On Wed, Jun 23, 2010 at 10:27 PM, Atte Tenkanen <attenka at utu.fi> wrote:
>> > > Hi all,
>> > >
>> > > I have a distribution, and take a sample of it. Then I compare
>> that
>> > sample with the mean of the population like here in "Wilcoxon signed
>>
>> > rank test with continuity correction":
>> > >
>> > >> wilcox.test(Sample,mu=mean(All), alt="two.sided")
>> > >
>> > > Wilcoxon signed rank test with continuity correction
>> > >
>> > > data: AlphaNoteOnsetDists
>> > > V = 63855, p-value = 0.0002093
>> > > alternative hypothesis: true location is not equal to 0.4115136
>> > >
>> > >> wilcox.test(Sample,mu=mean(All), alt = "greater")
>> > >
>> > > Wilcoxon signed rank test with continuity correction
>> > >
>> > > data: AlphaNoteOnsetDists
>> > > V = 63855, p-value = 0.0001047
>> > > alternative hypothesis: true location is greater than 0.4115136
>> > >
>> > > What assumptions are needed for the population?
>> >
>> > wikipedia says:
>> > "The Wilcoxon signed-rank test is a _non-parametric_ statistical
>> > hypothesis test for... "
>> > it also talks about the assumptions.
>> >
>> > > What can we say according these results?
>> > > p-value for the "less" is 0.999.
>> >
>> > That the p-value for less and greater seem to sum up to one, and that
>> > the p-value of greater is half of that for two-sided. You shouldn't
>> > ask what we can say. You should ask yourself "What was the question
>> > and is this test giving me an answer on that question?"
>> >
>> > Cheers
>> > Joris
>> >
>> > --
>> > Joris Meys
>> > Statistical consultant
>> >
>> > Ghent University
>> > Faculty of Bioscience Engineering
>> > Department of Applied mathematics, biometrics and process control
>> >
>> > tel : +32 9 264 59 87
>> > Joris.Meys at Ugent.be
>> > -------------------------------
>> > Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
>
--
Joris Meys
Statistical consultant
Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control
tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
More information about the R-help
mailing list