bootstrap: Sampler Infrastructure for Stability Assessment

View source: R/sampler.R

bootstrapR Documentation

Sampler Infrastructure for Stability Assessment

Description

Sampler objects that provide objects with functionality used by stabletree to generate resampled datasets.

Usage

  bootstrap(B = 500, v = 1)
  subsampling(B = 500, v = 0.632)
  samplesplitting(k = 5)
  jackknife(d = 1, maxrep = 5000)
  splithalf(B = 500)

Arguments

B

An integer value specifying the number of resampled datasets.

k

An integer value specifying the number of folds in sample-splitting.

d

An integer value specifying the number of observations left out in jackknife.

maxrep

An integer value specifying the maximum number of resampled datasets allowed, when using jackknife.

v

A numeric value between 0 and 1 specifying the fraction of observations in each subsample.

Details

The sampler functions provide objects that include functionality to generate resampled datasets used by stabletree.

The bootstrap function provides an object that can be used to generate B bootstrap samples by sampling from n observations with replacement.

The subsampling function provides an object that can be used to generate B subsamples by sampling from floor(v*n) observations without replacement.

The samplesplitting function provides an object that can be used to generate k-folds from n observations.

The jackknife function provides an object that can be used to generate all datasets necessary to perform leave-k-out jackknife sampling from n observations. The number of datasets is limited by maxrep to prevent unintended CPU or memory overload by accidently choosing too large values for k.

The splithalf function provides an object that can be used to generate B subsamples by sampling from floor(0.5*n) observations without replacement. When used to implement the "splithalf" resampling strategy for measuring the stability of a result via the stability function, the matrix containing the complement learning samples is generated automatically by stability.

See Also

stabletree, stability

Examples


set.seed(0)

## bootstrap sampler
s <- bootstrap(3)
s$sampler(10)

## subsampling
s <- subsampling(3, v = 0.6)
s$sampler(10)

## 5-fold sample-splitting
s <- samplesplitting(5)
s$sampler(10)

## jackknife
s <- jackknife(d = 1)
s$sampler(10)

## splithaf
s <- splithalf(3)
s$sampler(10)


stablelearner documentation built on April 14, 2023, 12:40 a.m.