Skip to contents

Draws without replacement at a smaller sample size; valid under weaker conditions than the bootstrap. No clean CRAN function exposes the same (data, statistic, subsample_size, n_subsamples) API; np's npsubsample is closest but is kernel-specific. Kept as an in-house implementation and flagged novel/no-clean-CRAN-equivalent.

Usage

subsampling(
  data,
  statistic,
  subsample_size = NULL,
  n_subsamples = 1000L,
  ci_level = 0.95,
  seed = 42L
)

Arguments

data

Numeric vector or matrix.

statistic

Function returning a scalar.

subsample_size

Subsample size; default floor(n^0.7).

n_subsamples

Number of subsamples.

ci_level

Confidence level.

seed

Random seed.

Value

A morie_bootstrap_result.

Examples

set.seed(1)
str(subsampling(rnorm(60), statistic = mean,
                n_subsamples = 200L), max.level = 1)
#> List of 11
#>  $ estimate         : num -0.0267
#>  $ se               : num 0.0592
#>  $ ci_lower         : num -0.141
#>  $ ci_upper         : num 0.0888
#>  $ bias             : num 0
#>  $ n_boot           : int 200
#>  $ method           : chr "subsampling"
#>  $ ci_method        : chr "subsampling"
#>  $ boot_distribution: num [1:200] 0.11416 0.45333 -0.00369 0.36415 0.08882 ...
#>  $ original_estimate: num -0.0267
#>  $ acceleration     : num 0
#>  - attr(*, "class")= chr [1:2] "morie_bootstrap_result" "list"