RE: [R] cor.test p-value ties

From: Ted Harding <>
Date: Sat 10 Jul 2004 - 07:25:20 EST

On 09-Jul-04 wrote:
> I got a warning message when running the cor.test function
> using both Spearman and Kendall rank correlations saying that
> the p-value may be incorrect due to ties in the data. My data
> has 35 obs and one series has 6 pairs of ties. Does anyone
> know if this would likely have a great effect on the p-values
> calculated..
> The values look good; tau = -0.68 with p-value = 8e-9 and
> rho = =0.84 with p-value = 8e-8.

With P-values like that, probably not!

However, one can always check it by doing random tie-breaking, e.g.

  x.1 <- x + 0.001*runif(n)
  y.1 <- y + 0.001*runif(n)

and then repeating the correlation test, where n is the length of x and y. You can run a simulation loop to get the distribution of the P-value under random tie-breaking if you like.

The "0.001" could be replaced by something smaller, depending on the scale of the x and y values (e.g. if all less than 0.01 in magnitude) -- the important thing is to break the ties without allowing the perturbed values to step past adjacent values and upsetting the ordering.

Best wishes,

E-Mail: (Ted Harding) <> Fax-to-email: +44 (0)870 167 1972
Date: 09-Jul-04                                       Time: 22:25:20
------------------------------ XFMail ------------------------------

______________________________________________ mailing list PLEASE do read the posting guide! Received on Sat Jul 10 07:39:12 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:54:48 EST