bstrap {forestRK} | R Documentation |
Performs bootstrap sampling of the (training) dataset
Description
Performs bootstrap sampling of our (training) dataset; this function is used
inside of the forestRK
function.
Usage
bstrap(dat = data.frame(), nbags, samp.size)
Arguments
dat |
a numericized data frame that stores both the covariates of the observations
and their numericized class types |
nbags |
the number of bags or the number of bootstrap samples that we want to generate. |
samp.size |
the number of samples that each bag (individual bootstrap sample) should contain. |
Value
A list containing a data frames of bootstrap samples generated from dat
.
Author(s)
Hyunjin Cho, h56cho@uwaterloo.ca Rebecca Su, y57su@uwaterloo.ca
See Also
Examples
## example: iris dataset
## load the forestRK package
library(forestRK)
# covariates of training data set
x.train <- x.organizer(iris[,1:4], encoding = "num")[c(1:25,51:75,101:125),]
y.train <- y.organizer(iris[c(1:25,51:75,101:125),5])$y.new
# combine the covariates x with class types y
b <- data.frame(cbind(x.train, y.train))
## bstrp function example
bootstrap.sample <- bstrap(dat = b, nbags = 20, samp.size = 30)
[Package forestRK version 0.0-5 Index]