NikitaDAM5

Task 1

#Load Packages
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.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
#Load in Data
data1 <- read_excel("DAM5Data.Xls", 
                    range = "A9:E31")

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 National All students 273 38
2000 New York All students 271 39
2003 National All students 278 36
2003 New York All students 280 37
2005 National All students 279 36
2005 New York All students 280 36
2007 National All students 281 36
2007 New York All students 280 36
2009 National All students 283 36
2009 New York All students 283 37
2011 National All students 284 36
2011 New York All students 280 35
2013 National All students 285 37
2013 New York All students 282 36
2015 National All students 282 37
2015 New York All students 280 37
2017 National All students 283 39
2017 New York All students 282 40
2019 National All students 282 40
2019 New York All students 280 42
2022 National All students 274 39
2022 New York All students 274 42

Task 3

ggplot(data = data1, aes(x = Year, y = `Average scale score`, group = Jurisdiction, color = Jurisdiction)) +
  geom_line() +
  ylim(270, 290) +
   labs(
    title = "Trend in Grade 8 Mathematics Average Scores (2003 - 2022) by Jurisdiction",
    subtitle = "Main NAEP: 2003 - 2022")

Task 4

#cut scores
cut_basic <- 262
cut_proficient <- 299
cut_advanced <- 333

#plotting
ggplot(data = data1, aes(x = Year, y = `Average scale score`, group = Jurisdiction, color = Jurisdiction)) +
  geom_line() +
  ylim(260, 340) +
  geom_hline(yintercept = c(262, 299, 333), linetype = c("dashed", "solid", "dashed"), color = c("red", "green", "blue")) +
  annotate("text", x = 2019, y = 262, label = "Basic", color = "red", hjust = 0, vjust = -1.4) +
  annotate("text", x = 2019, y = 299, label = "Proficient", color = "green", hjust = 0, vjust = -1.4) +
  annotate("text", x = 2019, y = 333, label = "Advanced", color = "blue", hjust = 0, vjust = -1.4) +
  labs(
    title = "Trend in Grade 8 Mathematics Average Scores (2003 - 2022) by Jurisdiction",
    subtitle = "Main NAEP: 2003 - 2022"
  ) +
  theme_minimal()

Task 5

ny_sd_22 <- 41.54839
ny_average_score <- 274.2715
national_sd_22 <- 38.88095

data5 <- data1 %>%
  filter(Year == 2022) %>%
  mutate(NY_Nat_SD = ((ny_average_score - `Average scale score`) / national_sd_22))

print(round(data5$NY_Nat_SD[1], 2))
[1] 0
data5$`Average scale score`[1]
[1] 274.2662

The national average scare score is 274.2662. The New York average scale score is 274.2715. In terms of their difference in standard deviations, it is virtually 0 because of how similar the two values are.

Task 6

# Find the difference between New York in 2000 and 2019 and divide by SD for 2022
data6 <- data1 |>
  filter(Jurisdiction == "New York") |> # Select New York data only
  filter(Year == 2022 | Year == 2019 |  Year == 2000) |> 
  mutate(NY_DiffSince2022_SD = ((`Average scale score` - `Average scale score`[1]) / `Standard deviation`[1] ))

round(data6$NY_DiffSince2022_SD[2], 2) 
[1] 0.15

The average score for students in New York in 2022 was 274, which was higher by 3 points, or 0.07 SD than in 2000 (271), but lower by 6 points (~0.15 SD) than in 2019 (280).

Task 7

data7 <- read_excel("Task7Data.xls",
                    range = "A9:E42")

data7
# A tibble: 33 × 5
    Year Jurisdiction National School Lunch Program elig…¹ `Average scale score`
   <dbl> <chr>        <chr>                                <chr>                
 1  2022 New York     Eligible                             261.87300031197702   
 2  2022 New York     Not eligible                         290.38347209508402   
 3  2022 New York     Information not available            291.38148686560299   
 4  2019 New York     Eligible                             266.42607408531802   
 5  2019 New York     Not eligible                         294.02345038334897   
 6  2019 New York     Information not available            ‡                    
 7  2017 New York     Eligible                             268.567249142121     
 8  2017 New York     Not eligible                         294.094817474911     
 9  2017 New York     Information not available            ‡                    
10  2015 New York     Eligible                             270.87559185516301   
# ℹ 23 more rows
# ℹ abbreviated name:
#   ¹​`National School Lunch Program eligibility, 3 categories`
# ℹ 1 more variable: `Standard deviation` <chr>
# Drop all rows where "Information not available"
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 2022
data7 |>
  arrange(Year) |> # arrange by year 
  kable(digits = 0) |> # set to zero decimal places
  kable_styling()
Year Jurisdiction National School Lunch Program eligibility, 3 categories Average scale score Standard deviation
2000 New York Eligible 255 39
2000 New York Not eligible 284 31
2003 New York Eligible 262 35
2003 New York Not eligible 293 31
2005 New York Eligible 267 36
2005 New York Not eligible 291 32
2007 New York Eligible 268 35
2007 New York Not eligible 292 32
2009 New York Eligible 270 37
2009 New York Not eligible 293 32
2011 New York Eligible 269 34
2011 New York Not eligible 293 32
2013 New York Eligible 269 35
2013 New York Not eligible 293 33
2015 New York Eligible 271 35
2015 New York Not eligible 292 35
2017 New York Eligible 269 38
2017 New York Not eligible 294 38
2019 New York Eligible 266 40
2019 New York Not eligible 294 39
2022 New York Eligible 262 39
2022 New York Not eligible 290 39

Task 8

ggplot(data = data7, aes(x = Year, y = `Average scale score`, group = `National School Lunch Program eligibility, 3 categories`, color = `National School Lunch Program eligibility, 3 categories`)) +
  geom_line() +
  ylim(250, 340) +
  geom_hline(yintercept = c(262, 299, 333), linetype = c("dashed", "solid", "dashed"), color = c("red", "green", "blue")) +
  annotate("text", x = 2019, y = 262, label = "Basic", color = "red", hjust = 1.4, vjust = -1) +
  annotate("text", x = 2019, y = 299, label = "Proficient", color = "green", hjust = 1.4, vjust = -1) +
  annotate("text", x = 2019, y = 333, label = "Advanced", color = "blue", hjust = 1.4, vjust = -1) +
  labs(
    title = "Trend in Grade 8 Mathematics Average Scores (2000 - 2022) by NSLPE"
  ) +
  theme_minimal()

Task 9

In 2022, students who were eligible for the National School Lunch Program (NSLP) had an average score that was 27 points lower than that for students who were not eligible. This performance gap was not significantly different from that in 2000 (30 points). The gap in 2000 was not significantly higher, but still higher than 1 point, as compared to 2022. There is a 0.03 difference in SD. The gap in 2019 was 28 points, which would be about .7 of a SD. Compared to 2022, both of the groups fell equally by 4 points, or about 0.1 of a SD. The gap still remained proportional.

Task 10

data10 <- read_excel("Task10Data.xls", 
                     range = "A9:E15")

# Arrange by year: 2000, 2019, 2022
# And use the 2000 scores for those not identified as students with disabilities as the baseline
data10 <- data10 |>
  arrange(Year) |>
  mutate(SPED_DiffSince2000_SD = ((`Average scale score` - `Average scale score`[2]) / `Standard deviation`[2] )) 

# Print this dataset
data10 |>   
  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 New York Identified as students with disabilities 230.8 41.0 -1.2
2000 New York Not identified as students with disabilities 275.5 35.8 0.0
2019 New York Identified as students with disabilities 244.5 34.9 -0.9
2019 New York Not identified as students with disabilities 288.2 39.3 0.4
2022 New York Identified as students with disabilities 244.3 35.7 -0.9
2022 New York Not identified as students with disabilities 280.5 39.9 0.1

Task 11

In 2022, students identified with disabilities had an avg scale score of 244.3. When compared to students identified as without disabilities, there is a difference of 36.2 points, or about 0.89 SD. In 2019, students identified as without disabilities had an average score of 288.2 (highest of the three years), which is 43.7 points higher than students identified with disabilities, or about 0.89 of a SD. In 2000, students not identified as with disabilities outperformed students with disabilities by 44.7 points, or about 1.14 SDs.

Task 12

data12 <- read_excel("Task12Data.xls", 
                     range = "A9:E11") 

# Print this dataset
data12 |>   
  kable(digits = 0) |> # set to one decimal places
  kable_styling()
Year Jurisdiction Status as English learner, 2 categories Average scale score Standard deviation
2022 New York ELL 231 29
2022 New York Not ELL 278 40

Task 13

Task 13: In 2022, Non-ELL students scored 47 points higher on average, or about 0.7 of a SD higher, that students who were learning the English language.