Skip to contents

For each bootstrap sample grow a projection pursuit tree (PPtree object).

Usage

baggtree(
  data,
  class,
  m = 500,
  PPmethod = "LDA",
  lambda = 0.1,
  size.p = 1,
  parallel = FALSE,
  cores = 2
)

Arguments

data

Data frame with the complete data set.

class

A character with the name of the class variable.

m

is the number of bootstrap replicates, this corresponds with the number of trees to grow. To ensure that each observation is predicted a few times we have to select this number no too small. m = 500 is by default.

PPmethod

is the projection pursuit index to be optimized, options LDA or PDA, by default it is LDA.

lambda

a parameter for PDA index

size.p

proportion of random sample variables in each split if size.p= 1 it is bagging and if size.p<1 it is a forest.

parallel

logical condition, if it is TRUE then parallelize the function

cores

number of cores used in the parallelization

Value

data frame with trees_pp output for all the bootstraps samples.

Examples

#crab data set
crab.trees <- baggtree(data = crab, class = 'Type',
m =  200, PPmethod = 'LDA', lambda = .1, size.p = 1 , parallel = TRUE, cores = 2)
str(crab.trees, max.level = 1)
#> List of 200
#>  $ 1  :List of 2
#>  $ 2  :List of 2
#>  $ 3  :List of 2
#>  $ 4  :List of 2
#>  $ 5  :List of 2
#>  $ 6  :List of 2
#>  $ 7  :List of 2
#>  $ 8  :List of 2
#>  $ 9  :List of 2
#>  $ 10 :List of 2
#>  $ 11 :List of 2
#>  $ 12 :List of 2
#>  $ 13 :List of 2
#>  $ 14 :List of 2
#>  $ 15 :List of 2
#>  $ 16 :List of 2
#>  $ 17 :List of 2
#>  $ 18 :List of 2
#>  $ 19 :List of 2
#>  $ 20 :List of 2
#>  $ 21 :List of 2
#>  $ 22 :List of 2
#>  $ 23 :List of 2
#>  $ 24 :List of 2
#>  $ 25 :List of 2
#>  $ 26 :List of 2
#>  $ 27 :List of 2
#>  $ 28 :List of 2
#>  $ 29 :List of 2
#>  $ 30 :List of 2
#>  $ 31 :List of 2
#>  $ 32 :List of 2
#>  $ 33 :List of 2
#>  $ 34 :List of 2
#>  $ 35 :List of 2
#>  $ 36 :List of 2
#>  $ 37 :List of 2
#>  $ 38 :List of 2
#>  $ 39 :List of 2
#>  $ 40 :List of 2
#>  $ 41 :List of 2
#>  $ 42 :List of 2
#>  $ 43 :List of 2
#>  $ 44 :List of 2
#>  $ 45 :List of 2
#>  $ 46 :List of 2
#>  $ 47 :List of 2
#>  $ 48 :List of 2
#>  $ 49 :List of 2
#>  $ 50 :List of 2
#>  $ 51 :List of 2
#>  $ 52 :List of 2
#>  $ 53 :List of 2
#>  $ 54 :List of 2
#>  $ 55 :List of 2
#>  $ 56 :List of 2
#>  $ 57 :List of 2
#>  $ 58 :List of 2
#>  $ 59 :List of 2
#>  $ 60 :List of 2
#>  $ 61 :List of 2
#>  $ 62 :List of 2
#>  $ 63 :List of 2
#>  $ 64 :List of 2
#>  $ 65 :List of 2
#>  $ 66 :List of 2
#>  $ 67 :List of 2
#>  $ 68 :List of 2
#>  $ 69 :List of 2
#>  $ 70 :List of 2
#>  $ 71 :List of 2
#>  $ 72 :List of 2
#>  $ 73 :List of 2
#>  $ 74 :List of 2
#>  $ 75 :List of 2
#>  $ 76 :List of 2
#>  $ 77 :List of 2
#>  $ 78 :List of 2
#>  $ 79 :List of 2
#>  $ 80 :List of 2
#>  $ 81 :List of 2
#>  $ 82 :List of 2
#>  $ 83 :List of 2
#>  $ 84 :List of 2
#>  $ 85 :List of 2
#>  $ 86 :List of 2
#>  $ 87 :List of 2
#>  $ 88 :List of 2
#>  $ 89 :List of 2
#>  $ 90 :List of 2
#>  $ 91 :List of 2
#>  $ 92 :List of 2
#>  $ 93 :List of 2
#>  $ 94 :List of 2
#>  $ 95 :List of 2
#>  $ 96 :List of 2
#>  $ 97 :List of 2
#>  $ 98 :List of 2
#>  $ 99 :List of 2
#>   [list output truncated]
#>  - attr(*, "split_type")= chr "data.frame"
#>  - attr(*, "split_labels")='data.frame':	200 obs. of  1 variable: