Learn R Programming

PPtreeViz (version 1.0.3)

PP.classify: predict projection pursuit classification tree

Description

Predict class for the test set and calculate prediction error. After finding tree structure, predict class for the test set and calculate prediction error.

Usage

PP.classify(Tree.result,test.data,Rule,true.class=NULL,...)

Arguments

Tree.result
PPtreeclass object
test.data
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: w
true.class
true class of test dataset if available
...
arguments to be passed to methods

Value

  • predict.class predicted class predict.error number of the prediction errors

References

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

Examples

Run this code
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 <- PP.Tree.class(iris[train,5],iris[train,1:4],"LDA")
PP.classify(Tree.result,iris[test,1:4],1,iris[test,5])

Run the code above in your browser using DataLab