Project2 DATA101

Author

Nathan Pak

Introduction

Did the average SAT math scores significantly change over time? As learning opportunities and methods improve over time, some may question if these difference in resources have any correlation to test score differences. And for a standardized test like the SAT, it is more reasonable to test this theory with this type of test over for different time periods.

The National Center for Education Statistics has gathered data of public schools in every state over the country, which include SAT scores. The CORGIS Dataset Project then used this data to form a dataset, including around 500 rows (academic data on each state over 10 years) that include 99 columns of different variables ranging from SAT math scores, GPA, gender, etc. Of these columns, I still be using 2 variables, the SAT math scores and year. Although the year column is quantitative like the SAT math scores column, I will be converting it to categorical through using it as 2 categorys of time to compare the SAT math scores from both time periods.

Dataset: https://corgis-edu.github.io/corgis/csv/school_scores/

Data Analysis

For this analysis, I will be using the data from all the states in the years 2005 and 2015 to conduct a difference of means paired t-test.

Loading libraries tidyverse for ggplot2 visualization and t-test, and storing csv dataset.

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.1     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.3     ✔ tibble    3.3.1
✔ lubridate 1.9.5     ✔ tidyr     1.3.2
✔ purrr     1.2.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
school_scores_raw <- read.csv("school_scores.csv", stringsAsFactors = FALSE)

Cleaning dataset using dplyr functions, filtering NA and 0 values, isolating the specific years, and joining them together.

school_scores_2005 <- school_scores_raw |>
  filter(Year == 2005) |>
  select(State.Code, Math_2005 = Total.Math) |>
  filter(!is.na(Math_2005) & Math_2005 != 0)

school_scores_2015 <- school_scores_raw |>
  filter(Year == 2015) |>
  select(State.Code, Math_2015 = Total.Math) |>
  filter(!is.na(Math_2015) & Math_2015 != 0)

#inner_join() from dplyr.tidyverse.org referenced in Data Wrangling Materials Slides
school_scores_paired <- inner_join(school_scores_2005, school_scores_2015, by = "State.Code") |>
  mutate(Math_Difference = Math_2015 - Math_2005)

For visualization I will directly use the difference in means of SAT math scores in every state in the selected years into a boxplot, to more efficiently visualize the difference that will be used in statistical analysis later.

ggplot(school_scores_paired, aes(x = "", y = Math_Difference)) +
  geom_boxplot(fill = "steelblue", alpha = 0.6, width = 0.4) +
  theme_minimal() +
  labs(
    title = "10 Year Change in State SAT Math Scores (2005 to 2015)",
    y = "Math Score Difference",
    x = "",
  )

The boxplot shows a very small mean difference, as it is very slightly below 0, but the 25th and 75th percentiles are basically symmetrical across the line at y=0, disregarding the 2 outliers. This suggests that the mean difference is not significant, but the t-test will prove if this statement is true or not.

Statistical Analysis

The hypothesis as stated in the previous section will involve the difference in means (t-test) in the 2005 and 2015 time periods, specifically:

H0: μd = 0

HA: μd =/= 0

The null hypothesis will be that the mean difference in SAT math scores between 2015 and 2005 is 0. The alternate hypothesis will be that the mean difference in SAT math scores between 2015 and 2005 is not 0.

t.test(school_scores_paired$Math_2015, school_scores_paired$Math_2005, paired = TRUE)

    Paired t-test

data:  school_scores_paired$Math_2015 and school_scores_paired$Math_2005
t = -0.68392, df = 51, p-value = 0.4971
alternative hypothesis: true mean difference is not equal to 0
95 percent confidence interval:
 -7.568055  3.721901
sample estimates:
mean difference 
      -1.923077 

The results of the paired t-test is first of all, that the p-value is 0.4971. This is important because this right away means that the p-value is very much larger than 0.05, so it fails to reject the null hypothesis because the change is not statistically significant even though there is a very slight -0.68392 t-statistic.

Conclusion

From both the boxplot visualization and the t-test results, it is clear that there is not a significant difference of SAT math scores across the 2 time periods, and thus following the null hypothesis. This means that despite the advancement and growth of student learning, the average SAT scores did not significantly change. There could be multiple potential reasons for this, as before SAT tests were not as popular so when SAT tests became more encouraged by college and universities, it shaped student culture to take the SAT tests. These can lower the overall average because it goes from students who specifically choose to take it to more students taking it because college and universities require it in later years, which can drag down the average. Future analysis can choose areas that do not require SAT testing to have a more consistent selection of students as a decade earlier when it was not required.

References

Dataset: CORGIS Dataset Project. (2016). School Scores CSV File [Data Set]. https://corgis-edu.github.io/corgis/csv/school_scores/

dplyr.tidyverse.org: https://dplyr.tidyverse.org/reference/index.html#section-one-table-verbs