DAM 5 Massachusetts

Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

1 + 1
[1] 2

You can add options to executable code like this

[1] 4

The echo: false option disables the printing of code (only output is displayed).
## Task 1

library(tidyverse) 
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.3     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.0
✔ ggplot2   3.4.3     ✔ tibble    3.2.1
✔ lubridate 1.9.2     ✔ tidyr     1.3.0
✔ purrr     1.0.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
library(readxl) 
library(kableExtra)

Attaching package: 'kableExtra'

The following object is masked from 'package:dplyr':

    group_rows
data1 <- read_excel("NDECoreExcel_Mathematics, Grade 8, All students_20231205000940.Xls", range = "A9:E31")

data1
# A tibble: 22 × 5
    Year Jurisdiction  `All students` `Average scale score` `Standard deviation`
   <dbl> <chr>         <chr>                          <dbl>                <dbl>
 1  2022 National      All students                    274.                 38.9
 2  2022 Massachusetts All students                    284.                 40.1
 3  2019 National      All students                    282.                 39.7
 4  2019 Massachusetts All students                    294.                 41.5
 5  2017 National      All students                    283.                 38.8
 6  2017 Massachusetts All students                    297.                 39.3
 7  2015 National      All students                    282.                 36.9
 8  2015 Massachusetts All students                    297.                 39.3
 9  2013 National      All students                    285.                 36.5
10  2013 Massachusetts All students                    301.                 36.1
# ℹ 12 more rows

Task 2

# Task 2
data1 |>
  arrange(data1, Year) |> # arrange by year 
  kable(digits = 0) |> # set to zero decimal places
  kable_styling()
Year Jurisdiction All students Average scale score Standard deviation
2000 Massachusetts All students 279 36
2000 National All students 273 38
2003 Massachusetts All students 287 35
2003 National All students 278 36
2005 Massachusetts All students 292 35
2005 National All students 279 36
2007 Massachusetts All students 298 35
2007 National All students 281 36
2009 Massachusetts All students 299 36
2009 National All students 283 36
2011 Massachusetts All students 299 34
2011 National All students 284 36
2013 Massachusetts All students 301 36
2013 National All students 285 37
2015 Massachusetts All students 297 39
2015 National All students 282 37
2017 Massachusetts All students 297 39
2017 National All students 283 39
2019 Massachusetts All students 294 42
2019 National All students 282 40
2022 Massachusetts All students 284 40
2022 National All students 274 39

Task 3

ggplot(data = data1, aes(x = Year, y = `Average scale score`)) +
  geom_line(aes(color = Jurisdiction)) +
  ylim(260,310)

Task 4

cutscores<- read_excel("NDECoreExcel_Mathematics, Grade 8, All students_20231205000940.Xls", range = "H10:I13")

ggplot(data = data1, aes(x = Year, y = `Average scale score`, color = Jurisdiction)) +
  geom_line() +
  ylim(260, 340) +
  scale_color_manual(values = c("Massachusetts" = "darkturquoise", "National" = "red")) +
  geom_hline(data = cutscores, aes(yintercept = 262), linetype = "dashed", color = "green",) +
  geom_hline(data = cutscores, aes(yintercept = 299), linetype = "dashed", color = "purple") +
  geom_hline(data = cutscores, aes(yintercept = 333), linetype = "dashed", color = "orange") +
  labs(title = " Trend in Grade 8 Mathematics Average Scores", subtitle = "2000 - 2022", x = "Year", y = "Average Scale Score",)+
  theme_minimal()

cutscores|>
kable("html") |>
  row_spec(row = which(cutscores$Level == "Basic"),
    background = "green")|>
  row_spec(row = which(cutscores$Level == "Proficient"),
    background = "purple")|>
  row_spec(row = which(cutscores$Level == "Advanced"),
    background = "orange")
cut_scores Level
262 Basic
299 Proficient
333 Advanced

The Nation trend of average math scores for grade 8 increased slightly between 2000 and 2013, then declined until 2022. The average score in 2022 was one point higher than the average score in 2000. Within the 22 years the range of National average scores was about 10 points. The Massachusetts trend of average math scores for grade 8 increased at a higher rate than the National averages from 2000 to 2013. After 2013, the average score went down slightly in Massachusetts and then went down more drastically after 2019. In 2022 the average score in Massachusetts was about 4 points higher than in 2000. Within the 22 years the range of scores was about 21 points. The Massachusetts trend is much higher than the National trend as it is closer to the Proficient cut score. Massachusetts lowest average is similar to where the National average peaks.

Task 5

data2 <- data1 |> 
  filter(Year == 2022) |> 
  mutate(MA_Nat_SD = ((`Average scale score`[2] - `Average scale score`[1]) / `Standard deviation`[1] )) 

round(data2$MA_Nat_SD[1], 2) 
[1] 0.24

In 2022, the average score of eighth-grade students in Massachusetts was 284, significantly higher than the average score of 274 for students in the nation’s public schools. This difference was 0.24 of a standard deviation of the distribution of NAEP scores in 8th grade mathematics nationally.

Task 6

# Find the difference between Illinois in 2000 and 2019 and divide by SD for 2022
data3 <- data1 |>
  filter(Jurisdiction == "Massachusetts") |> # Select MA data only
  filter(Year == 2022 | Year == 2019 |  Year == 2000) |> # Select the years 2000, 2019, and 2022
  mutate(MA_DiffSince2022_SD = ((`Average scale score` - `Average scale score`[1]) / `Standard deviation`[1] ))
# Note that while the average for both 2000 and 2022 are 275,
# they are trivially different: 274.5487 in 2000 and 275.1951
# The important difference in SD is between 2019 and the other two years here
round(data3$MA_DiffSince2022_SD[2], 2) # Round the difference between 2019 and 2022 to two decimal places
[1] 0.27

The average score for students in Massachusetts in 2022 (284) was lower than their average score in 2019 (294) by 0.27 of a standard deviation. In 2022 (284) Massachusetts’ average score was 0.12 of a standard deviation higher from their average score in 2000 (279).

Task 7

Task7 <- read_excel("NDECoreExcel_Mathematics, Grade 8, National School Lunch Progra_20231205215903.Xls", range = "A9:E45")
Task7 <- Task7|>
  filter(`National School Lunch Program eligibility, 3 categories` !=  "Information not available")|> 
  filter(Year != "2000¹")|>
  mutate(`Average scale score`= as.numeric(`Average scale score`),`Standard deviation`= as.numeric(`Standard deviation`))|>
  arrange(Year) |> # arrange by year 
  rename('National School Lunch Program Eligibility'= 'National School Lunch Program eligibility, 3 categories')

Task7 |> 
  kable(digits = 0) |> 
  kable_styling()
Year Jurisdiction National School Lunch Program Eligibility Average scale score Standard deviation
2000 Massachusetts Eligible 257 33
2000 Massachusetts Not eligible 286 33
2003 Massachusetts Eligible 261 34
2003 Massachusetts Not eligible 295 31
2005 Massachusetts Eligible 273 34
2005 Massachusetts Not eligible 299 33
2007 Massachusetts Eligible 275 34
2007 Massachusetts Not eligible 306 31
2009 Massachusetts Eligible 278 36
2009 Massachusetts Not eligible 307 33
2011 Massachusetts Eligible 280 33
2011 Massachusetts Not eligible 308 31
2013 Massachusetts Eligible 281 35
2013 Massachusetts Not eligible 313 31
2015 Massachusetts Eligible 279 38
2015 Massachusetts Not eligible 311 34
2017 Massachusetts Eligible 278 36
2017 Massachusetts Not eligible 305 37
2019 Massachusetts Eligible 272 40
2019 Massachusetts Not eligible 303 39
2022 Massachusetts Eligible 263 35
2022 Massachusetts Not eligible 298 37

Task 8

ggplot(data = Task7, aes(x = Year, y = `Average scale score`, color = `National School Lunch Program Eligibility`, group = `National School Lunch Program Eligibility`)) +
  geom_line() +
  ylim(250, 340) +
  scale_color_manual(values = c("Eligible" = "blue", "Not eligible" = "brown")) +
  geom_hline(data = cutscores, aes(yintercept = 262), linetype = "dashed", color = "green",) +
  geom_hline(data = cutscores, aes(yintercept = 299), linetype = "dashed", color = "purple") +
  geom_hline(data = cutscores, aes(yintercept = 333), linetype = "dashed", color = "orange") +
  labs(title = " Trend in Grade 8 Mathematics Average Scores in Massachusetts based on NSLP Eligibility", subtitle = "2000 - 2022", x = "Year", y = "Average Scale Score")+
  theme_minimal()

cutscores|>
kable("html") |>
  row_spec(row = which(cutscores$Level == "Basic"),
    background = "green")|>
  row_spec(row = which(cutscores$Level == "Proficient"),
    background = "purple")|>
  row_spec(row = which(cutscores$Level == "Advanced"),
    background = "orange")
cut_scores Level
262 Basic
299 Proficient
333 Advanced

Task 9

In 2022, students who were eligible for the National School Lunch Program (NSLP) had an average score that was 35 points lower than that for students who were not eligible. 2022 had the greatest difference in average scores of the graph. In 2000 the difference in average scores was smaller with a gap of 29 points. I also noticed that the gap between 2022 and 2019 increased going from 31 points in 2019 just prior the pandemic to 35 points in 2022.

Task 10

Task10 <- read_excel("NDECoreExcel_Mathematics, Grade 8, Disability status of student_20231205233137.Xls", range = "A9:E15")
Task10 <- Task10 |>
  arrange(Year) |>
  mutate(SPED_DiffSince2000_SD = ((`Average scale score` - `Average scale score`[2]) / `Standard deviation`[2] ))  
Task10 |>   
  kable(digits = 1) |> # set to one decimal place
  kable_styling()
Year Jurisdiction Disability status of student, including those with 504 plan Average scale score Standard deviation SPED_DiffSince2000_SD
2000 Massachusetts Identified as students with disabilities 243.2 34.8 -1.3
2000 Massachusetts Not identified as students with disabilities 285.3 31.8 0.0
2019 Massachusetts Identified as students with disabilities 260.4 39.0 -0.8
2019 Massachusetts Not identified as students with disabilities 301.7 38.3 0.5
2022 Massachusetts Identified as students with disabilities 253.5 36.0 -1.0
2022 Massachusetts Not identified as students with disabilities 290.9 37.5 0.2

Task 11

In 2022, average scores for those who identified as students with a disability were 37.4 points or 1.2 standard deviations lower than average scores for those not identified as students with a disability. This gap is smaller than the gap of 42.1 points (1.3 SD) in 2000 and 41.3 points (1.3 SD) in 2019.

Task 12

## Task 12
Task12 <- read_excel("NDECoreExcel_Mathematics, Grade 8, Status as English learner, 2_20231205233712.Xls", 
                     range = "A9:E11") 

# Print this dataset
Task12 |>   
  kable(digits = 0) |> # set to one decimal places
  kable_styling()
Year Jurisdiction Status as English learner, 2 categories Average scale score Standard deviation
2022 Massachusetts ELL 227 28
2022 Massachusetts Not ELL 287 38
# Calculate gap in standard deviation units (Not ELL SD as baseline)
gapELL <- ((Task12$`Average scale score`[1] - Task12$`Average scale score`[2]) / Task12$`Standard deviation`[2])
gapELL
[1] -1.560299

Task 13

In 2022, average scores for those who identified as English learners were 59.6 points or 1.6 standard deviation lower than average scores for those not identified as English learners.