one.boot: One sample bootstrap of a univariate statistic.

Description Usage Arguments Value Author(s) Examples

Description

one.boot is used for bootstrapping a univariate statistic for one sample problems. Examples include the mean, median, etc.

Usage

1
one.boot(data, FUN, R, student = FALSE, M, weights = NULL, ...)

Arguments

data

The data. This should be a vector of numbers.

FUN

The statistic to be bootstrapped. This can be either a quoted string containing the name of a function or simply the function name.

R

The number of bootstrap replicates to use.

student

Should we do a studentized bootstrap? This requires a double bootstrap so it might take longer.

M

If student is set to TRUE, then M is the number of internal bootstrap replications to do.

weights

Resampling weights; a vector of length equal to the number of observations.

...

Other (named) arguments that should be passed to FUN.

Value

An object of class "simpleboot", which is almost identical to the regular "boot" object. For example, the boot.ci function can be used on this object.

Author(s)

Roger D. Peng

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(boot)
set.seed(20)
x <- rgamma(100, 1)
b.mean <- one.boot(x, mean, 1000)
print(b.mean)
boot.ci(b.mean)  ## No studentized interval here
hist(b.mean)

## This next line could take some time on a slow computer
b.median <- one.boot(x, median, R = 500, student = TRUE, M = 50)
boot.ci(b.median)
hist(b.median)

## Bootstrap with weights
set.seed(10)
w <- runif(100)
bw <- one.boot(x, median, 1000, weights = w)
print(bw)

## Studentized
bw.stud <- one.boot(x, median, R = 500, student = TRUE, M = 50,
                    weights = w)
boot.ci(bw.stud, type = "stud")

rdpeng/simpleboot documentation built on May 27, 2019, 3:06 a.m.