harvest: A harvested classification tree

Description Usage Arguments Details Value Examples

View source: R/harvest.R

Description

The main function of the package, aiming at develop the harvest classification tree. Training data input and

Usage

1
harvest(training, num.var, numeric.info, sig = 0.95)

Arguments

training

original data where 'y' stores classmembership 0 and 1,in the first column, with explanatory variable stores in the second to the last column.

num.var

number of explanatory variables

numeric.info

the vector stores the number of which variable is continuous

sig

significance level (default 0.95)

Details

The function will return the harvested tree model. Missing values are allowed, and they will be treated accordingly. To use the trained tree model to predict, you can use predict function in this package.

Value

An object of class "harvest", which is the result of algorithm with the following elements for each nodes(nodes are ordered in sequence of harvesting):

rule constriants of the node

total total number of data points in the node

'1' the number of data points belonging to class 1 in the node

'logchange' the improvement of log likelihood of deleting the redundent rules by the algorithm for the node

Examples

1
2

Example output

Attaching package:Harvest.TreeThe following object is masked frompackage:stats:

    predict


 node number: 8 
   root
   x3< 153.5
   x2=50-69
   x4=2004,2006,2007,2008,2009,2010

 node number: 9 
   root
   x3< 153.5
   x2=50-69
   x4=2005

 node number: 20 
   root
   x3< 153.5
   x2=39-,40-49,70-74,75+
   x1=23,25,26,27,28
   x3< 62.25

 node number: 84 
   root
   x3< 153.5
   x2=39-,40-49,70-74,75+
   x1=23,25,26,27,28
   x3>=62.25
   x4=2004,2006,2007,2008,2009,2010
   x2=40-49

 node number: 170 
   root
   x3< 153.5
   x2=39-,40-49,70-74,75+
   x1=23,25,26,27,28
   x3>=62.25
   x4=2004,2006,2007,2008,2009,2010
   x2=39-,70-74,75+
   x4=2004,2006,2009,2010

 node number: 171 
   root
   x3< 153.5
   x2=39-,40-49,70-74,75+
   x1=23,25,26,27,28
   x3>=62.25
   x4=2004,2006,2007,2008,2009,2010
   x2=39-,70-74,75+
   x4=2007,2008

 node number: 43 
   root
   x3< 153.5
   x2=39-,40-49,70-74,75+
   x1=23,25,26,27,28
   x3>=62.25
   x4=2005

 node number: 11 
   root
   x3< 153.5
   x2=39-,40-49,70-74,75+
   x1=21,24,29

 node number: 48 
   root
   x3>=153.5
   x3< 235
   x1=22,23,24,26,27
   x4=2007,2009
   x2=50-69,75+

 node number: 49 
   root
   x3>=153.5
   x3< 235
   x1=22,23,24,26,27
   x4=2007,2009
   x2=40-49,70-74

 node number: 400 
   root
   x3>=153.5
   x3< 235
   x1=22,23,24,26,27
   x4=2004,2005,2006,2008,2010
   x2=50-69,70-74
   x4=2005,2008,2010
   x1=23,26
   x1=26

 node number: 401 
   root
   x3>=153.5
   x3< 235
   x1=22,23,24,26,27
   x4=2004,2005,2006,2008,2010
   x2=50-69,70-74
   x4=2005,2008,2010
   x1=23,26
   x1=23

 node number: 201 
   root
   x3>=153.5
   x3< 235
   x1=22,23,24,26,27
   x4=2004,2005,2006,2008,2010
   x2=50-69,70-74
   x4=2005,2008,2010
   x1=22,24

 node number: 101 
   root
   x3>=153.5
   x3< 235
   x1=22,23,24,26,27
   x4=2004,2005,2006,2008,2010
   x2=50-69,70-74
   x4=2004,2006

 node number: 51 
   root
   x3>=153.5
   x3< 235
   x1=22,23,24,26,27
   x4=2004,2005,2006,2008,2010
   x2=39-,40-49,75+

 node number: 13 
   root
   x3>=153.5
   x3< 235
   x1=21,25,28,29

 node number: 7 
   root
   x3>=153.5
   x3>=235
[1] 1
[1] 2
[1] 3
[1] 4
[1] 5
[1] 6
[1] 7
[1] 8
[1] 9
[1] 10
[1] 11
[1] 12
[1] 13
[1] 14
[1] 15
[1] 16
[[1]]
[[1]]$rule
   lower bound (numeric) upper bound (numeric)          categrical
x1                  -Inf                   Inf      23,25,26,27,28
x3                   0.5                   1.5                <NA>
x4                  -Inf                   Inf 2004,2006,2009,2010

[[1]]$total
[1] 52

[[1]]$`1`
[1] 18

[[1]]$logchange
[1] 0.7950388


[[2]]
[[2]]$rule
   lower bound (numeric) upper bound (numeric)    categrical
x2                  -Inf                   Inf 39-,70-74,75+
x3                   0.5                   1.5          <NA>

[[2]]$total
[1] 16

[[2]]$`1`
[1] 11

[[2]]$logchange
[1] 1.065846


[[3]]
[[3]]$rule
   lower bound (numeric) upper bound (numeric) categrical
x3                   0.5                   1.5       <NA>
x4                  -Inf                   Inf       2005

[[3]]$total
[1] 6

[[3]]$`1`
[1] 6

[[3]]$logchange
[1] 0.9371718


[[4]]
[[4]]$rule
   lower bound (numeric) upper bound (numeric)     categrical
x1                  -Inf                   Inf 23,25,26,27,28
x3                   0.5                   1.5           <NA>

[[4]]$total
[1] 27

[[4]]$`1`
[1] 4

[[4]]$logchange
[1] 0.2528421


[[5]]
[[5]]$rule
   lower bound (numeric) upper bound (numeric) categrical
x1                  -Inf                   Inf       <NA>
x2                  -Inf                   Inf      50-69
x4                  -Inf                   Inf       2005

[[5]]$total
[1] 14

[[5]]$`1`
[1] 9

[[5]]$logchange
[1] 0.2135247


[[6]]
[[6]]$rule
   lower bound (numeric) upper bound (numeric)          categrical
x1                  -Inf                   Inf            21,24,29
x2                  -Inf                   Inf 39-,40-49,70-74,75+
x4                  -Inf                   Inf                <NA>

[[6]]$total
[1] 17

[[6]]$`1`
[1] 15

[[6]]$logchange
[1] 0.4285837


[[7]]
[[7]]$rule
   lower bound (numeric) upper bound (numeric)  categrical
x2                  -Inf                   Inf 40-49,70-74
x3                   1.5                   2.5        <NA>
x4                  -Inf                   Inf   2007,2009

[[7]]$total
[1] 6

[[7]]$`1`
[1] 4

[[7]]$logchange
[1] 0


[[8]]
[[8]]$rule
   lower bound (numeric) upper bound (numeric)     categrical
x1                  -Inf                   Inf          22,24
x3                   1.5                   2.5           <NA>
x4                  -Inf                   Inf 2005,2008,2010

[[8]]$total
[1] 4

[[8]]$`1`
[1] 4

[[8]]$logchange
[1] 0


[[9]]
[[9]]$rule
   lower bound (numeric) upper bound (numeric) categrical
x3                  -Inf                   0.5       <NA>
x4                  -Inf                   Inf       <NA>

[[9]]$total
[1] 37

[[9]]$`1`
[1] 8

[[9]]$logchange
[1] -0.01941443


[[10]]
[[10]]$rule
   lower bound (numeric) upper bound (numeric)     categrical
x1                  -Inf                   Inf 22,23,24,26,27
x4                  -Inf                   Inf      2004,2006

[[10]]$total
[1] 33

[[10]]$`1`
[1] 27

[[10]]$logchange
[1] 0.02384917


[[11]]
[[11]]$rule
   lower bound (numeric) upper bound (numeric)               categrical
x2                  -Inf                   Inf            39-,40-49,75+
x4                  -Inf                   Inf 2004,2005,2006,2008,2010

[[11]]$total
[1] 17

[[11]]$`1`
[1] 14

[[11]]$logchange
[1] 0.0924619


[[12]]
[[12]]$rule
   lower bound (numeric) upper bound (numeric) categrical
x1                  -Inf                   Inf         23
x3                   1.5                   2.5       <NA>

[[12]]$total
[1] 13

[[12]]$`1`
[1] 6

[[12]]$logchange
[1] 0.02304656


[[13]]
[[13]]$rule
   lower bound (numeric) upper bound (numeric) categrical
x1                  -Inf                   Inf       <NA>
x3                  -Inf                   1.5       <NA>

[[13]]$total
[1] 13

[[13]]$`1`
[1] 3

[[13]]$logchange
[1] 0


[[14]]
[[14]]$rule
   lower bound (numeric) upper bound (numeric)  categrical
x1                  -Inf                   Inf 21,25,28,29
x2                  -Inf                   Inf        <NA>
x4                  -Inf                   Inf        <NA>

[[14]]$total
[1] 11

[[14]]$`1`
[1] 10

[[14]]$logchange
[1] -0.1165293


[[15]]
[[15]]$rule
   lower bound (numeric) upper bound (numeric) categrical
x3                   1.5                   2.5       <NA>

[[15]]$total
[1] 11

[[15]]$`1`
[1] 3

[[15]]$logchange
[1] -0.3770532


[[16]]
[[16]]$rule
   lower bound (numeric) upper bound (numeric) categrical
x1                  -Inf                   Inf         NA
x2                  -Inf                   Inf         NA
x4                  -Inf                   Inf         NA

[[16]]$total
[1] 23

[[16]]$`1`
[1] 22

[[16]]$logchange
[1] 0

Harvest.Tree documentation built on May 2, 2019, 3:31 p.m.