Professional Documents
Culture Documents
• Bankruptcy prediction
– Based on financial variables e.g. ratios, discriminant analysis was first
used to explain which firms entered bankruptcy vs. survived.
• Marketing
– Determine the factors which distinguish different types of customers
and products on the basis of surveys or other forms of collected data.
• Make a scatterplot
• > plot(wine.lda.values$x[,1],wine.lda.values$x[,2])
• Add labels
• > text(wine.lda.values$x[,1],wine.lda.values$x[,2],Type,cex=0
.7,pos=4,col="red")
• Scatterplots of Discriminant Functions
• # make a scatterplot
• > plot(wine.lda.values$x[,1],wine.lda.values$x[,2])
• # add labels
• > text(wine.lda.values$x[,1],wine.lda.values$x[,2],wine$Type,
cex=0.7,pos=4,col="red")
• Create new object contain type variable from wine data, and
value from wine.lda.values.
• > library(caret)
• > install.packages(lattice )
• > library(lattice)
• > wine.lda.predict <-train(Type ~.,method="lda",data=wine)
• > confusionMatrix(wine$Type,predict(wine.lda.predict,wine))
• Visualization tool using klaR package.
• > install.packages(klaR)
• > library(klaR)
• > partimat(Type ~ Alcohol + Alcalinity, data = wine, method
= "lda")