Open micresh opened 4 years ago
install.packages(c("psych","dplyr","ggplot2","sjPlot")) library("psych")#
library("psych")# library("lmtest")# library("ggplot2")# library("dplyr")# library("MASS")#
train <- read.csv("C:/lr1/train.csv", header = TRUE, sep = ",") d<-train qplot(data=d,Age,Fare)
ggplot ()+geom_point(aes(x=d$Age,y=d$Fare),size=2) + theme_bw(base_size = 18) + xlab("Возраст") + ylab("Fare") + labs(title = "Корреляционное поле")
model <- lm(data = d,Fare~Age) model$coefficients
model$residuals[1:10] options(digits=3) summary(model) qplot(data = d,Age,Fare) + stat_smooth(method="lm", level = 0.95) + theme_bw(base_size = 18) confint(model,level = 0.95)
data.frame nd<-data.frame(Age=c(40,60)) predict(model,nd)
t<-swiss panel.smooth: pairs(swiss,panel = panel.smooth) library("sjPlot") sjp.corr(t) library("GGally") ggpairs(t)
model2 <- lm(data=t,Fertility~Agriculture+Education+Catholic) summary(model2)
nd2 <- data.frame(Agriculture=0.5,Catholic=0.5,Education=20) predict(model2,nd2)
https://github.com/micresh/data-analytics-2019-KubSTU/tree/master/lr2