| pairs.boot {simpleboot} | R Documentation |
pairs.boot is used to bootstrap a statistic which operates on
two samples and returns a single value. An example of such a
statistic is the correlation coefficient (i.e. cor).
Resampling is done pairwise, so x and y must have the
same length (and be ordered correctly). One can alternatively pass a
two-column matrix to x.
pairs.boot(x, y = NULL, FUN, R, student = FALSE, M, weights = NULL, ...)
x |
Either a vector of numbers representing the first sample or a two column matrix containing both samples. |
y |
If NULL it is assumed that x is a two-column matrix.
Otherwise, y is the second sample. |
FUN |
The statistic to bootstrap. If x and y are
separate vectors then FUN should operate on separate
vectors. Similarly, if x is a matrix, then FUN should
operate on two-column matrices. FUN can be either a quoted
string or a function name. |
R |
The number of bootstrap replicates. |
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. |
... |
Other (named) arguments that should be passed to FUN. |
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
set.seed(1)
x <- rnorm(100)
y <- 2 * x + rnorm(100)
boot.cor <- pairs.boot(x, y, FUN = cor, R = 1000)
boot.ci(boot.cor)
## With weighting
set.seed(20)
w <- (100:1)^2
bw <- pairs.boot(x, y, FUN = cor, R = 5000, weights = w)
boot.ci(bw, type = c("norm", "basic", "perc"))