°øÀ¯ÀÚ·á HOME > ÀÚ·á½Ç > °øÀ¯ÀÚ·á
 
[Á¤º¸±â¼úÈ°¿ë¿¬±¸] R·Î ÇÏ´Â ÆǺ°ºÐ¼® code
°ü¸®ÀÚ 16-06-07 08:37 2,865
library(car)
# install.packages('rattle')
data(wine, package='rattle')
attach(wine)
head(wine)
scatterplotMatrix(wine[2:6])
 
library(MASS)
wine.lda <- lda(Type ~ ., data=wine)
wine.lda
wine.lda.values <- predict(wine.lda)
ldahist(data = wine.lda.values$x[,1], g=Type)
ldahist(data = wine.lda.values$x[,2], g=Type)
plot(wine.lda.values$x[,1],wine.lda.values$x[,2]) # make a scatterplot
text(wine.lda.values$x[,1],wine.lda.values$x[,2],Type,cex=0.7,pos=4,col="red") # add labels