Memuat
Memuat
Multiple Linear Regression with Classical Assumption Tests for Education and Learning
0 views
Testing the effect of weekly independent study and attendance rate on mathematics exam score while checking the classical regression assumptions (the analysis is illustrated with synthetic data). Multiple linear regression models the effect of several predictors on one numeric response using ordinary least squares (OLS), together with the classical assumption tests. It is the most common method in undergraduate and master's theses for testing partial (t-test) and joint (F-test) effects.

Testing the effect of weekly independent study and attendance rate on mathematics exam score while checking the classical regression assumptions (the analysis is illustrated with synthetic data).
| Role | Variable | Unit |
|---|---|---|
| Main | Mathematics exam score | score |
| Supporting 1 | Weekly independent study | hours |
| Supporting 2 | Attendance rate | % |
The model explains 83.1% of the variance in Mathematics exam score (R2 = 0.831, F-test p < 0.001). A one-unit increase in Weekly independent study changes Mathematics exam score by 1.113 (p < 0.001). Shapiro-Wilk (p = 0.020) and Breusch-Pagan (p = 0.016) flag an assumption worth checking; maximum VIF is 1.01.
Computed from illustrative synthetic data, not from a real study.
Multiple linear regression models the effect of several predictors on one numeric response using ordinary least squares (OLS), together with the classical assumption tests. It is the most common method in undergraduate and master's theses for testing partial (t-test) and joint (F-test) effects.
Report the regression equation, the sign and size of each coefficient with its t-test p-value, the F-test and adjusted R2. Include the classical assumption tests; if one fails, consider a transformation or robust standard errors.
A short starting script with this project's variable names. The delivered version is adapted to your data and fully commented.
# Contoh kode R: Multiple Linear Regression with Classical Assumption Tests
suppressPackageStartupMessages({
library(ggplot2)
library(patchwork)
library(lmtest)
library(car)
})
set.seed(42)
# ---- Gaya grafik ----
pal <- c("#1f6feb", "#e8590c", "#2f9e44", "#ae3ec9", "#f59f00")
warna <- list(bg = "#f4f6fa", panel = "#ffffff", teks = "#1f2933", redup = "#5f6b78", grid = "#e3e8ee", bar = "#1d3557")
tata <- 1
theme_set(theme_minimal(base_size = 11) + theme(legend.position = "bottom"))
# ---- Data sintetis ----
n <- 200
d <- data.frame(weekly_independent_study = rnorm(n, 50, 10),
attendance_rate = rnorm(n, 30, 6))
z1 <- as.numeric(scale(d$weekly_independent_study))
z2 <- as.numeric(scale(d$attendance_rate))
b1 <- runif(1, 0.45, 0.85)
b2 <- runif(1, 0.15, 0.5) * sample(c(-1, 1), 1)
d$mathematics_exam_score <- 100 + 15 * (b1 * z1 + b2 * z2 + rnorm(n, 0, runif(1, 0.45, 0.8)))
write.csv(d, "data_contoh.csv", row.names = FALSE)
# ---- Analisis: regresi linear berganda (OLS) ----
fit <- lm(mathematics_exam_score ~ weekly_independent_study + attendance_rate, data = d)
s <- summary(fit)
print(s)
# ---- Uji asumsi klasik ----
sw <- shapiro.test(residuals(fit)) # normalitas residual
bp <- lmtest::bptest(fit) # heteroskedastisitas (Breusch-Pagan)
dw <- lmtest::dwtest(fit) # autokorelasi (Durbin-Watson)
vf <- car::vif(fit) # multikolinearitas
print(sw); print(bp); print(dw); print(vf)
# ---- Grafik ----
d$prediksi <- fitted(fit)
d$residual <- residuals(fit)
p1 <- ggplot(d, aes(weekly_independent_study, mathematics_exam_score)) +
geom_point(colour = pal[1], alpha = 0.55, size = 1.8) +
geom_smooth(method = "lm", formula = y ~ x, colour = pal[2], fill = pal[2], alpha = 0.18, linewidth = 1.1) +
labs(title = "Partial relationship with OLS fit", x = "weekly_independent_study", y = "mathematics_exam_score")
p2 <- ggplot(d, aes(prediksi, residual)) +
geom_hline(yintercept = 0, linetype = "dashed", colour = warna$redup) +
geom_point(colour = pal[3], alpha = 0.6, size = 1.5) +
geom_smooth(method = "loess", formula = y ~ x, se = FALSE, colour = pal[2], linewidth = 0.8) +
labs(title = "Residuals vs fitted", x = "Fitted value", y = "Residual")
p3 <- ggplot(d, aes(sample = residual)) +
stat_qq(colour = pal[1], alpha = 0.6, size = 1.3) +
stat_qq_line(colour = pal[2], linewidth = 0.9) +
labs(title = "Normal Q-Q of residuals", x = "Theoretical quantile", y = "Sample quantile")
p_hasil <- if (tata == 1) p1 | (p2 / p3) else p1 / (p2 | p3)
print(p_hasil)
The original project file is available. It is not just the picture above: you get the working R project. It can be downloaded after payment, and we send it by WhatsApp or email.
ZIP: analisis.R + data_contoh.csv + BACA-DULU.txt
Choose how much help you need. Each higher package includes everything in the lower ones. Prices exclude 11% VAT.
Package 1
US$16
excl. 11% VAT
Duration: 3 working days
Output: R files + result figures
Deliverables
Package 2 · most chosen
US$47
excl. 11% VAT
Duration: 7 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$106
excl. 11% VAT
Duration: 12-15 working days
Output: Code + analysis + guidance until ready to present
Includes all of Packages 1 & 2, plus
Yes. The original project file is a ZIP containing the complete analisis.R script, a data_contoh.csv sample dataset and a BACA-DULU.txt guide. It can be downloaded after payment, and we send it by WhatsApp or email. For your own data (Package 2 and 3) the script is adapted to your dataset.
Yes. Multiple Linear Regression with Classical Assumption Tests is commonly used at this level in Education and Learning. We adapt the analysis to your research question, your own data and your supervisor's requirements.
No. The sheet is computed from illustrative synthetic data so you can see the kind of output R Studio gives. For your order we run the same method on your own data.
That is the point of the packages. Every script is commented, and Package 3 includes two coaching sessions plus practice questions so you can explain the method and the results at your seminar and defence.
Each project has three packages: Package 1 (code and explanation) US$16, Package 2 (your data analysis and interpretation) US$47 and Package 3 (full guidance) US$106, excluding 11% VAT. Larger datasets, extra methods or tight deadlines adjust the quote after a short consultation.
The result sheet uses illustrative synthetic data. R is a programming language of the R Foundation project; RStudio and Posit are trademarks of Posit PBC.
Back to R Studio portfolio