Name : Farhan Dzaffa Arfianto

NIM : 220605110099

Class : C

Institue : Maulana Malik Ibrahim Islamic State University of Malang

Lecture : Prof. Dr. Suhartono, M.Kom

x <- seq(1, 10, length.out = 100) # Variabel prediktor
epsilon <- rnorm(100, mean = 0, sd = 1) # Noise dengan distribusi Gaussian
y <- 2*x + 3 + epsilon # Variabel respons
data <- data.frame(x, y)
plot(data$x, data$y, main = "Model Regresi Linear", xlab = "Variabel X", ylab = "Variabel Y")
abline(lm(y ~ x, data = data), col = "red") # Garis regresi linear

model <- lm(y ~ x, data = data)
summary(model)
## 
## Call:
## lm(formula = y ~ x, data = data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.90417 -0.60306 -0.02149  0.65253  2.01217 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.85295    0.20846   13.69   <2e-16 ***
## x            2.04144    0.03421   59.68   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8977 on 98 degrees of freedom
## Multiple R-squared:  0.9732, Adjusted R-squared:  0.9729 
## F-statistic:  3562 on 1 and 98 DF,  p-value: < 2.2e-16