predict.vda.le: Predict a vda.le object.

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/predict.vda.le.R

Description

The predict function for a vda.le object.

Usage

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

Arguments

object

An object of class 'vda.le', usually the result of a call to vda.le.

newdata

An optional n x p matrix or data frame containing new data to be classified using vertex discriminant analysis. The data must contain the same number of attributes as the training data. If newdata is omitted, the training data is used.

...

Not used.

Details

The prediction funtion for Vertex Discriminant Analysis (vda.le). Returns 1 x n vector in which each element represents the predicted value for the corresponding case.

Author(s)

Edward Grant, Xia Li, Kenneth Lange, Tong Tong Wu

Maintainer: Edward Grant edward.m.grant@gmail.com

References

Lange, K. and Wu, T.T. (2008) An MM Algorithm for Multicategory Vertex Discriminant Analysis. Journal of Computational and Graphical Statistics, Volume 17, No 3, 527-544.

See Also

vda.le, summary.vda.le, print.vda.le

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# load zoo data
# column 1 is name, columns 2:17 are features, column 18 is class
data(zoo)

# feature matrix without intercept
x <- zoo[,2:17]

# class vector
y <- zoo[,18]

# run VDA
out <- vda.le(x,y)

# predict cases based on VDA
onecase <- matrix(c(0,0,1,0,0,1,1,0,0,0,0,0,6,0,0,0),nrow=1)

fivecases <- matrix(0,5,16)
fivecases[1,] <- c(1,0,0,1,0,0,0,1,1,1,0,0,4,0,1,0)
fivecases[2,] <- c(1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1)
fivecases[3,] <- c(0,1,1,0,1,0,0,0,1,1,0,0,2,1,1,0)
fivecases[4,] <- c(0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0)
fivecases[5,] <- c(0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0)
predict(out, fivecases)

VDA documentation built on May 29, 2017, 6:32 p.m.