Learn R Programming

wBoot (version 1.0.3)

boot.one.per: Percentile 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 percentile bootstrap method.

Usage

boot.one.per(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
R
the number of bootstrap replications; default is 9999.

Value

  • A list with class "boot.one" containing the following components:
  • Boot.valuesthe point estimates for the parameter obtained from the bootstrap.
  • Confidence.limitsthe confidence limit(s) for the confidence interval.
  • Headerthe main title for the output.
  • Variablethe name of the variable under consideration.
  • nthe sample size.
  • Statisticthe name of the statistic.
  • Observedthe observed point estimate for the parameter.
  • Replicationsthe number of bootstrap replications.
  • Meanthe mean of the bootstrap values.
  • SEthe standard deviation of the bootstrap values.
  • Biasthe difference between the mean of the bootstrap values and the observed value.
  • Percent.biasthe percentage bias: 100*|Bias/Observed|.
  • Nullthe null-hypothesis value or NULL.
  • Alternativethe alternative hypothesis or NULL.
  • P.valuethe P-value or a statement like P < 0.001 or NULL.
  • p.valuethe P-value or NULL.
  • Levelthe confidence level.
  • Typethe type of confidence interval.
  • Confidence.intervalthe confidence interval.

Warning

This routine should be used only when bias is small and the sampling distribution is roughly symmetric, as indicated by the output of the bootstrap. Otherwise, use the BCa version.

concept

  • Bootstrap
  • Percentile bootstrap
  • One-sample inferences
  • Confidence interval
  • Hypothesis test
  • Inferences for one mean
  • Inferences for one standard deviation
  • Inferences for one proportion

Details

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

Examples

Run this code
# 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.per(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.per(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.per(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.per(loss, sd)
# See the preceeding warning!

# 95% (default) confidence interval for the 20% trimmed mean.
twen.tm <- function(x) mean(x, trim = 0.20)
boot.one.per(loss, twen.tm)

Run the code above in your browser using DataLab