[R] Warning in ansari.test

Oscar Rueda Oscar.Rueda at cancer.org.uk
Wed Jul 20 11:51:49 CEST 2011


Dear list, 

When I try to run the Ansari-Bradley test on two long vectors I obtain a
warning and the p-value is NA:

> set.seed(12)
> x <- rnorm(100000)
> y <- rnorm(100000)
> ansari.test(x,y)

        Ansari-Bradley test

data:  x and y 
AB = 5002890779, p-value = NA
alternative hypothesis: true ratio of scales is not equal to 1

Warning message:
In m * n : NAs produced by integer overflow

This operation occurs inside a function named normalize():

normalize <- function(s, r, TIES, m = length(x), n = length(y)) {

....

}

If I add these two lines to the beginning of the function:

m <- as.double(m)
n <- as.double(n)

Then I obtain the following:

> Myansari.test(x,y)

        Ansari-Bradley test

data:  x and y 
AB = 5002890779, p-value = 0.6599
alternative hypothesis: true ratio of scales is not equal to 1

Is this a proper fix for the problem?

PS: I'm running 2.13.1

Cheers, 
Oscar


Oscar M. Rueda, PhD.
Postdoctoral Research Fellow, Breast Cancer Functional Genomics.
Cancer Research UK Cambridge Research Institute.
Li Ka Shing Centre, Robinson Way.
Cambridge CB2 0RE 
England 




NOTICE AND DISCLAIMER
This e-mail (including any attachments) is intended for ...{{dropped:16}}



More information about the R-help mailing list