[R] Classification from candisc

adigs andrewdigby at mac.com
Fri Sep 9 02:39:00 CEST 2011


This is a probably a daft question, but I would appreciate some help.

I want to attempt to separate groups in a dataset using discriminant
function analysis, and have been using linear discriminant analysis
(lda(klaR)) and canonical discriminant analysis (candisc(candisc)).

# CDA:
iris.mod <- lm(cbind(Petal.Length, Sepal.Length, Petal.Width, Sepal.Width) ~
Species, data=iris)
iris.can <- candisc(iris.mod, data=iris)

# LDA:
iris.lda<-lda(Species~Petal.Length+Sepal.Length+Petal.Width+Sepal.Width,data=iris)   

However, I now want to make classifications based on these discriminant
functions. With LDA, this is easy:

iris.lda.predict<-predict.lda(iris.lda)

but I can't find a straightforward way of classifying from the CDA results,
since predict() doesn't have a method for the candisc class.

So how can I classify/predict from a candisc object? I think I may be
misunderstanding something fairly fundamental about LDA vs CDA, but any
suggestions would be gratefully received!

Thanks.

--
View this message in context: http://r.789695.n4.nabble.com/Classification-from-candisc-tp3800492p3800492.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list