Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-05 Thread JP
Thanks once again Peter, I understand your points -- I fiddled and
googled and read some more and found an eas(ier) route:

library(coin)
t <- wilcoxsign_test(a ~ b, alternative = "two.sided", distribution =
exact())  # This is equivalent to paired wilcox.test
pval <- pvalue(t)
sweet.zscore <- statistic(t) # signed and everything

# correct for multiple testing if you are doing a number of the above...

I would never have got here without your guidance - so kudos to you.
JP


On 5 May 2011 14:52, peter dalgaard  wrote:
>
> On May 5, 2011, at 10:58 , JP wrote:
>
>> On 4 May 2011 15:32, peter dalgaard  wrote:
>>
>>>
>>> On May 4, 2011, at 15:11 , JP wrote:
>>>
 Peter thanks for the fantastically simple and understandable explanation...

 To sum it up... to find the z values of a number of pairwise wilcox
 tests do the following:

 # pairwise tests with bonferroni correction
 x <- pairwise.wilcox.test(a, b, alternative="two.sided",
 p.adj="bonferroni", exact=F, paired=T)
>>>
>>>
>>> You probably don't want the bonferroni correction there. Rather 
>>> p.adj="none". You generally correct the p values for multiple testing, not 
>>> the test statistics.
>>>
>>
>> Oh, I see thanks... of course since I have 5 groups (samples) and 10
>> comparisons I still have to correct when quoting p values...
>>
>>
>>> (My sentiment would be to pick apart the stats:::wilcox.test.default 
>>> function and clone the computation of Z from it, but presumably 
>>> backtracking from the p value is a useful expedient.)
>>>
>>
>> Should this be so onerous for the user [read non-statistician] ?
>
>
> My main reservation is that if the p value gets very small or close to 1 (for 
> 1-sided tests), then it might not be possible to reconstruct the underlying Z 
> (qnorm(pnorm(Z)) breaks down around Z = -37 and Z=+8). If you get sensible 
> values, there's probably not a problem.
>
>
>>
 # what is the data structure we got back
 is.matrix(x$p.value)
 # p vals
 x$p.value
 # z.scores for each
 z.score <- qnorm(x$p.value / 2)

>>>
>>> Hmm, you're not actually getting a signed z out of this, you might want to 
>>> try alternative="greater" and drop the division by 2 inside qnorm(). (If 
>>> the signs come out inverted, I meant "less" not "greater"...)
>>>
>>
>> But I need a two sided test (changing the alternative would change the
>> hypothesis!)...  do I still do this?
>
> For the z's, yes.
>
> Hmm, the asymmetry of qnorm(pnorm(...)) indicates that you might want to be a 
> bit more careful.
>
>> All my z values are negative
>>
>> Is this correct?
>
> No, that's the problem. The sign of Z should depend on whether the signed 
> ranks are predominantly positive or negative. If you do a two-sided p-value 
> and divide by two, then by definition you get something less than .5 and 
> qnorm of that will be negative. So if the 2-sided p is 0.04, the one-sided p 
> will be either 0.02 or 0.98, depending on the alternative and on whether the 
> V statistic is above or below its expectation. Notice that this corresponds 
> to Z statistics of opposite sign:
>
>> qnorm(.02)
> [1] -2.053749
>> qnorm(.98)
> [1] 2.053749
>
> --
> Peter Dalgaard
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
>
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-05 Thread peter dalgaard

On May 5, 2011, at 10:58 , JP wrote:

> On 4 May 2011 15:32, peter dalgaard  wrote:
> 
>> 
>> On May 4, 2011, at 15:11 , JP wrote:
>> 
>>> Peter thanks for the fantastically simple and understandable explanation...
>>> 
>>> To sum it up... to find the z values of a number of pairwise wilcox
>>> tests do the following:
>>> 
>>> # pairwise tests with bonferroni correction
>>> x <- pairwise.wilcox.test(a, b, alternative="two.sided",
>>> p.adj="bonferroni", exact=F, paired=T)
>> 
>> 
>> You probably don't want the bonferroni correction there. Rather 
>> p.adj="none". You generally correct the p values for multiple testing, not 
>> the test statistics.
>> 
> 
> Oh, I see thanks... of course since I have 5 groups (samples) and 10
> comparisons I still have to correct when quoting p values...
> 
> 
>> (My sentiment would be to pick apart the stats:::wilcox.test.default 
>> function and clone the computation of Z from it, but presumably backtracking 
>> from the p value is a useful expedient.)
>> 
> 
> Should this be so onerous for the user [read non-statistician] ?


My main reservation is that if the p value gets very small or close to 1 (for 
1-sided tests), then it might not be possible to reconstruct the underlying Z 
(qnorm(pnorm(Z)) breaks down around Z = -37 and Z=+8). If you get sensible 
values, there's probably not a problem.


> 
>>> # what is the data structure we got back
>>> is.matrix(x$p.value)
>>> # p vals
>>> x$p.value
>>> # z.scores for each
>>> z.score <- qnorm(x$p.value / 2)
>>> 
>> 
>> Hmm, you're not actually getting a signed z out of this, you might want to 
>> try alternative="greater" and drop the division by 2 inside qnorm(). (If the 
>> signs come out inverted, I meant "less" not "greater"...)
>> 
> 
> But I need a two sided test (changing the alternative would change the
> hypothesis!)...  do I still do this?

For the z's, yes.

Hmm, the asymmetry of qnorm(pnorm(...)) indicates that you might want to be a 
bit more careful.

> All my z values are negative
> 
> Is this correct?

No, that's the problem. The sign of Z should depend on whether the signed ranks 
are predominantly positive or negative. If you do a two-sided p-value and 
divide by two, then by definition you get something less than .5 and qnorm of 
that will be negative. So if the 2-sided p is 0.04, the one-sided p will be 
either 0.02 or 0.98, depending on the alternative and on whether the V 
statistic is above or below its expectation. Notice that this corresponds to Z 
statistics of opposite sign:

> qnorm(.02)
[1] -2.053749
> qnorm(.98)
[1] 2.053749

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-05 Thread JP
On 4 May 2011 15:32, peter dalgaard  wrote:

>
> On May 4, 2011, at 15:11 , JP wrote:
>
>> Peter thanks for the fantastically simple and understandable explanation...
>>
>> To sum it up... to find the z values of a number of pairwise wilcox
>> tests do the following:
>>
>> # pairwise tests with bonferroni correction
>> x <- pairwise.wilcox.test(a, b, alternative="two.sided",
>> p.adj="bonferroni", exact=F, paired=T)
>
>
> You probably don't want the bonferroni correction there. Rather p.adj="none". 
> You generally correct the p values for multiple testing, not the test 
> statistics.
>

Oh, I see thanks... of course since I have 5 groups (samples) and 10
comparisons I still have to correct when quoting p values...


> (My sentiment would be to pick apart the stats:::wilcox.test.default function 
> and clone the computation of Z from it, but presumably backtracking from the 
> p value is a useful expedient.)
>

Should this be so onerous for the user [read non-statistician] ?


>> # what is the data structure we got back
>> is.matrix(x$p.value)
>> # p vals
>> x$p.value
>> # z.scores for each
>> z.score <- qnorm(x$p.value / 2)
>>
>
> Hmm, you're not actually getting a signed z out of this, you might want to 
> try alternative="greater" and drop the division by 2 inside qnorm(). (If the 
> signs come out inverted, I meant "less" not "greater"...)
>

But I need a two sided test (changing the alternative would change the
hypothesis!)...  do I still do this?
All my z values are negative

Is this correct?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-04 Thread peter dalgaard

On May 4, 2011, at 15:11 , JP wrote:

> Peter thanks for the fantastically simple and understandable explanation...
> 
> To sum it up... to find the z values of a number of pairwise wilcox
> tests do the following:
> 
> # pairwise tests with bonferroni correction
> x <- pairwise.wilcox.test(a, b, alternative="two.sided",
> p.adj="bonferroni", exact=F, paired=T)


You probably don't want the bonferroni correction there. Rather p.adj="none". 
You generally correct the p values for multiple testing, not the test 
statistics.

(My sentiment would be to pick apart the stats:::wilcox.test.default function 
and clone the computation of Z from it, but presumably backtracking from the p 
value is a useful expedient.)

> # what is the data structure we got back
> is.matrix(x$p.value)
> # p vals
> x$p.value
> # z.scores for each
> z.score <- qnorm(x$p.value / 2)
> 

Hmm, you're not actually getting a signed z out of this, you might want to try 
alternative="greater" and drop the division by 2 inside qnorm(). (If the signs 
come out inverted, I meant "less" not "greater"...)


> 
> 
> On 4 May 2011 13:25, peter dalgaard  wrote:
>> 
>> On May 4, 2011, at 11:03 , JP wrote:
>> 
>>> On 3 May 2011 20:50, peter dalgaard  wrote:
 
 On Apr 28, 2011, at 15:18 , JP wrote:
 
> 
> 
> I have found that when doing a wilcoxon signed ranked test you should 
> report:
> 
> - The median value (and not the mean or sd, presumably because of the
> underlying potential non normal distribution)
> - The Z score (or value)
> - r
> - p value
> 
 
 ...printed on 40g/m^2 acid free paper with a pencil of 3B softness?
 
 Seriously, with nonparametrics, the p value is the only thing of real 
 interest, the other stuff is just attempting to check on authors doing 
 their calculations properly. The median difference is of some interest, 
 but it is not actually what is being tested, and in heavily tied data, it 
 could even be zero with a highly significant p-value. The Z score can in 
 principle be extracted from the p value (qnorm(p/2), basically) but it's 
 obviously unstable in the extreme cases. What is r? The correlation? 
 Pearson, not Spearman?
 
>>> 
>>> Thanks for this Peter - a couple of more questions:
>>> 
>>> a <- rnorm(500)
>>> b <- runif(500, min=0, max=1)
>>> x <- wilcox.test(a, b, alternative="two.sided", exact=T, paired=T)
>>> x$statistic
>>> 
>>>V
>>> 31835
>>> 
>>> What is V? (is that the value Z of the test statistic)?
>> 
>> No. It's the sum of the positive ranks:
>> 
>>r <- rank(abs(x))
>>STATISTIC <- sum(r[x > 0])
>>names(STATISTIC) <- "V"
>> 
>> (where x is actually x-y in the paired case)
>> 
>> Subtract the expected value of V (sum(1:500)/2 == 62625) in your case, and 
>> divide by the standard deviation (sqrt(500*501*1001/24)=3232.327) and you 
>> get Z=-9.54. The slight discrepancy is likely due to your use of exact=T (so 
>> your p value is not actually computed from Z).
>> 
>> 
>>> 
>>> z.score <- qnorm(x$p.value/2)
>>> [1] -9.805352
>>> 
>>> But what does this zscore show in practice?
>> 
>> 
>> That your test statistic is approx. 10 standard deviations away from its 
>> mean, if the null hypothesis were to be true.
>> 
>> 
>>> 
>>> The d.f. are suggested to be reported here:
>>> http://staff.bath.ac.uk/pssiw/stats2/page2/page3/page3.html
>>> 
>> 
>> Some software replaces the asymptotic normal distribution of the rank sums 
>> with the t-distribution with the same df as would be used in an ordinary t 
>> test. However, since there is no such thing as an independent variance 
>> estimate in the Wilcoxon test, it is hard to see how that should be an 
>> improvement. I have it down to "coding by non-statistician".
>> 
>> 
>>> And r is mentioned here
>>> http://huberb.people.cofc.edu/Guide/Reporting_Statistics%20in%20Psychology.pdfs
>>> 
>>> 
>> 
>> Aha, so it's supposed to be the effect size. On the referenced site they 
>> suggest to use r=Z/sqrt(N). (They even do so for the independent samples 
>> version, which looks wrong to me).
>> 
>>> 
> My questions are:
> 
> - Are the above enough/correct values to report (some places even
> quote W and df) ?
 
 df is silly, and/or blatantly wrong...
 
>  What else would you suggest?
> - How do I calculate the Z score and r for the above example?
> - How do I get each statistic from the pairwise.wilcox.test call?
> 
> Many Thanks
> JP
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
 
 --
 Peter Dalgaard
 Center for Statistics, Copenhagen Business School
 Solbjerg Plads 3, 2000 Frederiksberg, Denmark
 Phone: (+45

Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-04 Thread JP
Peter thanks for the fantastically simple and understandable explanation...

To sum it up... to find the z values of a number of pairwise wilcox
tests do the following:

# pairwise tests with bonferroni correction
x <- pairwise.wilcox.test(a, b, alternative="two.sided",
p.adj="bonferroni", exact=F, paired=T)
# what is the data structure we got back
is.matrix(x$p.value)
# p vals
x$p.value
# z.scores for each
z.score <- qnorm(x$p.value / 2)



On 4 May 2011 13:25, peter dalgaard  wrote:
>
> On May 4, 2011, at 11:03 , JP wrote:
>
>> On 3 May 2011 20:50, peter dalgaard  wrote:
>>>
>>> On Apr 28, 2011, at 15:18 , JP wrote:
>>>


 I have found that when doing a wilcoxon signed ranked test you should 
 report:

 - The median value (and not the mean or sd, presumably because of the
 underlying potential non normal distribution)
 - The Z score (or value)
 - r
 - p value

>>>
>>> ...printed on 40g/m^2 acid free paper with a pencil of 3B softness?
>>>
>>> Seriously, with nonparametrics, the p value is the only thing of real 
>>> interest, the other stuff is just attempting to check on authors doing 
>>> their calculations properly. The median difference is of some interest, but 
>>> it is not actually what is being tested, and in heavily tied data, it could 
>>> even be zero with a highly significant p-value. The Z score can in 
>>> principle be extracted from the p value (qnorm(p/2), basically) but it's 
>>> obviously unstable in the extreme cases. What is r? The correlation? 
>>> Pearson, not Spearman?
>>>
>>
>> Thanks for this Peter - a couple of more questions:
>>
>> a <- rnorm(500)
>> b <- runif(500, min=0, max=1)
>> x <- wilcox.test(a, b, alternative="two.sided", exact=T, paired=T)
>> x$statistic
>>
>>    V
>> 31835
>>
>> What is V? (is that the value Z of the test statistic)?
>
> No. It's the sum of the positive ranks:
>
>        r <- rank(abs(x))
>        STATISTIC <- sum(r[x > 0])
>        names(STATISTIC) <- "V"
>
> (where x is actually x-y in the paired case)
>
> Subtract the expected value of V (sum(1:500)/2 == 62625) in your case, and 
> divide by the standard deviation (sqrt(500*501*1001/24)=3232.327) and you get 
> Z=-9.54. The slight discrepancy is likely due to your use of exact=T (so your 
> p value is not actually computed from Z).
>
>
>>
>> z.score <- qnorm(x$p.value/2)
>> [1] -9.805352
>>
>> But what does this zscore show in practice?
>
>
> That your test statistic is approx. 10 standard deviations away from its 
> mean, if the null hypothesis were to be true.
>
>
>>
>> The d.f. are suggested to be reported here:
>> http://staff.bath.ac.uk/pssiw/stats2/page2/page3/page3.html
>>
>
> Some software replaces the asymptotic normal distribution of the rank sums 
> with the t-distribution with the same df as would be used in an ordinary t 
> test. However, since there is no such thing as an independent variance 
> estimate in the Wilcoxon test, it is hard to see how that should be an 
> improvement. I have it down to "coding by non-statistician".
>
>
>> And r is mentioned here
>> http://huberb.people.cofc.edu/Guide/Reporting_Statistics%20in%20Psychology.pdfs
>>
>>
>
> Aha, so it's supposed to be the effect size. On the referenced site they 
> suggest to use r=Z/sqrt(N). (They even do so for the independent samples 
> version, which looks wrong to me).
>
>>
 My questions are:

 - Are the above enough/correct values to report (some places even
 quote W and df) ?
>>>
>>> df is silly, and/or blatantly wrong...
>>>
  What else would you suggest?
 - How do I calculate the Z score and r for the above example?
 - How do I get each statistic from the pairwise.wilcox.test call?

 Many Thanks
 JP

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
>>>
>>> --
>>> Peter Dalgaard
>>> Center for Statistics, Copenhagen Business School
>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>>> Phone: (+45)38153501
>>> Email: pd@cbs.dk  Priv: pda...@gmail.com
>>>
>>>
>
> --
> Peter Dalgaard
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
>
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-04 Thread peter dalgaard

On May 4, 2011, at 11:03 , JP wrote:

> On 3 May 2011 20:50, peter dalgaard  wrote:
>> 
>> On Apr 28, 2011, at 15:18 , JP wrote:
>> 
>>> 
>>> 
>>> I have found that when doing a wilcoxon signed ranked test you should 
>>> report:
>>> 
>>> - The median value (and not the mean or sd, presumably because of the
>>> underlying potential non normal distribution)
>>> - The Z score (or value)
>>> - r
>>> - p value
>>> 
>> 
>> ...printed on 40g/m^2 acid free paper with a pencil of 3B softness?
>> 
>> Seriously, with nonparametrics, the p value is the only thing of real 
>> interest, the other stuff is just attempting to check on authors doing their 
>> calculations properly. The median difference is of some interest, but it is 
>> not actually what is being tested, and in heavily tied data, it could even 
>> be zero with a highly significant p-value. The Z score can in principle be 
>> extracted from the p value (qnorm(p/2), basically) but it's obviously 
>> unstable in the extreme cases. What is r? The correlation? Pearson, not 
>> Spearman?
>> 
> 
> Thanks for this Peter - a couple of more questions:
> 
> a <- rnorm(500)
> b <- runif(500, min=0, max=1)
> x <- wilcox.test(a, b, alternative="two.sided", exact=T, paired=T)
> x$statistic
> 
>V
> 31835
> 
> What is V? (is that the value Z of the test statistic)?

No. It's the sum of the positive ranks:

r <- rank(abs(x))
STATISTIC <- sum(r[x > 0])
names(STATISTIC) <- "V"
 
(where x is actually x-y in the paired case)

Subtract the expected value of V (sum(1:500)/2 == 62625) in your case, and 
divide by the standard deviation (sqrt(500*501*1001/24)=3232.327) and you get 
Z=-9.54. The slight discrepancy is likely due to your use of exact=T (so your p 
value is not actually computed from Z).


> 
> z.score <- qnorm(x$p.value/2)
> [1] -9.805352
> 
> But what does this zscore show in practice?


That your test statistic is approx. 10 standard deviations away from its mean, 
if the null hypothesis were to be true.


> 
> The d.f. are suggested to be reported here:
> http://staff.bath.ac.uk/pssiw/stats2/page2/page3/page3.html
> 

Some software replaces the asymptotic normal distribution of the rank sums with 
the t-distribution with the same df as would be used in an ordinary t test. 
However, since there is no such thing as an independent variance estimate in 
the Wilcoxon test, it is hard to see how that should be an improvement. I have 
it down to "coding by non-statistician".


> And r is mentioned here
> http://huberb.people.cofc.edu/Guide/Reporting_Statistics%20in%20Psychology.pdfs
> 
> 

Aha, so it's supposed to be the effect size. On the referenced site they 
suggest to use r=Z/sqrt(N). (They even do so for the independent samples 
version, which looks wrong to me). 

> 
>>> My questions are:
>>> 
>>> - Are the above enough/correct values to report (some places even
>>> quote W and df) ?
>> 
>> df is silly, and/or blatantly wrong...
>> 
>>>  What else would you suggest?
>>> - How do I calculate the Z score and r for the above example?
>>> - How do I get each statistic from the pairwise.wilcox.test call?
>>> 
>>> Many Thanks
>>> JP
>>> 
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> --
>> Peter Dalgaard
>> Center for Statistics, Copenhagen Business School
>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>> Phone: (+45)38153501
>> Email: pd@cbs.dk  Priv: pda...@gmail.com
>> 
>> 

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-04 Thread JP
On 3 May 2011 20:50, peter dalgaard  wrote:
>
> On Apr 28, 2011, at 15:18 , JP wrote:
>
>>
>>
>> I have found that when doing a wilcoxon signed ranked test you should report:
>>
>> - The median value (and not the mean or sd, presumably because of the
>> underlying potential non normal distribution)
>> - The Z score (or value)
>> - r
>> - p value
>>
>
> ...printed on 40g/m^2 acid free paper with a pencil of 3B softness?
>
> Seriously, with nonparametrics, the p value is the only thing of real 
> interest, the other stuff is just attempting to check on authors doing their 
> calculations properly. The median difference is of some interest, but it is 
> not actually what is being tested, and in heavily tied data, it could even be 
> zero with a highly significant p-value. The Z score can in principle be 
> extracted from the p value (qnorm(p/2), basically) but it's obviously 
> unstable in the extreme cases. What is r? The correlation? Pearson, not 
> Spearman?
>

Thanks for this Peter - a couple of more questions:

a <- rnorm(500)
b <- runif(500, min=0, max=1)
x <- wilcox.test(a, b, alternative="two.sided", exact=T, paired=T)
x$statistic

V
31835

What is V? (is that the value Z of the test statistic)?

z.score <- qnorm(x$p.value/2)
[1] -9.805352

But what does this zscore show in practice?

The d.f. are suggested to be reported here:
http://staff.bath.ac.uk/pssiw/stats2/page2/page3/page3.html

And r is mentioned here
http://huberb.people.cofc.edu/Guide/Reporting_Statistics%20in%20Psychology.pdfs



>> My questions are:
>>
>> - Are the above enough/correct values to report (some places even
>> quote W and df) ?
>
> df is silly, and/or blatantly wrong...
>
>>  What else would you suggest?
>> - How do I calculate the Z score and r for the above example?
>> - How do I get each statistic from the pairwise.wilcox.test call?
>>
>> Many Thanks
>> JP
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> --
> Peter Dalgaard
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-03 Thread peter dalgaard

On Apr 28, 2011, at 15:18 , JP wrote:

> 
> 
> I have found that when doing a wilcoxon signed ranked test you should report:
> 
> - The median value (and not the mean or sd, presumably because of the
> underlying potential non normal distribution)
> - The Z score (or value)
> - r
> - p value
> 

...printed on 40g/m^2 acid free paper with a pencil of 3B softness?

Seriously, with nonparametrics, the p value is the only thing of real interest, 
the other stuff is just attempting to check on authors doing their calculations 
properly. The median difference is of some interest, but it is not actually 
what is being tested, and in heavily tied data, it could even be zero with a 
highly significant p-value. The Z score can in principle be extracted from the 
p value (qnorm(p/2), basically) but it's obviously unstable in the extreme 
cases. What is r? The correlation? Pearson, not Spearman?

> My questions are:
> 
> - Are the above enough/correct values to report (some places even
> quote W and df) ?

df is silly, and/or blatantly wrong... 

>  What else would you suggest?
> - How do I calculate the Z score and r for the above example?
> - How do I get each statistic from the pairwise.wilcox.test call?
> 
> Many Thanks
> JP
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-03 Thread Uwe Ligges



On 03.05.2011 10:33, JP wrote:

Thanks Uwe,

How do I calculate the Z score and r value - please (once I have the p values)?


Actually you calculate the p value from the statistics rathger than vice 
versa. And pairwise.wilcox.test uses wilcox.test to calculate the 
separate tests and adjusts the p values for multiple testing later on.
That's why I said you can manually run wilcox.test to get the separate 
statistics.


Uwe Ligges




Many Thanks
JP



2011/5/2 Uwe Ligges:

To get the statsitics, you will have to run each wilcox.test  manually. the
pairwise... version just extracts the p-values and adjusts them.

Uwe Ligges


On 28.04.2011 15:18, JP wrote:


Hi there,

I am trying to do multiple pairwise Wilcoxon signed rank tests in a
manner similar to:

a<- c(runif(1000, min=1,max=50), rnorm(1000, 50), rnorm(1000, 49.9,
0.5), rgeom(1000, 0.5))
b<- c(rep("group_a", 1000), rep("group_b", 1000), rep("group_c",
1000), rep("group_d", 1000))
pairwise.wilcox.test(a, b, alternative="two.sided",
p.adj="bonferroni", exact=F, paired=T)

This gives me the following output:

 group_a group_b group_c
group_b<2e-16  -   -
group_c<2e-16  0.25-
group_d<2e-16<2e-16<2e-16

(which is kind of expected since group_b and group_c have similar
distributions)

I have found that when doing a wilcoxon signed ranked test you should
report:

- The median value (and not the mean or sd, presumably because of the
underlying potential non normal distribution)
- The Z score (or value)
- r
- p value

My questions are:

- Are the above enough/correct values to report (some places even
quote W and df) ?  What else would you suggest?
- How do I calculate the Z score and r for the above example?
- How do I get each statistic from the pairwise.wilcox.test call?

Many Thanks
JP

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-03 Thread JP
Thanks Uwe,

How do I calculate the Z score and r value - please (once I have the p values)?

Many Thanks
JP



2011/5/2 Uwe Ligges :
> To get the statsitics, you will have to run each wilcox.test  manually. the
> pairwise... version just extracts the p-values and adjusts them.
>
> Uwe Ligges
>
>
> On 28.04.2011 15:18, JP wrote:
>>
>> Hi there,
>>
>> I am trying to do multiple pairwise Wilcoxon signed rank tests in a
>> manner similar to:
>>
>> a<- c(runif(1000, min=1,max=50), rnorm(1000, 50), rnorm(1000, 49.9,
>> 0.5), rgeom(1000, 0.5))
>> b<- c(rep("group_a", 1000), rep("group_b", 1000), rep("group_c",
>> 1000), rep("group_d", 1000))
>> pairwise.wilcox.test(a, b, alternative="two.sided",
>> p.adj="bonferroni", exact=F, paired=T)
>>
>> This gives me the following output:
>>
>>         group_a group_b group_c
>> group_b<2e-16  -       -
>> group_c<2e-16  0.25    -
>> group_d<2e-16<2e-16<2e-16
>>
>> (which is kind of expected since group_b and group_c have similar
>> distributions)
>>
>> I have found that when doing a wilcoxon signed ranked test you should
>> report:
>>
>> - The median value (and not the mean or sd, presumably because of the
>> underlying potential non normal distribution)
>> - The Z score (or value)
>> - r
>> - p value
>>
>> My questions are:
>>
>> - Are the above enough/correct values to report (some places even
>> quote W and df) ?  What else would you suggest?
>> - How do I calculate the Z score and r for the above example?
>> - How do I get each statistic from the pairwise.wilcox.test call?
>>
>> Many Thanks
>> JP
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-05-02 Thread Uwe Ligges
To get the statsitics, you will have to run each wilcox.test  manually. 
the pairwise... version just extracts the p-values and adjusts them.


Uwe Ligges


On 28.04.2011 15:18, JP wrote:

Hi there,

I am trying to do multiple pairwise Wilcoxon signed rank tests in a
manner similar to:

a<- c(runif(1000, min=1,max=50), rnorm(1000, 50), rnorm(1000, 49.9,
0.5), rgeom(1000, 0.5))
b<- c(rep("group_a", 1000), rep("group_b", 1000), rep("group_c",
1000), rep("group_d", 1000))
pairwise.wilcox.test(a, b, alternative="two.sided",
p.adj="bonferroni", exact=F, paired=T)

This gives me the following output:

 group_a group_b group_c
group_b<2e-16  -   -
group_c<2e-16  0.25-
group_d<2e-16<2e-16<2e-16

(which is kind of expected since group_b and group_c have similar distributions)

I have found that when doing a wilcoxon signed ranked test you should report:

- The median value (and not the mean or sd, presumably because of the
underlying potential non normal distribution)
- The Z score (or value)
- r
- p value

My questions are:

- Are the above enough/correct values to report (some places even
quote W and df) ?  What else would you suggest?
- How do I calculate the Z score and r for the above example?
- How do I get each statistic from the pairwise.wilcox.test call?

Many Thanks
JP

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test

2011-04-28 Thread JP
Hi there,

I am trying to do multiple pairwise Wilcoxon signed rank tests in a
manner similar to:

a <- c(runif(1000, min=1,max=50), rnorm(1000, 50), rnorm(1000, 49.9,
0.5), rgeom(1000, 0.5))
b <- c(rep("group_a", 1000), rep("group_b", 1000), rep("group_c",
1000), rep("group_d", 1000))
pairwise.wilcox.test(a, b, alternative="two.sided",
p.adj="bonferroni", exact=F, paired=T)

This gives me the following output:

group_a group_b group_c
group_b <2e-16  -   -
group_c <2e-16  0.25-
group_d <2e-16  <2e-16  <2e-16

(which is kind of expected since group_b and group_c have similar distributions)

I have found that when doing a wilcoxon signed ranked test you should report:

- The median value (and not the mean or sd, presumably because of the
underlying potential non normal distribution)
- The Z score (or value)
- r
- p value

My questions are:

- Are the above enough/correct values to report (some places even
quote W and df) ?  What else would you suggest?
- How do I calculate the Z score and r for the above example?
- How do I get each statistic from the pairwise.wilcox.test call?

Many Thanks
JP

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.