[R] in cor.test, difference between exact=FALSE and exact=NULL

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat Sep 1 16:03:14 CEST 2007


Andrew Yee wrote:
> Thanks for the clarification.  I should have recognized the difference
> between "warning" and "error."
> But if I may take this a step further, shouldn't it then be exact=TRUE
> instead of exact=NULL?
> Thanks,
> Andrew
>   

Nope. The two are equivalent for the Spearman test, but not for 
Kendall's tau.  The login in that case is that NULL implies exact 
testing if n < 50 and asymptotic otherwise. TRUE and FALSE enforces one 
or the other (if possible).
> On 8/31/07, Peter Dalgaard <P.Dalgaard at biostat.ku.dk> wrote:
>   
>> Andrew Yee wrote:
>>     
>>> Pardon my ignorance, but is there a difference in cor.test between
>>> exact=FALSE and exact=NULL when method=spearman?
>>>
>>> Take for example:
>>>
>>> x<-c(1,2,2,3,4,5)
>>> y<-c(1,2,2,10,11,12)
>>> cor.test(x,y, method="spearman", exact=NULL)
>>>
>>> This gives an error message,
>>> Warning message:  Cannot compute exact p-values with ties in:
>>> cor.test.default(x, y, method = "spearman", exact = NULL)
>>>
>>> However, when exact is changed to FALSE, this seems to run okay.
>>>
>>> cor.test(x,y, method="spearman", exact=FALSE)
>>>
>>> Question:  should this be exact = FALSE in the documentation and/or the
>>>       
>> code?
>>     
>>>       
>> No. The default is indeed NULL.
>>
>> This implies that calculation of exact p-values will be attempted, and
>> when there are ties you get a warning (NB: not error) message.  Setting
>> exact=FALSE, no attempt is made and no warning is given.
>>     
>>> Thanks,
>>> Andrew
>>> MGH Cancer Center
>>>
>>> ______________________________________________
>>> R-help at stat.math.ethz.ch 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.
>>>
>>>       
>>
>> --
>>    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>> (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45)
>> 35327918
>> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45)
>> 35327907
>>
>>
>>
>>     
>
> 	[[alternative HTML version deleted]]
>
>   
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>   


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list