Could someone please describe, using the reproducible code sample below, how bootstrap sampling works in practice? The more detailed questions are:
What different random datasets are generated from
myData
by bootstrap sampling it?How
myData
looks like after the sampling with replacement has been done?
Thanks!
> x <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
> y <- 2*x
> myData <- data.frame(x, y)
> library(ipred)
> myModel <- ipred::bagging(y ~ ., data = myData, nbagg = 3, ns = length(y))
nbagg
= the number of bootstrap replications
ns
= the relative number of samples (from all training data) used for boostrapping