library(dplyr)
library(ggplot2)

# Read dataset
df <- read.csv("StudentsPerformance.csv", stringsAsFactors = FALSE)

# Clean up column names
df <- df |> rename_with(~ gsub(" ", "_", .x, fixed = TRUE))

Student Exam Performances

Introduction

This data set includes math, writing and reading scores from 1000 high school students. By examining the influence of various factors including gender, race, parental level of education, lunch type, and participation in test preparation courses; this study explores patterns and correlations in student test scores.

Dataset

# 1) Histogram — Math scores  (bar-type)
ggplot(df, aes(x = `math.score`)) + geom_histogram(binwidth = 5, color = "black", fill = "white") + labs(title = "Distribution of Math Scores", x = "Math Score", y = "Count") + theme_minimal()

Interpretation: Math Scores vary with a majority scoring between 60-80.

# 2) Boxplot — Writing scores
ggplot(df, aes( x= gender, y = `writing.score`, fill=gender)) +geom_boxplot() + labs(title = "Writing Scores by Gender", x= "Gender", y = "Writing Score") + theme_minimal()

#Interpretation: Writing scores do not show a significant variation, although female students scored higher generally.

# 3) Scatter — Reading vs Writing (with trend line)
ggplot(df, aes(x = `reading.score`, y = `writing.score`)) + geom_point(alpha = 0.6) + geom_smooth(method = "lm", se = FALSE) + labs(title = "Reading vs. Writing Scores", x = "Reading Score", y = "Writing Score") + theme_minimal()

#Interpretation: Reading and writing scores are positively correlated.

# 4) Density — Reading score by gender (overlapping densities)
ggplot(df, aes(x = `reading.score`, fill = gender)) + geom_density(alpha = 0.35) + labs(title = "Reading Score Density by Gender", x = "Reading Score", y = "Density") + theme_minimal()

#Interpretation: Both genders show similar reading scores with female students scoring slightly higher overall.

# 5) Violin — Math score by lunch type
ggplot(df, aes(x = lunch, y = `math.score`)) + geom_violin(trim = FALSE, fill = "white") + labs(title = "Math Score Distribution by Lunch Type", x = "Lunch Type", y = "Math Score") + theme_minimal()

#Interpretation: Students that receive standard lunches scored slightly higher in math.

Conclusion

This report shows student performance variances across math, reading and writing scores. While there are some minor differences across factors like demographics, gender and lunch type;(noted in female reading and writing scores and standard versus free lunch type), the influence is minimal and plays a minor role in performance. The evidence shows that students who perform well in one subject tend to perform well in others. Overall, this analysis highlights the importance of individual effort in creating academic success.