pairs.boot: Two sample bootstrap.

Description Usage Arguments Value Author(s) Examples

Description

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.

Usage

1
pairs_boot(x, y = NULL, FUN, R, student = FALSE, M, weights = NULL, ...)

Arguments

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.

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
library(boot)
set.seed(1)
x <- rnorm(100)
y <- 2 * x + rnorm(100)
boot.cor <- pairs_boot(x, y, FUN = cor, R = 100)
boot.ci(boot.cor)

Example output

Simple Bootstrap Routines (1.1-7)
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 100 bootstrap replicates

CALL : 
boot.ci(boot.out = boot.cor)

Intervals : 
Level      Normal              Basic         
95%   ( 0.8409,  0.9318 )   ( 0.8394,  0.9442 )  

Level     Percentile            BCa          
95%   ( 0.8204,  0.9251 )   ( 0.8217,  0.9265 )  
Calculations and Intervals on Original Scale
Some basic intervals may be unstable
Some percentile intervals may be unstable
Some BCa intervals may be unstable
Warning message:
In boot.ci(boot.cor) : bootstrap variances needed for studentized intervals

simpleboot documentation built on May 2, 2019, 4:16 a.m.