library(readr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(tidyr)
library(readxl)
district_data <- read_excel("district.xls")
clean_data <- district_data |> select(DISTNAME, DDA00A001222R, DPFEAINSP, DPFPAREGP, DPETECOP, DPSTEXPA)
clean_data <- district_data |>select(district_name = DISTNAME,staar_meets = DDA00A001222R, exp_instruction = DPFEAINSP, exp_stuservices = DPFPAREGP, econ_disadv = DPETECOP, teacher_exp = DPSTEXPA)|>
mutate(across(where(is.character), readr::parse_number)) |>
drop_na(staar_meets, exp_instruction, exp_stuservices, econ_disadv, teacher_exp)
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `across(where(is.character), readr::parse_number)`.
## Caused by warning:
## ! 1206 parsing failures.
## row col expected actual
## 1 -- a number CAYUGA ISD
## 2 -- a number ELKHART ISD
## 3 -- a number FRANKSTON ISD
## 4 -- a number NECHES ISD
## 5 -- a number PALESTINE ISD
## ... ... ........ .............
## See problems(...) for more details.
model_funding <- lm(staar_meets ~ exp_instruction + exp_stuservices + econ_disadv + teacher_exp,data = clean_data)
summary(model_funding)
##
## Call:
## lm(formula = staar_meets ~ exp_instruction + exp_stuservices +
## econ_disadv + teacher_exp, data = clean_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -52.330 -5.615 -0.043 5.481 44.027
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 51.74836 3.33568 15.514 <2e-16 ***
## exp_instruction 0.13957 0.05960 2.342 0.0194 *
## exp_stuservices 0.05410 0.04248 1.273 0.2031
## econ_disadv -0.39060 0.01483 -26.340 <2e-16 ***
## teacher_exp 0.72842 0.08543 8.526 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.272 on 1193 degrees of freedom
## Multiple R-squared: 0.5212, Adjusted R-squared: 0.5196
## F-statistic: 324.6 on 4 and 1193 DF, p-value: < 2.2e-16
## Linear Regression Results The linear regression model below predicts STAAR Meets Grade Level performance using four predictors: instructional spending, student services spending, economic disadvantage, and teacher experience. The model explains roughly half of the variance in STAAR performance, indicating a strong fit.
plot(model_funding, which = 1)
broom::tidy(model_funding)
## # A tibble: 5 × 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 51.7 3.34 15.5 1.39e- 49
## 2 exp_instruction 0.140 0.0596 2.34 1.94e- 2
## 3 exp_stuservices 0.0541 0.0425 1.27 2.03e- 1
## 4 econ_disadv -0.391 0.0148 -26.3 6.72e-121
## 5 teacher_exp 0.728 0.0854 8.53 4.51e- 17
The output shows that economic disadvantage has the largest and most significant negative effect on STAAR performance (p < 0.001). Instructional spending and teacher experience both have positive and significant relationships with achievement, while student services spending trends positive but is not statistically significant.
corr_matrix <- clean_data |> select(staar_meets, exp_instruction, exp_stuservices, econ_disadv, teacher_exp) |> cor(use = "complete.obs")
round(corr_matrix, 3)
## staar_meets exp_instruction exp_stuservices econ_disadv
## staar_meets 1.000 0.215 0.354 -0.696
## exp_instruction 0.215 1.000 0.484 -0.192
## exp_stuservices 0.354 0.484 1.000 -0.476
## econ_disadv -0.696 -0.192 -0.476 1.000
## teacher_exp 0.333 0.130 -0.025 -0.233
## teacher_exp
## staar_meets 0.333
## exp_instruction 0.130
## exp_stuservices -0.025
## econ_disadv -0.233
## teacher_exp 1.000
The results confirm that economic disadvantage remains the strongest negative predictor of STAAR performance across Texas districts. However, instructional spending and teacher experience both show significant positive effects, suggesting that targeted investments in classrooms and workforce stability can meaningfully improve outcomes. The model explains roughly half of the variance in student achievement, reinforcing that budget decisions are central to promoting educational equity.