Learn R Programming

DiscriMiner (version 0.1-29)

classify: Classification function

Description

Classify provided observations based on a given Discriminant object

Usage

classify(DA_object, newdata)

Arguments

DA_object
discriminant analysis object
newdata
vector or matrix or data frame with variables for which their classes will be calculated

Value

A list with the following elements
scores
discriminant scores for each observation
pred_class
predicted class

Details

A DA_object is a discriminant analysis (DA) object obtained from a geometric predictive DA (class "geoda"), a linear DA (class "linda"), a quadratic DA (class "quada"), or a DISQUAL analysis (class "disqual")

See Also

geoDA, linDA, quaDA, plsDA, disqual

Examples

Run this code
## Not run: 
#   # load iris dataset
#   data(iris)
# 
#   # linear discriminant analysis
#   my_lin1 = linDA(iris[,1:4], iris$Species)
# 
#   # select a sample of 15 observations
#   set.seed(111)
#   obs = sample(1:nrow(iris), 15)
#   some_data = iris[obs, 1:4]
# 
#   # classify some_data
#   get_classes = classify(my_lin1, some_data)
#   get_classes
# 
#   # compare the results against original class
#   table(iris$Species[obs], get_classes$pred_class)
#   ## End(Not run)

Run the code above in your browser using DataLab