Search code examples
rsimulationresampling

quantile function in R in a resampling form for Bootstrap


I am currently reading Efron's book "An introduction to the Bootstrap" and I am focusing in the ABC confidence intervals section on chapter 14.Trying to implement this method I found that there exists a function in R from bootstrap package that implements it.

The following data are from the book page 180.

A = c(48,36,20,29,42,42,20,42,22,41,45,14,6,0,33,28,34,4,32,24,47,41,24,26,30,41)

The mean of the data is :

mean(A)
[1] 29.65385

Now the bootstrap package abcnon function web page is this that has a toy example.

Both the book and the help of the function say that the theta function must be written in a resampling form.

For example the sum is written as :

theta <- function(p,x) {sum(p*x)/sum(p)}

Which if I find the 0.5 quantile is true:

results <- bootstrap::abcnon(A, theta,alpha=0.5)  
results$limits
     alpha      abc     stan
[1,]   0.5 29.60023 29.65385

Now let's say that instead of the mean I want theta to be the quantile function.How can I write it in this resampling form ?


Solution

  • The ABC method is not applicable to quantiles. The second paragraph of Section 14.4 The ABC method explains:

    The ABC method (...) requires that the statistic theta_hat = s(x) is defined smoothly in x. An example of an unsmooth statistic is the sample median.

    The median is the 50% quantile. Quantiles are not smooth functions.