Description Usage Arguments Details Value Author(s) Examples
two.boot
is used to bootstrap the difference between various
univariate statistics. An example is the difference of means.
Bootstrapping is
done by independently resampling from sample1
and sample2
.
1 |
sample1 |
First sample; a vector of numbers. |
sample2 |
Second sample; a vector of numbers. |
FUN |
The statistic which is applied to each sample. This can be a quoted string or a function name. |
R |
Number of bootstrap replicates. |
student |
Should we do a studentized bootstrap? This requires a double bootstrap so it might take longer. |
M |
If |
weights |
Resampling weights; a list with two components. The
first component of the list is a vector of weights for
|
... |
Other (named) arguments that should be passed to
|
The differences are always taken as FUN(sample1) -
FUN(sample2)
. If you want the difference to be reversed you need
to reverse the order of the arguments sample1
and
sample2
.
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.
Roger D. Peng
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | library(boot)
set.seed(50)
x <- rnorm(100, 1) ## Mean 1 normals
y <- rnorm(100, 0) ## Mean 0 normals
b <- two.boot(x, y, median, R = 1000)
boot.ci(b) ## No studentized confidence intervals
hist(b) ## Histogram of the bootstrap replicates
b <- two.boot(x, y, quantile, R = 1000, probs = .75)
## With weighting
## Here all members of the first group has equal weighting
## but members of the the second have unequal weighting
w <- list(rep(1, 100), 100:1)
bw <- two.boot(x, y, median, R = 1000, weights = w)
boot.ci(b)
## Studentized
bstud <- two.boot(x, y, median, R = 500, student = TRUE, M = 50)
boot.ci(bstud, type = "stud")
## Studentized with weights
bwstud <- two.boot(x, y, median, R = 500, student = TRUE, M = 50,
weights = w)
boot.ci(bstud, type = "stud")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.