1. Import Data

library(ggplot2)

data1 <- read.csv("Dataset 1.csv")

head(data1)
##      Y X1   X2   X3
## 1 57.5 78 2.75 29.5
## 2 52.8 69 2.15 26.3
## 3 61.3 77 4.41 32.2
## 4 67.0 88 5.52 36.5
## 5 53.5 67 3.21 27.2
## 6 62.7 80 4.32 27.7
str(data1)
## 'data.frame':    9 obs. of  4 variables:
##  $ Y : num  57.5 52.8 61.3 67 53.5 62.7 56.2 68.5 69.2
##  $ X1: int  78 69 77 88 67 80 74 94 102
##  $ X2: num  2.75 2.15 4.41 5.52 3.21 4.32 2.31 4.3 3.71
##  $ X3: num  29.5 26.3 32.2 36.5 27.2 27.7 28.3 30.3 28.7
summary(data1)
##        Y               X1            X2              X3       
##  Min.   :52.80   Min.   : 67   Min.   :2.150   Min.   :26.30  
##  1st Qu.:56.20   1st Qu.: 74   1st Qu.:2.750   1st Qu.:27.70  
##  Median :61.30   Median : 78   Median :3.710   Median :28.70  
##  Mean   :60.97   Mean   : 81   Mean   :3.631   Mean   :29.63  
##  3rd Qu.:67.00   3rd Qu.: 88   3rd Qu.:4.320   3rd Qu.:30.30  
##  Max.   :69.20   Max.   :102   Max.   :5.520   Max.   :36.50
ggplot(data1, aes(x = X1, y = Y)) +
  geom_point(color = "black") +
  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(data1, aes(x = X2, y = Y)) +
  geom_point(color = "black") +
  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(data1, aes(x = X3, y = Y)) +
  geom_point(color = "black") +
  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'