bstrap: Performs bootstrap sampling of the (training) dataset

Description Usage Arguments Value Author(s) See Also Examples

View source: R/bstrap.R

Description

Performs bootstrap sampling of our (training) dataset; this function is used inside of the forestRK function.

Usage

1
 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 y; dat should contain no NA or NaN's.

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

forestRK

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  ## 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)

forestRK documentation built on July 19, 2019, 5:04 p.m.

Related to bstrap in forestRK...