[R] Bootstrapping kendall cor
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu May 13 14:48:22 CEST 2004
Your problem is that some bootstrap samples have no variation in x at all.
How can you expect a sensible answer from such a sample?
On Thu, 13 May 2004, Hwange Project wrote:
> I'm fighting with the following problem :
> I want to do bootstrapping on a Kendall correlation with the following code
Using package boot, uncredited!
> > cor.function <- function(data,i) cor(data[i, 1], data[i,
> 2],method="kendall")
> > boot.ci <- boot.ci(boot.cor <- boot(cbind(x,y),cor.function,
> R=1000),conf=c(0.95,0.99))
>
> However, I've got problems because I've got ties in my x variables :
> for example, it does not work with :
>
> x <-
> c(8.67,3.67,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,6.80,0.00,0.00,3.96)
> y <- c(329,264,274,339,302,334,334,312,355,327,287,319,361,355)
> cor.function <- function(data,i) cor(data[i, 1], data[i,
> 2],method="kendall")
> boot.ci <- boot.ci(boot.cor <- boot(cbind(x,y),cor.function,
> R=1000),conf=c(0.95,0.99))
>
> I would appreciate any advice, even of changing from kendall to something
> else, knowing that my x variables have a lot of ties and is far from
> normally distributed.
Given that you haven't told us your objective, we cannot help you choose
anything better.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list