mirror of
https://github.com/ArthurDanjou/ArtStudies.git
synced 2026-01-14 15:54:13 +01:00
346 lines
7.5 KiB
R
346 lines
7.5 KiB
R
library(rmarkdown)
|
|
health <- read.table("health.txt", header = TRUE, sep = " ", dec = ".")
|
|
paged_table(health)
|
|
library(dplyr)
|
|
names(health)
|
|
library(dplyr)
|
|
names(health)
|
|
Health<-health[,2:4]
|
|
names(Ozone)
|
|
library(dplyr)
|
|
names(health)
|
|
Health<-health[,2:4]
|
|
names(Health)
|
|
library(dplyr)
|
|
names(health)
|
|
Health<-health[,2:5]
|
|
names(Health)
|
|
library(ggplot2)
|
|
library(plotly)
|
|
p1<-ggplot(health) + aes(x = T12, y = maxO3) + geom_point(col = 'red', size = 0.5) + geom_smooth(method = "lm", se = FALSE)
|
|
ggplotly(p1)
|
|
library(ggplot2)
|
|
library(plotly)
|
|
p1<-ggplot(health) + aes(x = age, y = y) + geom_point(col = 'red', size = 0.5) + geom_smooth(method = "lm", se = FALSE)
|
|
ggplotly(p1)
|
|
library(rmarkdown)
|
|
health <- read.table("health.txt", header = TRUE, sep = " ", dec = ".")
|
|
paged_table(health)
|
|
library(rmarkdown)
|
|
health <- read.table("health.txt", header = TRUE, sep = " ", dec = ".")
|
|
paged_table(health)
|
|
library(dplyr)
|
|
library(corrplot)
|
|
install.packages("corrplot")
|
|
library(dplyr)
|
|
library(corrplot)
|
|
correlation_matrix<-cor(Health)
|
|
library(dplyr)
|
|
library(corrplot)
|
|
correlation_matrix<-cor(health)
|
|
corrplot(correlation_matrix, order = 'hclust',addrect = 3)
|
|
GGally
|
|
install.packages("GGally")
|
|
library(dplyr)
|
|
library(corrplot)
|
|
correlation_matrix<-cor(health)
|
|
corrplot(correlation_matrix, order = 'hclust',addrect = 3)
|
|
library(GGally)
|
|
ggpairs(Ozone)
|
|
library(dplyr)
|
|
library(corrplot)
|
|
correlation_matrix<-cor(health)
|
|
corrplot(correlation_matrix, order = 'hclust',addrect = 3)
|
|
library(GGally)
|
|
ggpairs(health)
|
|
library(dplyr)
|
|
library(corrplot)
|
|
correlation_matrix<-cor(health)
|
|
corrplot(correlation_matrix, order = 'hclust',addrect = 3)
|
|
library(GGally)
|
|
ggpairs(health)
|
|
library(dplyr)
|
|
library(corrplot)
|
|
correlation_matrix<-cor(health)
|
|
corrplot(correlation_matrix, order = 'hclust',addrect = 3)
|
|
Health <- health[2:5]
|
|
library(dplyr)
|
|
library(corrplot)
|
|
correlation_matrix<-cor(Health)
|
|
corrplot(correlation_matrix, order = 'hclust',addrect = 3)
|
|
model <- lm(y ~ ., data = Health)
|
|
coefficients(model)
|
|
summary(model)
|
|
library(ggfortify)
|
|
install.packages("ggfortify")
|
|
library(ggfortify)
|
|
autoplot(mod,1)
|
|
library(ggfortify)
|
|
autoplot(model,1)
|
|
library(ggfortify)
|
|
autoplot(model,1)
|
|
autoplot(model,3)
|
|
library(ggfortify)
|
|
autoplot(model,1)
|
|
autoplot(model,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model)
|
|
install.packages("car")
|
|
library(ggfortify)
|
|
autoplot(model,1)
|
|
autoplot(model,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model)
|
|
library(ggfortify)
|
|
autoplot(model,1)
|
|
autoplot(model,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model,1)
|
|
autoplot(model,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model,1)
|
|
autoplot(model,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model,1)
|
|
autoplot(model,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model)
|
|
autoplot(model,2)
|
|
model <- lm(y ~ age, data = Health)
|
|
coefficients(model)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model,1)
|
|
autoplot(model,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model)
|
|
autoplot(model,2)
|
|
model <- lm(y ~ ., data = Health)
|
|
coefficients(model)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model,1)
|
|
autoplot(model,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model)
|
|
autoplot(model,2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model,1)
|
|
autoplot(model,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model)
|
|
autoplot(model,2)
|
|
model <- lm(y ~ ., data = Health)
|
|
coefficients(model)
|
|
summary(model)
|
|
model <- lm(y ~ age, data = Health)
|
|
coefficients(model)
|
|
summary(model)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model,1)
|
|
model <- lm(y ~ ., data = Health)
|
|
coefficients(model)
|
|
summary(model)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model,1)
|
|
library(GGally)
|
|
ggpairs(model)
|
|
library(GGally)
|
|
ggpairs(health)
|
|
library(GGally)
|
|
ggpairs(Health)
|
|
library(GGally)
|
|
ggpairs(Health, mapping = F)
|
|
library(GGally)
|
|
ggpairs(Health, progress = F)
|
|
model2 <- lm(y ~ age**2 + tri + chol, data = Health)
|
|
model2 <- lm(y ~ age**2 + tri + chol, data = Health)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
autoplot(model2,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model2)
|
|
autoplot(model2,2)
|
|
model2 <- lm(y ~ sqrt(age) + tri + chol, data = Health)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
model2 <- lm(y ~ sqrt(age) + tri + chol, data = Health)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
Health2 <- Health
|
|
Health2[1] <- Health2[1]^2
|
|
model2 <- lm(y ~ ., data = Health)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
View(Health)
|
|
View(Health)
|
|
View(Health2)
|
|
View(Health2)
|
|
Health2 <- Health
|
|
View(Health2)
|
|
View(Health2)
|
|
Health2 <- Health
|
|
Health2[2] <- Health2[2]^2
|
|
model2 <- lm(y ~ ., data = Health)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
View(Health2)
|
|
View(Health2)
|
|
autoplot(model2,3)
|
|
Health2 <- Health
|
|
Health2[2] <- Health2[2]^2
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
autoplot(model2,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model2)
|
|
autoplot(model2,2)
|
|
Health2 <- Health
|
|
Health2[2] <- sqrt(Health2[2])
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
Health2 <- Health
|
|
Health2[2] <- Health2[2]^2
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
Health2 <- Health
|
|
Health2[2] <- Health2[2]^2
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
autoplot(model2,3)
|
|
Health2 <- Health
|
|
Health2[6] <- Health2[2]^2
|
|
View(Health2)
|
|
View(Health2)
|
|
Health2 <- c(Health, c())
|
|
Health2[6] <- Health2[2]^2
|
|
Health2 <- c(Health, c())
|
|
Health2[5] <- Health2[2]^2
|
|
View(Health2)
|
|
View(Health2)
|
|
Health2 <- Health
|
|
Health2 <- append(Health2, Health[2]^2)
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
View(Health2)
|
|
Health2 <- Health
|
|
Health2 <- append(Health2, Health[2]^2)
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
Health2 <- Health
|
|
# Add to Health a new column with the square of the age named age_sq
|
|
Health2$age_sq <- Health2$age^2
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
View(Health2)
|
|
Health2 <- Health
|
|
the age named age_sq
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
Health2 <- Health
|
|
Health2$age_sq <- Health2$age^2
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
autoplot(model2,3)
|
|
autoplot(model2,2)
|
|
View(Health2)
|
|
View(Health2)
|
|
Health2 <- Health
|
|
Health2$age_sq <- sqrt(Health2$age)
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
Health2 <- Health
|
|
Health2$age_sq <- Health2$age^2
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
View(Health2)
|
|
View(Health2)
|
|
Health2 <- Health
|
|
Health2$age_sq <- Health2$age^2
|
|
Health2 <- Health2[1:99,]
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
Health2 <- Health
|
|
Health2$age_sq <- Health2$age^2
|
|
Health2 <- Health2[1:5,24]
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
Health2 <- Health
|
|
Health2$age_sq <- Health2$age^2
|
|
Health2 <- Health2[1:5,]
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
View(Health2)
|
|
Health2 <- Health
|
|
Health2$age_sq <- Health2$age^2
|
|
Health2 <- Health2[1:24,]
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|
|
library(ggfortify)
|
|
library(car)
|
|
autoplot(model2,1)
|
|
autoplot(model2,3)
|
|
set.seed(0)
|
|
durbinWatsonTest(model2)
|
|
autoplot(model2,2)
|
|
Health2 <- Health
|
|
Health2$age_sq <- Health2$age^2
|
|
Health2 <- Health2[1:24,]
|
|
model2 <- lm(y ~ ., data = Health2)
|
|
summary(model2)
|
|
coefficients(model2)
|