boot.one.bca: BCa Bootstrap One-Sample Test and CI

Description Usage Arguments Details Value Author(s) Examples

View source: R/boot.one.bca.R

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)

Example output

Loading required package: boot
Loading required package: simpleboot
Simple Bootstrap Routines (1.1-3 2008-04-30)
 num [1:25] 447 207 627 430 883 313 844 253 397 214 ...


 RESULTS OF BCa BOOTSTRAP FOR MEAN 

    SUMMARY Variable  n Statistic Observed
 STATISTICS     loss 25      mean   513.32

 BOOTSTRAP Replications     Mean       SE Bias Percent.bias
   SUMMARY         9999 514.4534 51.73443 1.13         0.22

 CONFIDENCE Level      Type Confidence.interval
   INTERVAL   95% two-sided        (412.4, 616)




 RESULTS OF BCa BOOTSTRAP FOR MEAN 

    SUMMARY Variable  n Statistic Observed
 STATISTICS     loss 25      mean   513.32

 BOOTSTRAP Replications     Mean       SE   Bias Percent.bias
   SUMMARY         9999 513.3877 51.07396 0.0677       0.0132

 HYPOTHESIS Null  Alternative P.value
       TEST  500 greater-than   0.399

 CONFIDENCE Level        Type Confidence.interval
   INTERVAL   95% lower-bound         429.8 (LCB)




 RESULTS OF BCa BOOTSTRAP FOR MEAN 

    SUMMARY Variable  n Statistic Observed
 STATISTICS     loss 25      mean   513.32

 BOOTSTRAP Replications     Mean       SE   Bias Percent.bias
   SUMMARY         9999 513.1805 51.34081 -0.139       0.0271

 HYPOTHESIS Null  Alternative P.value
       TEST  500 greater-than   0.395

 CONFIDENCE Level      Type Confidence.interval
   INTERVAL   90% two-sided      (431.8, 601.4)




 RESULTS OF BCa BOOTSTRAP FOR SD 

    SUMMARY Variable  n Statistic Observed
 STATISTICS     loss 25        sd 262.2309

 BOOTSTRAP Replications     Mean       SE Bias Percent.bias
   SUMMARY         9999 255.0357 29.63744 -7.2         2.75

 CONFIDENCE Level      Type Confidence.interval
   INTERVAL   95% two-sided      (216.2, 337.3)




 RESULTS OF BCa BOOTSTRAP FOR TWEN.TM 

    SUMMARY Variable  n Statistic Observed
 STATISTICS     loss 25   twen.tm 501.1333

 BOOTSTRAP Replications     Mean       SE Bias Percent.bias
   SUMMARY         9999 504.8198 64.32178 3.69        0.736

 CONFIDENCE Level      Type Confidence.interval
   INTERVAL   95% two-sided      (376.1, 623.9)

wBoot documentation built on May 1, 2019, 7:31 p.m.