library(MASS)
library(tidyverse)
## Load Dataset
data("iris")
(my.data <- as_tibble(iris))
str(my.data)
## create LDA model
model <- lda(formula=Species~., data=my.data)
## get the x,y coordinates for the LDA plot
data.lda.values <- predict(model)
## draw a Graph
plot.data <- data.frame(X=data.lda.values$x[,1], Y=data.lda.values$x[,2], Species=my.data$Species)
p <- ggplot(data=plot.data, aes(x=X, y=Y)) +
geom_point(aes(color=Species)) +
theme_bw()
p
#ggsave(file="my_graph.pdf") ## to save the graph
http://www.rmdk.ca/boosting_forests_bagging.html 8.3.3 Bagging and Random Forests DATA : Boston Medv (주택의 가격 변수)에 대한여러 요건들(13개 변수)간의 관계 분석 #################################################################### # Boston DATA-set library(MASS) data("Boston") set.seed(1) train <- sample(1:nrow(Boston), nrow(Boston)/2) boston.train <- Boston[ train, ] Read more…