library(foreign)
library(ggplot2)
library(MASS)
vino<-read.csv('C:/Users/rusoc/OneDrive/Escritorio/TEC/Mineria de datos/Wine.csv')
dis=lda(Customer_Segment~., data=vino)
dis
## Call:
## lda(Customer_Segment ~ ., data = vino)
## 
## Prior probabilities of groups:
##         1         2         3 
## 0.3314607 0.3988764 0.2696629 
## 
## Group means:
##    Alcohol Malic_Acid Color_Intensity
## 1 13.74475   2.010678        5.528305
## 2 12.27873   1.932676        3.086620
## 3 13.15375   3.333750        7.396250
## 
## Coefficients of linear discriminants:
##                        LD1        LD2
## Alcohol         -0.8376479 -1.7997035
## Malic_Acid      -0.4791942  0.5742716
## Color_Intensity -0.4800590  0.3715307
## 
## Proportion of trace:
##    LD1    LD2 
## 0.6818 0.3182
prediccion=rbind(c(13.56,3.21,6.43))
colnames(prediccion)=colnames(vino[,1:3])
prediccion=data.frame(prediccion)
predict(dis,newdata =prediccion)
## $class
## [1] 3
## Levels: 1 2 3
## 
## $posterior
##           1           2         3
## 1 0.4016768 0.007362383 0.5909608
## 
## $x
##         LD1         LD2
## 1 -1.545812 0.004698352