# BCa Bootstrap One-Sample Test and CI

### Description

Obtains a confidence interval and (optionally) performs a hypothesis test for one population mean, median, proportion, standard deviation, or user-defined function such as a trimmed mean, using the BCa bootstrap method.

### Usage

1 2 3 | ```
boot.one.bca(x, parameter, null.hyp = NULL,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, type = NULL, R = 9999)
``` |

### Arguments

`x` |
a (non-empty) numeric vector of data values. |

`parameter` |
the parameter under consideration. |

`null.hyp` |
the null-hypothesis value; if omitted, no hypothesis test is performed. |

`alternative` |
a character string specifying the alternative hypothesis; must be one of "two.sided" (default), "greater", or "less". |

`conf.level` |
the confidence level (between 0 and 1); default is 0.95. |

`type` |
a character string specifying the type of CI; if user-supplied, must be one of "two-sided", "upper-bound", or "lower-bound"; defaults to "two-sided" if alternative is "two.sided", "upper-bound" if alternative is "less", and "lower-bound" if alternative is "greater". |

`R` |
the number of bootstrap replications; default is 9999. |

### Details

For a proportion, the data must consist of 1s and 0s, with 1 corresponding to a success.

### Value

A list with class "boot.one" containing the following components:

`Boot.values ` |
the point estimates for the parameter obtained from the bootstrap. |

`Confidence.limits ` |
the confidence limit(s) for the confidence interval. |

`Header ` |
the main title for the output. |

`Variable ` |
the name of the variable under consideration. |

`n ` |
the sample size. |

`Statistic ` |
the name of the statistic. |

`Observed ` |
the observed point estimate for the parameter. |

`Replications ` |
the number of bootstrap replications. |

`Mean ` |
the mean of the bootstrap values. |

`SE ` |
the standard deviation of the bootstrap values. |

`Bias ` |
the difference between the mean of the bootstrap values and the observed value. |

`Percent.bias ` |
the percentage bias: 100*|Bias/Observed|. |

`Null ` |
the null-hypothesis value or NULL. |

`Alternative ` |
the alternative hypothesis or NULL. |

`P.value ` |
the P-value or a statement like P < 0.001 or NULL. |

`p.value ` |
the P-value or NULL. |

`Level ` |
the confidence level. |

`Type ` |
the type of confidence interval. |

`Confidence.interval ` |
the confidence interval. |

### Author(s)

Neil A. Weiss

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
# Losses ($) for a sample of 25 pickpocket offenses.
data("loss")
str(loss)
# 95% (default) confidence interval for the mean loss of all pickpocket offenses.
boot.one.bca(loss, mean)
# 95% (default) lower confidence bound for the mean loss of all pickpocket
# offenses, and a right-tailed test with null hypothesis 500.
boot.one.bca(loss, mean, null.hyp = 500, alternative = "greater")
# 90% two-sided confidence interval for the mean loss of all pickpocket
# offenses, and a right-tailed test with null hypothesis 500.
boot.one.bca(loss, mean, null.hyp = 500, alternative = "greater", conf.level = 0.90,
type = "two-sided")
# 95% (default) confidence interval for the standard deviation of losses of all
# pickpocket offenses.
boot.one.bca(loss, sd)
# 95% (default) confidence interval for the 20% trimmed mean.
twen.tm <- function(x) mean(x, trim = 0.20)
boot.one.bca(loss, twen.tm)
``` |