comp_boot_emp_samples: Draw bootstrap sample from the data

Description Usage Arguments Value Examples

View source: R/boot-empirical.R

Description

comp_boot_emp_sample draws one bootstrap samples (i.e. sampling observations with replacement) from the input data. It returns a list containing the indices of the m observations that have been sampled (indices) and the bootstrapped dataset (data).

Usage

1

Arguments

data

A tibble or data frame containing the dataset to be sampled from.

B

Bootstrap repetitions or number of bootstrap samples to be drawn.

m

Number of observations to be sampled with replacement from the original dataset for each bootstrap repetition.

replace

TODO: ADD

Value

A tibble containing the number of bootstrap iteration, the bootstrap samples (data), and the indices of the observations (linked to the original sample) in the sample (indices).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
# Draw B=100 bootstrap samples of size m=5
set.seed(162632)
n <- 100
boot <- comp_boot_emp_samples(
  data.frame(
    y = stats::rnorm(n, 0, 1),
    x = stats::rnorm(n, 0, 1)
  ),
  B = 100,
  m = 5
)

# Display the output
print(boot)

## End(Not run)

shamindras/maar documentation built on Sept. 19, 2021, 10:21 p.m.