[R] Bootstrapping with Kendall's tau---Wild bootstrap
David Parkhurst
parkhurs at imap.iu.edu
Fri Mar 7 16:54:59 CET 2014
Thank you for the suggestion. Is there a function for doing that in R?
David
On 3/7/2014 9:50 AM, Therneau, Terry M., Ph.D. wrote:
> With respect to question 2, I use the wild bootstrap for tau.
>
> Wu, C.F.J. (1986). Jackknife, bootstrap and other
> resampling methods in regression analysis (with discussions).
> Annals of Statistics, 14, 1261-1350.
>
> -- begin included message ----------
>
>
> I want to bootstrap Kendall's tau correlation with data that have many
> NAs. I tried this example:
>
> x <- 1:15
> y <- c(2,4,1,3,5, 7,6, 9,10,8, 14, 13, 11, 15, 12)
> x[3] <- NA; x[11] <- NA; x[8] <- NA
> y[2] <- NA; y[8] <- NA; y[12] <- NA
> cor(x,y,use="complete.obs",method="kendall")
> library(boot)
> tmpdf <- data.frame(x,y)
> corboot <- boot(tmpdf, cor(x,y,use="complete.obs",method="kendall"), R=999)
>
> When I run that, I get this error:
> Error in boot(tmpdf, cor(x, y, use = "complete.obs", method =
> "kendall"), :
> could not find function "statistic"
>
> So my first question is, how do I tell boot that I want to use cor with
> those options to produce the statistic to be bootstrapped?
>
> A second question is this. My real data have lots of ties, in both the
> x and y variables, so I want to jitter the data before calculating tau.
> Is there a way to jitter x and y at each of the bootstrap calls, as I
> would do for the call with the original data. How would I specify that
> action?
>
More information about the R-help
mailing list