predict.PPtreeclass: predict PPtree

Description Usage Arguments Details References Examples

View source: R/predictPPtreeclass.R

Description

predict projection pursuit classification tree

Usage

1
2
## S3 method for class 'PPtreeclass'
predict(object, newdata = NULL, Rule = 1, ...)

Arguments

object

a fitted object of class inheriting from "PP.Tree.class"

newdata

the test dataset

Rule

split rule 1: mean of two group means 2: weighted mean of two group means - weight with group size 3: weighted mean of two group means - weight with group sd 4: weighted mean of two group means - weight with group se 5: mean of two group medians 6: weighted mean of two group medians - weight with group size 7: weighted mean of two group median - weight with group IQR 8: weighted mean of two group median - weight with group IQR and size

...

arguments to be passed to methods

Details

Predict class for the test set with the fitted projection pursuit classification tree and calculate prediction error.

References

Lee, YD, Cook, D., Park JW, and Lee, EK(2013) PPtree: Projection Pursuit Classification Tree, Electronic Journal of Statistics, 7:1369-1386.

Examples

1
2
3
4
5
6
7
8
data(iris)
n <- nrow(iris)
tot <- c(1:n)
n.train <- round(n*0.9)
train <- sample(tot,n.train)
test <- tot[-train]
Tree.result <- PPTreeclass(Species~., data=iris[train,],"LDA")
predict(Tree.result)

Example output

Loading required package: gridExtra
Loading required package: ggplot2
Loading required package: partykit
Loading required package: grid
Loading required package: libcoin
Loading required package: mvtnorm
  [1] virginica  setosa     setosa     setosa     setosa     versicolor
  [7] virginica  setosa     virginica  versicolor versicolor virginica 
 [13] setosa     setosa     versicolor virginica  versicolor virginica 
 [19] versicolor virginica  setosa     virginica  virginica  versicolor
 [25] setosa     virginica  setosa     virginica  virginica  virginica 
 [31] setosa     virginica  versicolor versicolor versicolor setosa    
 [37] virginica  virginica  virginica  setosa     versicolor versicolor
 [43] virginica  setosa     versicolor versicolor versicolor virginica 
 [49] setosa     versicolor versicolor versicolor virginica  versicolor
 [55] versicolor setosa     virginica  virginica  versicolor setosa    
 [61] versicolor virginica  virginica  virginica  setosa     versicolor
 [67] versicolor versicolor setosa     setosa     setosa     setosa    
 [73] virginica  setosa     setosa     virginica  versicolor versicolor
 [79] setosa     versicolor versicolor virginica  setosa     virginica 
 [85] setosa     versicolor setosa     versicolor virginica  versicolor
 [91] virginica  virginica  setosa     setosa     virginica  versicolor
 [97] virginica  virginica  virginica  setosa     versicolor setosa    
[103] versicolor setosa     setosa     versicolor setosa     versicolor
[109] setosa     setosa     versicolor setosa     versicolor setosa    
[115] virginica  versicolor setosa     virginica  virginica  versicolor
[121] virginica  virginica  setosa     virginica  virginica  setosa    
[127] setosa     versicolor setosa     versicolor versicolor virginica 
[133] versicolor versicolor setosa    
Levels: setosa versicolor virginica

PPtreeViz documentation built on Dec. 6, 2019, 9:07 a.m.