Analisis ini bertujuan untuk mengetahui pengaruh jam belajar per minggu (StudyTimeWeekly) dan jumlah ketidakhadiran (Absences) terhadap nilai GPA siswa menggunakan metode regresi linear berganda. Data yang digunakan adalah dataset Student Performance yang terdiri dari 2392 observasi dengan 15 variabel.
library(readr)
data_asli <- read.csv("C:/Users/Asus/Downloads/Student_performance_data.csv")
set.seed(123)
data <- data_asli[sample(nrow(data_asli), 50), ]
data## StudentID Age Gender Ethnicity ParentalEducation StudyTimeWeekly Absences
## 2227 3227 17 0 0 1 11.1978620 28
## 526 1526 17 0 2 3 15.0158046 11
## 195 1195 17 1 0 0 13.4837390 11
## 1842 2842 16 1 3 1 16.2585681 24
## 1142 2142 15 1 0 2 14.9348662 5
## 1253 2253 18 1 2 2 6.1726530 19
## 1268 2268 18 0 3 4 8.3243406 17
## 1038 2038 17 1 1 2 11.1562025 17
## 665 1665 15 0 1 2 11.3663830 26
## 1627 2627 15 0 0 0 9.6157234 26
## 1011 2011 15 1 3 2 4.8199252 22
## 1115 2115 17 1 3 4 19.3887875 16
## 953 1953 15 1 0 2 17.3470928 25
## 348 1348 18 1 0 2 14.5723031 6
## 1017 2017 16 1 0 1 6.7001714 14
## 2013 3013 16 1 3 4 19.0784161 15
## 1379 2379 16 1 1 1 8.1123878 22
## 2074 3074 16 1 0 1 6.1531017 12
## 1450 2450 18 0 0 1 12.0897797 14
## 1673 2673 18 0 2 2 8.7805849 17
## 1790 2790 16 0 1 3 13.2304865 25
## 211 1211 17 1 2 0 1.8947783 3
## 1614 2614 15 1 0 1 13.3636132 2
## 555 1555 15 0 1 3 10.5491293 4
## 1895 2895 15 1 2 2 17.7317919 15
## 373 1373 16 0 0 1 16.5928761 8
## 1167 2167 15 1 0 1 3.5959563 2
## 1799 2799 17 1 2 2 8.5920549 23
## 905 1905 17 1 1 1 6.2756429 6
## 1866 2866 16 1 0 3 6.3258470 18
## 1047 2047 17 0 3 4 1.9523752 15
## 309 1309 18 0 1 3 8.0729339 25
## 1248 2248 16 0 0 1 0.2305203 26
## 166 1166 15 0 0 3 7.9255452 13
## 217 1217 18 1 2 1 16.2051826 26
## 1314 2314 15 0 2 3 3.6243609 15
## 2120 3120 18 1 0 2 18.0449125 12
## 588 1588 17 0 3 1 14.2664346 25
## 1599 2599 18 1 0 0 18.9546561 0
## 141 1141 18 1 0 0 0.7858389 2
## 722 1722 17 1 0 1 9.8090882 1
## 153 1153 15 1 0 3 3.7827739 22
## 294 1294 16 0 0 1 6.6828604 6
## 277 1277 15 0 2 3 5.3574717 23
## 1487 2487 17 1 1 1 0.7122430 24
## 41 1041 17 1 3 2 11.3149461 23
## 2138 3138 18 0 0 0 7.3569436 22
## 316 1316 18 1 0 0 7.9458259 15
## 1183 2183 18 0 2 3 1.0337136 20
## 752 1752 15 0 1 1 17.2698290 5
## Tutoring ParentalSupport Extracurricular Sports Music Volunteering
## 2227 0 2 0 1 0 0
## 526 0 3 0 1 0 1
## 195 1 1 1 0 1 0
## 1842 1 2 1 0 0 0
## 1142 0 3 0 0 1 0
## 1253 0 2 0 0 1 0
## 1268 0 3 0 0 0 0
## 1038 0 3 0 1 1 1
## 665 0 1 1 1 1 0
## 1627 1 2 1 0 0 0
## 1011 0 1 0 1 1 0
## 1115 0 1 0 1 0 0
## 953 1 0 1 1 0 0
## 348 0 3 1 0 1 0
## 1017 0 3 0 0 0 0
## 2013 0 4 0 1 0 0
## 1379 0 2 1 0 0 0
## 2074 0 3 0 0 0 0
## 1450 1 0 0 1 0 1
## 1673 0 4 1 0 0 0
## 1790 0 3 1 0 0 0
## 211 0 2 0 0 1 0
## 1614 0 3 1 0 0 0
## 555 1 1 0 1 0 0
## 1895 0 2 0 1 0 0
## 373 0 0 0 0 0 0
## 1167 1 0 0 0 0 0
## 1799 0 2 0 0 0 0
## 905 1 2 0 0 1 0
## 1866 1 0 0 0 1 0
## 1047 0 3 0 1 0 0
## 309 0 1 1 0 0 0
## 1248 0 2 0 0 0 0
## 166 0 2 0 1 0 0
## 217 1 2 1 0 0 0
## 1314 1 4 0 0 1 0
## 2120 0 0 0 1 0 0
## 588 0 3 1 1 0 0
## 1599 0 1 1 0 1 0
## 141 0 3 1 0 0 0
## 722 0 2 0 0 0 0
## 153 0 4 1 0 0 1
## 294 1 0 0 0 0 1
## 277 0 0 1 1 0 0
## 1487 1 2 1 0 0 0
## 41 1 1 0 0 0 0
## 2138 1 4 0 0 0 0
## 316 1 0 0 1 0 0
## 1183 0 3 0 1 0 0
## 752 0 0 0 0 0 0
## GPA GradeClass
## 2227 0.7634720 2
## 526 2.4953124 3
## 195 2.7511458 2
## 1842 1.5136604 4
## 1142 3.3505920 1
## 1253 1.1509661 4
## 1268 1.1674254 4
## 1038 1.7560355 4
## 665 0.5329232 4
## 1627 0.5742780 4
## 1011 0.8165507 4
## 1115 2.1105838 3
## 953 1.1799034 4
## 348 3.1071356 1
## 1017 1.9400069 4
## 2013 2.2159442 3
## 1379 1.3027120 4
## 2074 1.7890368 4
## 1450 2.0297366 3
## 1673 1.6224646 4
## 1790 0.9430459 4
## 211 2.8393132 2
## 1614 3.0128975 1
## 555 3.0170633 1
## 1895 2.3696523 3
## 373 2.2238137 3
## 1167 2.6440599 2
## 1799 1.1544100 4
## 905 2.6162917 2
## 1866 1.2615877 4
## 1047 1.5563290 4
## 309 0.3222861 4
## 1248 0.1126351 4
## 166 1.6244868 4
## 217 1.2870134 4
## 1314 2.1977767 3
## 2120 1.7831075 4
## 588 1.2993555 4
## 1599 3.4785197 1
## 141 3.1394815 1
## 722 3.1522223 1
## 153 1.1199113 4
## 294 2.5465166 2
## 277 0.9123305 4
## 1487 0.9722477 4
## 41 1.0582874 4
## 2138 1.4460524 4
## 316 1.2534519 4
## 1183 0.9063537 4
## 752 2.3706116 3
## 'data.frame': 50 obs. of 15 variables:
## $ StudentID : int 3227 1526 1195 2842 2142 2253 2268 2038 1665 2627 ...
## $ Age : int 17 17 17 16 15 18 18 17 15 15 ...
## $ Gender : int 0 0 1 1 1 1 0 1 0 0 ...
## $ Ethnicity : int 0 2 0 3 0 2 3 1 1 0 ...
## $ ParentalEducation: int 1 3 0 1 2 2 4 2 2 0 ...
## $ StudyTimeWeekly : num 11.2 15 13.5 16.3 14.9 ...
## $ Absences : int 28 11 11 24 5 19 17 17 26 26 ...
## $ Tutoring : int 0 0 1 1 0 0 0 0 0 1 ...
## $ ParentalSupport : int 2 3 1 2 3 2 3 3 1 2 ...
## $ Extracurricular : int 0 0 1 1 0 0 0 0 1 1 ...
## $ Sports : int 1 1 0 0 0 0 0 1 1 0 ...
## $ Music : int 0 0 1 0 1 1 0 1 1 0 ...
## $ Volunteering : int 0 1 0 0 0 0 0 1 0 0 ...
## $ GPA : num 0.763 2.495 2.751 1.514 3.351 ...
## $ GradeClass : int 2 3 2 4 1 4 4 4 4 4 ...
## StudyTimeWeekly Absences GPA
## Min. : 0.2305 Min. : 0.00 Min. :0.1126
## 1st Qu.: 6.1984 1st Qu.: 8.75 1st Qu.:1.1518
## Median : 9.1982 Median :15.50 Median :1.6235
## Mean : 9.8810 Mean :15.46 Mean :1.7758
## 3rd Qu.:14.4958 3rd Qu.:23.00 3rd Qu.:2.4641
## Max. :19.3888 Max. :28.00 Max. :3.4785
Dari output di atas:
par(mfrow = c(1, 2))
plot(data$StudyTimeWeekly, data$GPA,
main = "Scatter Plot StudyTimeWeekly vs GPA",
xlab = "StudyTimeWeekly",
ylab = "GPA",
pch = 19,
col = "green3")
plot(data$Absences, data$GPA,
main = "Scatter Plot Absences vs GPA",
xlab = "Absences",
ylab = "GPA",
pch = 19,
col = "red")Interpretasi:
##
## Call:
## lm(formula = GPA ~ StudyTimeWeekly + Absences, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.62739 -0.17873 0.03617 0.15417 0.58042
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.911510 0.119009 24.465 < 2e-16 ***
## StudyTimeWeekly 0.032243 0.007538 4.278 9.19e-05 ***
## Absences -0.094068 0.004993 -18.841 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2899 on 47 degrees of freedom
## Multiple R-squared: 0.8924, Adjusted R-squared: 0.8878
## F-statistic: 194.9 on 2 and 47 DF, p-value: < 2.2e-16
## (Intercept) StudyTimeWeekly Absences
## 2.91150972 0.03224318 -0.09406754
Persamaan regresi yang terbentuk:
\[{GPA} = 2.9115 + 0.0322 \cdot StudyTimeWeekly - 0.0941 \cdot Absences\]
Interpretasi koefisien:
Berdasarkan output summary(model):
| Variabel | t value | p-value | Keterangan |
|---|---|---|---|
| Intercept | 24,465 | < 2e-16 | Signifikan *** |
| StudyTimeWeekly | 4,278 | 9,19e-05 | Signifikan *** |
| Absences | -18,841 | < 2e-16 | Signifikan *** |
## Analysis of Variance Table
##
## Response: GPA
## Df Sum Sq Mean Sq F value Pr(>F)
## StudyTimeWeekly 1 2.9257 2.9257 34.807 3.816e-07 ***
## Absences 1 29.8370 29.8370 354.976 < 2.2e-16 ***
## Residuals 47 3.9505 0.0841
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Shapiro-Wilk normality test
##
## data: residuals(model)
## W = 0.97717, p-value = 0.4398
##
## studentized Breusch-Pagan test
##
## data: model
## BP = 1.09, df = 2, p-value = 0.5798
## lag Autocorrelation D-W Statistic p-value
## 1 0.04108674 1.814245 0.426
## Alternative hypothesis: rho != 0
Berdasarkan hasil analisis regresi linear berganda, dapat disimpulkan:
Model regresi yang terbentuk adalah \(\hat{GPA} = 2.9115 + 0.0322 \cdot StudyTimeWeekly - 0.0941 \cdot Absences\)
Uji t: Secara parsial, baik
StudyTimeWeekly maupun Absences berpengaruh
signifikan terhadap GPA
Uji F: Secara simultan, kedua variabel bersama-sama berpengaruh signifikan terhadap GPA
R-squared = 0,8924: Model mampu menjelaskan 89,24% variasi GPA — model sangat baik
Uji asumsi klasik: Seluruh asumsi terpenuhi (normalitas, homoskedastisitas, non-autokorelasi, non-multikolinearitas), sehingga model memenuhi syarat BLUE
Absensi adalah faktor paling dominan — setiap tambah 1 kali absen, GPA turun 0,094 poin. Menjaga kehadiran di kelas merupakan kunci utama untuk meningkatkan prestasi akademik
Analisis ini dibuat menggunakan R versi 4.4.1 dan RStudio