[R] Finding the Degrees of Freedom in a Wilcoxon Test

David Winsemius dwinsemius at comcast.net
Mon Nov 26 02:04:27 CET 2012


On Nov 25, 2012, at 2:06 PM, sm2284 wrote:

> Thank you David I think that makes sense.
>
> As a side note I have been doing some work with fish abundance in  
> aquaria. The TRUE column is the actual amount of fish in the tank,  
> so a questionable practice but a valid one??

It complicates the human interpretation of code to have reserved words  
(of which 'TRUE' is one) used as a name of an object (or an object  
element. You seen to be getting away with it because you are not  
reporting an error message, but it is deemed poor practice. If you  
have the fortunes package installed try typing:

fortunes::fortune("dog")

Usually it does cause the interpreter confusion if you only use  
function names as column names,  but I can create pathological results  
if I test for TRUE > 500 in a dataset where half of the rows should  
meet that criterion. Since TRUE becomes 1 when coerced to numeric, I  
get no rows from subset().
-- 
David.
>
> Thanks again,
> Stephen
> On 25 Nov 2012, at 20:41, David Winsemius [via R] wrote:
>
>>
>> On Nov 25, 2012, at 4:55 AM, sm2284 wrote:
>>
>>> Dear R-ers,
>>>
>>> I am currently running some Wilcoxon tests in R-64.
>>>
>>> How do I find the degrees of freedom in the output I am receiving?
>>>
>>>> wilcox.test(good$TRUE, good$x4a, paired=FALSE)
>>>
>>> Wilcoxon rank sum test with continuity correction
>>>
>>> data:  good$TRUE and good$x4a
>>> W = 2455, p-value < 2.2e-16
>>> alternative hypothesis: true location shift is not equal to 0
>>>
>> When using wilcox.test with two samples, the function passes some
>> version of the Rank-Sum statistic W to the pwilcox function followed
>> by the lengths of the two vectors. So I suppose you could say the
>> sample sizes are the "degrees of freedom". Reasoning informally I
>> would think the smaller of those lengths would be the most important
>> in determining stability of the inference.
>>
>> BTW, methinks it a very questionable practice to name a column  
>> 'TRUE'.
>>
>> -- 
>> David Winsemius, MD
>> Alameda, CA, USA
>>
>> ______________________________________________
>> [hidden email] 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.
>>
>>
>> If you reply to this email, your message will be added to the  
>> discussion below:
>> http://r.789695.n4.nabble.com/Finding-the-Degrees-of-Freedom-in-a-Wilcoxon-Test-tp4650724p4650775.html
>> To unsubscribe from Finding the Degrees of Freedom in a Wilcoxon  
>> Test, click here.
>> NAML
>
> Stephen James McKelvie
> sjmckelvie at gmail.com
>
>
>
>
>
>
>
> -----
> University of St Andrews,
> sm2284 at st-andrews.ac.uk
> --
> View this message in context: http://r.789695.n4.nabble.com/Finding-the-Degrees-of-Freedom-in-a-Wilcoxon-Test-tp4650724p4650783.html
> Sent from the R help mailing list archive at Nabble.com.
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list