── 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.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ 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.csv("/Users/anweshanadhikari/Downloads/NDECoreExcel_Mathematics, Grade 8, All students_20231202012416.csv")data1
Year Jurisdiction All.students Average.scale.score Standard.deviation
1 2022 National public All students 273 39
2 2022 California All students 270 42
3 2019 National public All students 281 40
4 2019 California All students 276 42
5 2017 National public All students 282 39
6 2017 California All students 277 41
7 2015 National public All students 281 37
8 2015 California All students 275 38
9 2013 National public All students 284 36
10 2013 California All students 276 38
11 2011 National public All students 283 36
12 2011 California All students 273 39
13 2009 National public All students 282 36
14 2009 California All students 270 39
15 2007 National public All students 280 36
16 2007 California All students 270 39
17 2005 National public All students 278 36
18 2005 California All students 269 39
19 2003 National public All students 276 36
20 2003 California All students 267 39
21 2000 National public All students 272 38
22 2000 California All students 260 41
# Find the difference between National and Illinois # and divide by SD for National in 2022 (The [1] & [2] refer to row numbers)data5 <- data1 |>filter(Year ==2022) |># Select two rows of data (2022 only)mutate(Ca_Nat_SD = ((`Average.scale.score`[2] -`Average.scale.score`[1]) /`Standard.deviation`[1] )) # print difference in SD between Illinois and Nationalround(data5$Ca[1], 2) # rounded to two decimal places
[1] -0.08
In 2022, the average score of eighth-grade students in California was 270, slightly lower than the average score of 273 for students in the nation’s public schools. This difference was only -0.08 of a standard deviation of the distribution of NAEP scores in 8th grade mathematics nationally.
# Find the difference between Illinois in 2000 and 2019 and divide by SD for 2022data6 <- data1 |>filter(Jurisdiction =="California") |># Select Illinois data onlyfilter(Year ==2022| Year ==2019| Year ==2000) |># Select the years 2000, 2019, and 2022mutate(CA_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 hereround(data6$CA_DiffSince2022_SD[2], 2) # Round the difference between 2019 and 2022 to two decimal places
[1] 0.14
The average score for students in California in 2022 (270) was lower than their average score in 2019 (276) by 0.14 of a standard deviation and was higher than their average score in 2000 (260).
data7 <-read.csv("/Users/anweshanadhikari/Downloads/NDECoreExcel_Mathematics, Grade 8, National School Lunch Progra_20231202014940.csv")data7 <- data7 |>filter(`National.School.Lunch.Program.eligibility..3.categories`!="Information not available") # Convert Average and SD from characters to numbers (due to the missing data in the original data)data7$`Average.scale.score`<-as.numeric(data7$`Average.scale.score`)data7$`Standard.deviation`<-as.numeric(data7$`Standard.deviation`)# Print the data in order from 2000 to 2022data7 |>arrange(Year) |># arrange by year kable(digits =0) |># set to zero decimal placeskable_styling()
##formatting the data#converting column with two unique values to multiple columnsdata7_post <- data7 %>%mutate(NotEligible_Average.scale.score =ifelse(National.School.Lunch.Program.eligibility..3.categories =="Not eligible", Average.scale.score, NA),Eligible_Average.scale.score=ifelse(National.School.Lunch.Program.eligibility..3.categories =="Eligible", Average.scale.score, NA),NotEligible_SD =ifelse(National.School.Lunch.Program.eligibility..3.categories =="Not eligible", Standard.deviation, NA),Eligible_SD =ifelse(National.School.Lunch.Program.eligibility..3.categories =="Eligible", Standard.deviation, NA))#removing columns that are no longer necessarydata7_post <- data7_post%>%select(-c("National.School.Lunch.Program.eligibility..3.categories", "Average.scale.score", "Standard.deviation"))#merging rows with the same year, so that eligible and non-eligible data for the same year will be in a single rowdata7_new <- data7_post %>%group_by(Year) %>%summarize(NotEligible_Average.scale.score =mean(NotEligible_Average.scale.score, na.rm =TRUE),Eligible_Average.scale.score =mean(Eligible_Average.scale.score, na.rm =TRUE),NotEligible_SD =mean(NotEligible_SD, na.rm =TRUE),Eligible_SD =mean(Eligible_SD, na.rm =TRUE) ) %>%ungroup()
Task 9
ggplot(data7_new, aes(x = Year)) +geom_line(aes(y = Eligible_Average.scale.score, colour ="Eligible")) +geom_line(aes(y = NotEligible_Average.scale.score, colour ="Not Eligible")) +scale_color_manual(values =c("black", "red"), name ="NSLP Eligibility") +geom_hline(yintercept = Basic, linetype ="dashed", color ="#248f24") +geom_hline(yintercept = Proficient, linetype ="dashed", color ="#248f24") +geom_hline(yintercept = Advanced, linetype ="dashed", color ="#248f24") +annotate("text", x =max(data1$Year), y = Basic+0.5, label ="Basic", hjust =13.1, color ="#248f24") +annotate("text", x =max(data1$Year), y = Proficient+0.5, label ="Proficient", hjust =7.6, color ="#248f24") +annotate("text", x =max(data1$Year), y = Advanced+0.5, label ="Advanced", hjust =7.2, color ="#248f24") +labs(title ="Trend in Grade 8 Mathematics Average Scores by NSLP Eligibility",subtitle ="Main NAEP: 2003 - 2022",x ="Year",y ="Average Scale Score",caption ="The Horizontal lines represent Basic, Proficient, and Advanced cut scores" ) +theme_minimal()
In 2022, students who were eligible for the National School Lunch Program (NSLP) had an average score that was 36 points lower than that for students who were not eligible, though the averages for both students Eligible for NSLP and for those not eligible for NSLP were significantly higher than they were in year 2000 (240 and 269 respectively). I also noticed that this gap was of 36 points in 2019 just prior the pandemic and it remained the same post-pandemic in 2022.
data10 <-read.csv("/Users/anweshanadhikari/Downloads/NDECoreExcel_Mathematics, Grade 8, Disability status of student_20231202022835.csv")# Arrange by year: 2000, 2019, 2022# And use the 2000 scores for those not identified as students with disabilities as the baselinedata10 <- data10 |>arrange(Year) |>mutate(SPED_DiffSince2000_SD = ((`Average.scale.score`-`Average.scale.score`[2]) /`Standard.deviation`[2]))# Print this datasetdata10 |>kable(digits =1) |># set to one decimal placekable_styling()
In 2022, average scores for those who identified as students with a disability were 40 points or 1.1 standard deviation lower than average scores for those not identified as students with a disability. This gap is smaller than the gap of 51 points (-1.3 SD) in 2000 and 38 points (1.0 SD) in 2019.
## Task 12data12 <-read.csv("/Users/anweshanadhikari/Downloads/NDECoreExcel_Mathematics, Grade 8, Status as English learner, 2_20231202023922.csv")
Warning in read.table(file = file, header = header, sep = sep,
quote = quote, : incomplete final line found by readTableHeader on
'/Users/anweshanadhikari/Downloads/NDECoreExcel_Mathematics, Grade 8, Status as
English learner, 2_20231202023922.csv'
# Print this datasetdata12 |>kable(digits =0) |># set to one decimal placeskable_styling()
Year
Jurisdiction
Status.as.English.learner..2.categories
Average.scale.score
Standard.deviation
2022
California
ELL
236
31
2022
California
Not ELL
277
40
# Calculate gap in standard deviation units (Not ELL SD as baseline)gapELL <- ((data12$`Average.scale.score`[1] - data12$`Average.scale.score`[2]) / data12$`Standard.deviation`[2])gapELL
[1] -1.025
Task 13
In 2022, average scores for those who identified as English learners were 41 points or 1.025 standard deviation lower than average scores for those not identified as English learners.