Open micresh opened 5 years ago
`library("psych")# описательные статистики library("lmtest") # тестирование гипотез в линейных моделях library("ggplot2")# графики library("dplyr") # манипуляции с данными library("stats")
train <- read.csv("D:/Учёба/1 семестр маг/Анализ/lr2/train.csv", header = TRUE, sep = ",")
View(train)
qplot(data = train, train$X48df886f9, train$target)
ggplot() + geom_point(aes(x=train$X48df886f9, y=train$target), size = 2) + theme_bw(base_size =18) + xlab("Фактор X48df886f9") + ylab("target") + labs(title = "Корреляционное поле")
model <- lm(data=train, X48df886f9~target) model$coefficients
qplot(data = train, train$X48df886f9, train$target) + stat_smooth(method="lm", level = 0.95) + theme_bw(base_size = 18) summary(model)
nd <- data.frame(train$X48df886f9 = c(40,60))
predict(model,nd)
install.packages("GGally", "sjPlot") library("GGally") train1 <- train[,2:7] model2 <- lm(data=train1, X48df886f9~target+ train1$X0deb4b6a8 + train1$X34b15f335 + train1$a8cb14b00 + train1$X2f0771a37) model2$coefficients
ggpairs(train1) cor(train1)
nd2 <- data.frame(Agriculture=0.5,Catholic=0.5, Education=20) predict(model2,nd2)
`
https://github.com/micresh/data-analytics-2019-KubSTU/blob/master/lr2/lr2-rlab-ready.pdf