set.seed(23102) # for reproducibility/ group 3 + IT 3102N
n = 100
data = data.frame(
YearLevel = factor(sample(c("1st","2nd","3rd","4th"), n, replace=TRUE)),
Sex = factor(sample(c("Male","Female"), n, replace=TRUE)),
MES = round(rnorm(n, 75, 8), 0),
FES = round(rnorm(n, 80, 5), 0)
)
library(kableExtra)
kable(head(data), caption = "First 6 Rows of the Data")
| YearLevel | Sex | MES | FES |
|---|---|---|---|
| 1st | Male | 76 | 82 |
| 2nd | Female | 64 | 88 |
| 1st | Male | 64 | 83 |
| 2nd | Female | 74 | 81 |
| 1st | Male | 64 | 77 |
| 3rd | Female | 69 | 81 |
hist(data$MES, main="Distribution of Midterm Exam Scores",
xlab="Midterm Exam Score", col="lightblue", breaks=10)
hist(data$FES, main="Distribution of Final Exam Scores",
xlab="Final Exam Score", col="lightgreen", breaks=10)
boxplot(data$MES, data$FES,
names=c("Midterm","Final"),
main="Comparison of Midterm and Final Exam Scores",
col=c("lightblue","lightgreen"))
library(pastecs)
data1 <- data[, c("MES", "FES")]
colnames(data1) <- c("Midterm Exam Score", "Final Exam Score")
stat_table <- round(stat.desc(data1, basic = TRUE, desc = TRUE), 2)
kable(stat_table, caption = "Descriptive Summary of Exam Scores")
| Midterm Exam Score | Final Exam Score | |
|---|---|---|
| nbr.val | 100.00 | 100.00 |
| nbr.null | 0.00 | 0.00 |
| nbr.na | 0.00 | 0.00 |
| min | 54.00 | 70.00 |
| max | 96.00 | 96.00 |
| range | 42.00 | 26.00 |
| sum | 7513.00 | 8083.00 |
| median | 74.00 | 80.00 |
| mean | 75.13 | 80.83 |
| SE.mean | 0.76 | 0.49 |
| CI.mean.0.95 | 1.51 | 0.97 |
| var | 57.61 | 23.74 |
| std.dev | 7.59 | 4.87 |
| coef.var | 0.10 | 0.06 |
The mean Midterm Exam Score is approximately 75, while the mean Final Exam Score is approximately 81. Final Exam Scores show lower variability compared to Midterm Exam Scores, as indicated by a smaller standard deviation. This suggests that student performance was more consistent in the final exam.
The histogram of Midterm Exam Scores shows a roughly normal distribution centered around the mid-70s. Final Exam Scores are centered higher, around the low 80s. The boxplot confirms that final exam scores are generally higher and less spread out than midterm scores.