Learn R Programming

VDA (version 1.01)

predict.VDA_LE: Predict a VDA_LE object.

Description

The predict function for a VDA_LE object.

Usage

## 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 da
...
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.

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

Run this code
# load data
data(zoo)

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

# class vector
y <- zoo[,18]

#run VDA
out <- VDA_LE(x,y)

onecase <- matrix(c(0,1,1,0,0,0,1,0,1,1,0,0,2,1,0,1),1,16)
predict(out, onecase)

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

Run the code above in your browser using DataLab