library(ggplot2)
data2 <- read.csv("Dataset 2.csv")
head(data2)
## X1 X2 X3 X4 X5 X6 Y
## 1 12.10 34.05 8.50 2.22 64.81 40.2 73.84
## 2 12.45 44.19 10.13 2.20 68.65 32.9 76.87
## 3 13.39 38.66 8.99 1.68 69.07 29.7 77.19
## 4 14.38 26.30 10.04 2.16 69.18 23.6 69.08
## 5 17.86 23.36 10.27 1.46 68.34 33.4 78.27
## 6 13.38 10.06 10.87 1.38 70.14 30.1 84.72
str(data2)
## 'data.frame': 514 obs. of 7 variables:
## $ X1: num 12.1 12.4 13.4 14.4 17.9 ...
## $ X2: num 34 44.2 38.7 26.3 23.4 ...
## $ X3: num 8.5 10.13 8.99 10.04 10.27 ...
## $ X4: num 2.22 2.2 1.68 2.16 1.46 1.38 0.7 0.56 1.68 1.74 ...
## $ X5: num 64.8 68.7 69.1 69.2 68.3 ...
## $ X6: num 40.2 32.9 29.7 23.6 33.4 30.1 29.5 25.2 30.7 34.1 ...
## $ Y : num 73.8 76.9 77.2 69.1 78.3 ...
summary(data2)
## X1 X2 X3 X4
## Min. : 2.270 Min. : 0.00 Min. : 1.280 Min. : 0.000
## 1st Qu.: 6.570 1st Qu.:13.65 1st Qu.: 7.985 1st Qu.: 0.370
## Median : 9.615 Median :25.00 Median : 8.800 Median : 1.260
## Mean :11.500 Mean :28.69 Mean : 8.851 Mean : 4.032
## 3rd Qu.:14.107 3rd Qu.:38.61 3rd Qu.: 9.775 3rd Qu.: 3.585
## Max. :40.010 Max. :99.62 Max. :12.740 Max. :86.820
## X5 X6 Y
## Min. :55.72 Min. : 0.00 Min. :14.14
## 1st Qu.:68.03 1st Qu.:16.62 1st Qu.:71.28
## Median :70.45 Median :22.20 Median :79.03
## Mean :70.20 Mean :22.35 Mean :75.11
## 3rd Qu.:72.57 3rd Qu.:28.60 3rd Qu.:84.64
## Max. :77.93 Max. :50.20 Max. :96.37
ggplot(data2, aes(x = X1, y = Y)) +
geom_point(color = "blue") +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(
title = "Scatterplot Y dengan X1",
x = "X1",
y = "Y"
) +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data2, aes(x = X2, y = Y)) +
geom_point(color = "blue") +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(
title = "Scatterplot Y dengan X2",
x = "X2",
y = "Y"
) +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data2, aes(x = X3, y = Y)) +
geom_point(color = "blue") +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(
title = "Scatterplot Y dengan X3",
x = "X3",
y = "Y"
) +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data2, aes(x = X4, y = Y)) +
geom_point(color = "blue") +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(
title = "Scatterplot Y dengan X4",
x = "X4",
y = "Y"
) +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data2, aes(x = X5, y = Y)) +
geom_point(color = "blue") +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(
title = "Scatterplot Y dengan X5",
x = "X5",
y = "Y"
) +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data2, aes(x = X6, y = Y)) +
geom_point(color = "blue") +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(
title = "Scatterplot Y dengan X6",
x = "X6",
y = "Y"
) +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'
