# LOAD REQUIRED PACKAGES
# RUN EVERY TIME YOU OPEN RSTUDIO
library(tidyverse)
library(readxl)
library(dplyr)
library(janitor)
library(lubridate)
library(plm)
library(fixest)
library(broom)
library(stargazer)
library(modelsummary)
library(gtsummary)
library(car)
library(lmtest)
library(sandwich)
library(psych)
library(skimr)
library(naniar)
library(readr)
library(haven)
library(openxlsx)
library(writexl)
# DEFINE DATA FOLDER LOCATION
data_folder <- "C:/Users/QFD738/Desktop/Capstone/Data/"
# DEFINE EXCEL WORKBOOK FILE PATHS
district_type_file <- paste0(data_folder, "District Type_2020-2025.xlsx")
snapshot_file <- paste0(data_folder, "Snapshot_2020-2025.xlsx")
sof_file <- paste0(data_folder, "Summary of Finances_2025-2026.xlsx")
tapr_file <- paste0(data_folder, "TAPR_2020-2025.xlsx")
# VERIFY FILES EXIST IN IMPORTED FOLDER
file.exists(district_type_file)
## [1] TRUE
file.exists(snapshot_file)
## [1] TRUE
file.exists(sof_file)
## [1] TRUE
file.exists(tapr_file)
## [1] TRUE
# VIEW SHEET NAMES IN EACH EXCEL WORKBOOK
excel_sheets(district_type_file)
## [1] "2020-21 District Type" "2021-22 District Type" "2022-23 District Type"
## [4] "2023-24 District Type" "2024-25 District Type"
excel_sheets(snapshot_file)
## [1] "2020-21 Snapshot" "2021-22 Snapshot" "2022-23 Snapshot" "2023-24 Snapshot"
## [5] "2024-25 Snapshot"
excel_sheets(sof_file)
## [1] "inputs_lpe" "inputs_dpe" "outputs_lpe" "outputs_dpe" "mo_asahe_lpe"
## [6] "mo_asahe_dpe" "is_asahe_lpe" "is_asahe_dpe"
excel_sheets(tapr_file)
## [1] "2020-21 TAPR" "2021-22 TAPR" "2022-23 TAPR" "2023-24 TAPR" "2024-25 TAPR"
# IMPORT DISTRICT TYPE DATA
district_type <- list(
"2020_21" = read_excel(district_type_file, sheet = "2020-21 District Type") %>% clean_names(),
"2021_22" = read_excel(district_type_file, sheet = "2021-22 District Type") %>% clean_names(),
"2022_23" = read_excel(district_type_file, sheet = "2022-23 District Type") %>% clean_names(),
"2023_24" = read_excel(district_type_file, sheet = "2023-24 District Type") %>% clean_names(),
"2024_25" = read_excel(district_type_file, sheet = "2024-25 District Type") %>% clean_names()
)
# VIEW IMPORTED DISTRICT TYPE SHEETS
names(district_type)
## [1] "2020_21" "2021_22" "2022_23" "2023_24" "2024_25"
# VIEW COLUMN NAMES IN ALL DISTRICT TYPE SHEETS
for(sheet in names(district_type)) {
cat("\n", sheet, "\n")
print(names(district_type[[sheet]]))
}
##
## 2020_21
## [1] "school_year" "district_id" "distname"
## [4] "tea_district_type" "tea_description" "nces_district_type"
## [7] "nces_description" "charter_school_y_n"
##
## 2021_22
## [1] "school_year" "district_id" "distname"
## [4] "tea_district_type" "tea_description" "nces_district_type"
## [7] "nces_description" "charter_school_y_n"
##
## 2022_23
## [1] "school_year" "district_id" "distname"
## [4] "tea_district_type" "tea_description" "nces_district_type"
## [7] "nces_description" "charter_school_y_n"
##
## 2023_24
## [1] "school_year" "district_id" "distname"
## [4] "tea_district_type" "tea_description" "nces_district_type"
## [7] "nces_description" "charter_school_y_n"
##
## 2024_25
## [1] "school_year" "district_id" "distname"
## [4] "tea_district_type" "tea_description" "nces_district_type"
## [7] "nces_description" "charter_school_y_n"
#VIEW FIRST FEW ROWS OF A SHEET
head(district_type$`2024_25`)
## # A tibble: 6 × 8
## school_year district_id distname tea_district_type tea_description
## <chr> <chr> <chr> <chr> <chr>
## 1 2024-2025 057829 A+ ACADEMY I Charter Schools
## 2 2024-2025 101871 A+ UNLIMITED POTENT… I Charter Schools
## 3 2024-2025 109901 ABBOTT ISD H Rural
## 4 2024-2025 095901 ABERNATHY ISD H Rural
## 5 2024-2025 221901 ABILENE ISD C Other Central …
## 6 2024-2025 057814 ACADEMY FOR ACADEMI… I Charter Schools
## # ℹ 3 more variables: nces_district_type <chr>, nces_description <chr>,
## # charter_school_y_n <chr>
# VIEW DATA STRUCTURE OF A SHEET
glimpse(district_type$`2024_25`)
## Rows: 1,219
## Columns: 8
## $ school_year <chr> "2024-2025", "2024-2025", "2024-2025", "2024-2025",…
## $ district_id <chr> "057829", "101871", "109901", "095901", "221901", "…
## $ distname <chr> "A+ ACADEMY", "A+ UNLIMITED POTENTIAL", "ABBOTT ISD…
## $ tea_district_type <chr> "I", "I", "H", "H", "C", "I", "G", "I", "I", "I", "…
## $ tea_description <chr> "Charter Schools", "Charter Schools", "Rural", "Rur…
## $ nces_district_type <chr> "11", "11", "42", "42", "12", "11", "41", "11", "11…
## $ nces_description <chr> "City-Large", "City-Large", "Rural-Distant", "Rural…
## $ charter_school_y_n <chr> "Y", "Y", "N", "N", "N", "Y", "N", "Y", "Y", "Y", "…
# CREATE CLEAN DISTRICT TYPE DATASET
# BEFORE OMITTING NAs
district_type_clean <- bind_rows(district_type$`2020_21`, district_type$`2021_22`, district_type$`2022_23`, district_type$`2023_24`, district_type$`2024_25`)
# CHECK DIMENSIONS OF DISTRICT TYPE DATA
dim(district_type_clean)
## [1] 6085 8
# VIEW COLUMN NAMES
names(district_type_clean)
## [1] "school_year" "district_id" "distname"
## [4] "tea_district_type" "tea_description" "nces_district_type"
## [7] "nces_description" "charter_school_y_n"
# CHECK FOR DUPLICATE DISTRICT-YEAR RECORDS
district_type_clean %>% count(school_year, district_id, distname) %>% filter(n > 1)
## # A tibble: 0 × 4
## # ℹ 4 variables: school_year <chr>, district_id <chr>, distname <chr>, n <int>
# COUNT CHARTER VS NON-CHARTER DISTRICTS
district_type_clean %>% count(charter_school_y_n)
## # A tibble: 2 × 2
## charter_school_y_n n
## <chr> <int>
## 1 N 5130
## 2 Y 955
# REVIEW TEA DISTRICT TYPES
district_type_clean %>% count(tea_description) %>% arrange(desc(n))
## # A tibble: 11 × 2
## tea_description n
## <chr> <int>
## 1 Rural 2344
## 2 Non-metropolitan Stable 925
## 3 Other Central City Suburban 820
## 4 Charter Schools 747
## 5 Major Suburban 375
## 6 Independent Town 264
## 7 Charter School Districts 183
## 8 Other Central City 171
## 9 Non-metropolitan Fast Growing 151
## 10 Major Urban 55
## 11 N/A 50
# REVIEW NCES DISTRICT TYPES
district_type_clean %>% count(nces_description) %>% arrange(desc(n))
## # A tibble: 12 × 2
## nces_description n
## <chr> <int>
## 1 Rural-Distant 1574
## 2 Rural-Remote 1250
## 3 City-Large 754
## 4 Rural-Fringe 565
## 5 Suburb-Large 542
## 6 Town-Distant 430
## 7 Town-Remote 331
## 8 Town-Fringe 184
## 9 City-Midsize 164
## 10 City-Small 153
## 11 Suburb-Midsize 118
## 12 Suburb-Small 20
# REVIEW CLEAN DISTRICT TYPE DATA
# BEFORE OMITTING NAs
View(district_type_clean %>% select (school_year, district_id, distname, charter_school_y_n, tea_district_type, tea_description, nces_district_type, nces_description) %>% arrange (school_year, district_id))
# IMPORT SNAPSHOT DATA
snapshot <- list(
"2020_21" = read_excel(snapshot_file, sheet = "2020-21 Snapshot") %>% clean_names(),
"2021_22" = read_excel(snapshot_file, sheet = "2021-22 Snapshot") %>% clean_names(),
"2022_23" = read_excel(snapshot_file, sheet = "2022-23 Snapshot") %>% clean_names(),
"2023_24" = read_excel(snapshot_file, sheet = "2023-24 Snapshot") %>% clean_names(),
"2024_25" = read_excel(snapshot_file, sheet = "2024-25 Snapshot") %>% clean_names()
)
# CREATE SNAPSHOT CLEAN DATASET
# BEFORE OMITTING NAs
snapshot_clean <- snapshot$`2024_25` %>%
select(school_year, district_id, distname,
dzcntynm, # County Name
region, # ESC Region
dpetallc, # Total Student Membership
dpethisp, # Hispanic Student Membership (%)
dpetblap, # Black Student Membership (%)
dpetwhip, # White Student Membership (%)
dpetecop, # Economically Disadvantaged (%)
dpetlepp, # English Learners (%)
dpetbilp, # Bilingual Education (%)
dpfvtotk, # Taxable Value Per Pupil
dpfeainsk, # Actual Instructional Expenditure Per Pupil
distsize, # District Size
commtype, # Community Type
propwlth # Property Wealth
)
# REVIEW CLEAN SNAPSHOT STUDENT MEMBERSHIP VARIABLE DISTRIBUTIONS
# BEFORE OMITTING NAs
summary(snapshot_clean %>% select (dpetallc, dpetecop, dpetlepp, dpetbilp, dpfvtotk, dpfeainsk))
## dpetallc dpetecop dpetlepp dpetbilp
## Min. : 9 Min. : 0.00 Min. : 0.00 Min. : 0.00
## 1st Qu.: 339 1st Qu.: 46.27 1st Qu.: 3.60 1st Qu.: 3.60
## Median : 887 Median : 61.15 Median : 8.90 Median : 8.60
## Mean : 4578 Mean : 59.56 Mean :14.16 Mean :14.17
## 3rd Qu.: 2912 3rd Qu.: 75.92 3rd Qu.:19.10 3rd Qu.:19.23
## Max. :176039 Max. :100.00 Max. :89.70 Max. :95.90
##
## dpfvtotk dpfeainsk
## Min. : 0 Min. : 2213
## 1st Qu.: 288396 1st Qu.: 6732
## Median : 526833 Median : 7515
## Mean : 978754 Mean : 8000
## 3rd Qu.: 875438 3rd Qu.: 8530
## Max. :52324295 Max. :61327
## NAs :5 NAs :5
##################################################
# SNAPSHOT DATA VALIDATION COMPLETE
#
# - No duplicate district-year records found.
# - All identifier variables verified.
# - Five observations contain missing values for
# DPFVTOTK and DPFEAINSK.
# - Missing values retained as NA.
# - Snapshot dataset approved for use in the
# master analytic dataset.
##################################################
# IMPORT TAPR DATA
# Skip descriptive row 1 and use row 2 as headers
tapr <- list(
"2020_21" = read_excel(tapr_file, sheet = "2020-21 TAPR", skip = 1) %>% clean_names(),
"2021_22" = read_excel(tapr_file, sheet = "2021-22 TAPR", skip = 1) %>% clean_names(),
"2022_23" = read_excel(tapr_file, sheet = "2022-23 TAPR", skip = 1) %>% clean_names(),
"2023_24" = read_excel(tapr_file, sheet = "2023-24 TAPR", skip = 1) %>% clean_names(),
"2024_25" = read_excel(tapr_file, sheet = "2024-25 TAPR", skip = 1) %>% clean_names()
)
# CHECK NUMBER OF COLUMNS IN EACH TAPR SHEET
for(sheet in names(tapr)) {
cat("\n", sheet, "\n")
print(
length(
names(tapr[[sheet]])
)
)
}
##
## 2020_21
## [1] 419
##
## 2021_22
## [1] 430
##
## 2022_23
## [1] 419
##
## 2023_24
## [1] 243
##
## 2024_25
## [1] 243
# VERIFY THE FIRST THREE NAMES IN EVERY TAPR SHEET
for(sheet in names(tapr)) {
cat("\n", sheet, "\n")
print(
names(tapr[[sheet]])[1:3]
)
}
##
## 2020_21
## [1] "school_year" "district_id" "distname"
##
## 2021_22
## [1] "school_year" "district_id" "distname"
##
## 2022_23
## [1] "school_year" "district_id" "distname"
##
## 2023_24
## [1] "school_year" "district_id" "distname"
##
## 2024_25
## [1] "school_year" "district_id" "distname"
# VIEW THE FIRST THREE ROWS FROM EVERY TAPR SHEET
for(sheet in names(tapr)) {
cat("\n", sheet, "\n")
print(
head(
tapr[[sheet]][, 1:3],
3
)
)
}
##
## 2020_21
## # A tibble: 3 × 3
## school_year district_id distname
## <chr> <chr> <chr>
## 1 2020-2021 001902 CAYUGA ISD
## 2 2020-2021 001903 ELKHART ISD
## 3 2020-2021 001904 FRANKSTON ISD
##
## 2021_22
## # A tibble: 3 × 3
## school_year district_id distname
## <chr> <chr> <chr>
## 1 2021-2022 001902 CAYUGA ISD
## 2 2021-2022 001903 ELKHART ISD
## 3 2021-2022 001904 FRANKSTON ISD
##
## 2022_23
## # A tibble: 3 × 3
## school_year district_id distname
## <chr> <chr> <chr>
## 1 2022-2023 001902 CAYUGA ISD
## 2 2022-2023 001903 ELKHART ISD
## 3 2022-2023 001904 FRANKSTON ISD
##
## 2023_24
## # A tibble: 3 × 3
## school_year district_id distname
## <chr> <chr> <chr>
## 1 2023-2024 001902 CAYUGA ISD
## 2 2023-2024 001903 ELKHART ISD
## 3 2023-2024 001904 FRANKSTON ISD
##
## 2024_25
## # A tibble: 3 × 3
## school_year district_id distname
## <chr> <chr> <chr>
## 1 2024-2025 001902 CAYUGA ISD
## 2 2024-2025 001903 ELKHART ISD
## 3 2024-2025 001904 FRANKSTON ISD
# CREATE CLEAN TAPR DATASET
# BEFORE OMITTING NAs
tapr_clean <- tapr$`2024_25` %>%
select(
school_year,
district_id,
distname,
# Total Students
dpetallc, # Total Student Membership Count
dpntallc, # Total Student Enrollment Count
# Black/African American Students
dpetblac, # Membership Count
dpetblap, # Membership (%)
dpntblac, # Enrollment Count
dpntblap, # Enrollment (%)
# Hispanic/Latino Students
dpethisc, # Membership Count
dpethisp, # Membership (%)
dpnthisc, # Enrollment Count
dpnthisp, # Enrollment (%)
# White Students
dpetwhic, # Membership Count
dpetwhip, # Membership (%)
dpntwhic, # Enrollment Count
dpntwhip, # Enrollment (%)
# Economically Disadvantaged Students
dpetecoc, # Membership Count
dpetecop, # Membership (%)
dpntecoc, # Enrollment Count
dpntecop, # Enrollment (%)
# English Learner Students
dpetlepc, # Membership Count
dpetlepp, # Membership (%)
dpntlepc, # Enrollment Count
dpntlepp, # Enrollment (%)
# Bilingual Education Students
dpetbilc, # Membership Count
dpetbilp, # Membership (%)
dpntbilc, # Enrollment Count
dpntbilp # Enrollment (%)
)
# REVIEW CLEAN TAPR STUDENT MEMBERSHIP AND ENROLLMENT VARIABLE DISTRIBUTIONS
# BEFORE OMITTING NAs
summary(tapr_clean %>% select(dpetallc, dpntallc, dpetecop,dpntecop, dpetlepp, dpntlepp, dpetbilp, dpntbilp))
## dpetallc dpntallc dpetecop dpntecop
## Min. : 9 Min. : 9.0 Min. : 0.00 Min. : 0.00
## 1st Qu.: 339 1st Qu.: 341.5 1st Qu.: 46.27 1st Qu.: 46.05
## Median : 887 Median : 888.5 Median : 61.15 Median : 60.80
## Mean : 4578 Mean : 4589.6 Mean : 59.56 Mean : 59.40
## 3rd Qu.: 2912 3rd Qu.: 2918.2 3rd Qu.: 75.92 3rd Qu.: 75.80
## Max. :176039 Max. :176727.0 Max. :100.00 Max. :100.00
## dpetlepp dpntlepp dpetbilp dpntbilp
## Min. : 0.00 Min. : 0.00 Min. : 0.00 Min. : 0.00
## 1st Qu.: 3.60 1st Qu.: 3.60 1st Qu.: 3.60 1st Qu.: 3.60
## Median : 8.90 Median : 8.80 Median : 8.60 Median : 8.60
## Mean :14.16 Mean :14.14 Mean :14.17 Mean :14.14
## 3rd Qu.:19.10 3rd Qu.:19.02 3rd Qu.:19.23 3rd Qu.:19.23
## Max. :89.70 Max. :89.70 Max. :95.90 Max. :95.90
##################################################
# DATA QUALITY NOTE
#
# Membership variables common to both
# Snapshot and TAPR datasets were compared
# using DISTRICT_ID, DISTNAME, and
# SCHOOL_YEAR.
#
# No discrepancies were identified between:
#
# DPETALLC
# DPETHISP
# DPETBLAP
# DPETWHIP
# DPETECOP
# DPETLEPP
# DPETBILP
#
# Snapshot was retained as the authoritative
# source for student membership variables.
#
# TAPR was retained as the authoritative
# source for student enrollment variables.
##################################################
# IMPORT SUMMARY OF FINANCES DATA
sof <- list(
inputs_lpe = read_excel(sof_file, sheet = "inputs_lpe") %>% clean_names(),
inputs_dpe = read_excel(sof_file, sheet = "inputs_dpe") %>% clean_names(),
outputs_lpe = read_excel(sof_file, sheet = "outputs_lpe") %>% clean_names(),
outputs_dpe = read_excel(sof_file, sheet = "outputs_dpe") %>% clean_names(),
mo_asahe_lpe = read_excel(sof_file, sheet = "mo_asahe_lpe") %>% clean_names(),
mo_asahe_dpe = read_excel(sof_file, sheet = "mo_asahe_dpe") %>% clean_names(),
is_asahe_lpe = read_excel(sof_file, sheet = "is_asahe_lpe") %>% clean_names(),
is_asahe_dpe = read_excel(sof_file, sheet = "is_asahe_dpe") %>% clean_names()
)
# CREATE TRA DATASET
# CREATE CLEAN SOF INPUTS DATASET
# BEFORE OMITTING NAs
# Use inputs_dpe for the eligible classroom teacher counts
sof_inputs <- sof$inputs_dpe %>% select(school_year, district_id, distname, district_type_cd, tot_enroll, tchr_3_lt5_count, tchr_gt5_count)
# CREATE CLEAN SOF OUTPUTS DATASET
# BEFORE OMITTING NAs
#Use outputs_dpe for TRA funding amounts
sof_outputs <- sof$outputs_dpe %>% select(school_year, district_id, distname, tchr_3_lt5_allot, tchr_3_lt5_amt, tchr_gt5_allot, tchr_gt5_amt, tra_allot)
# CREATE CLEAN SOF TRA DATASET
# BEFORE OMITTING NAs
sof_tra <- left_join(sof_inputs, sof_outputs, by = c("school_year", "district_id", "distname"))
# REVIEW CLEAN SOF TRA DATA
# BEFORE OMITTING NAs
# VIEW DISTRICTS WITH TRA_ALLOT = 0
sof_outputs %>% filter(tra_allot == 0) %>% select(district_id, distname, tra_allot) %>% arrange(distname)
## # A tibble: 47 × 3
## district_id distname tra_allot
## <chr> <chr> <dbl>
## 1 019000 BOWIE COUNTY 0
## 2 057851 BRIDGEWAY PREPARATORY ACADEMY 0
## 3 101842 COMQUEST ACADEMY 0
## 4 220811 EAST FORT WORTH MONTESSORI ACADEMY 0
## 5 241903 EL CAMPO ISD 0
## 6 071804 EL PASO ACADEMY 0
## 7 101872 ETOILE ACADEMY CHARTER SCHOOL 0
## 8 115901 FT HANCOCK ISD 0
## 9 057831 GATEWAY CHARTER ACADEMY 0
## 10 101000 HARRIS COUNTY DEPT OF ED 0
## # ℹ 37 more rows
# VIEW RECORDS WITH MISSING TRA_ALLOT
sof_tra %>% filter(is.na(tra_allot)) %>% count(district_type_cd)
## # A tibble: 1 × 2
## district_type_cd n
## <dbl> <int>
## 1 3 11
##################################################
# QUALITY CHECK
# Eleven observations with DISTRICT_TYPE_CD = 3
# had missing TRA eligibility counts in
# inputs_dpe and no matching record in
# outputs_dpe. These observations were
# retained as NA because TEA did not
# report/apply a TRA calculation.
#
# DISTRICT_TYPE_CD is a coded value for the
# type of school district, as reported in the
# SOF inputs file.
#
# The SOF data dictionary defines
# DISTRICT_TYPE_CD as a coded district type
# indicator but does not provide a code
# translation table.
#
# Therefore, DISTRICT_TYPE_CD was retained
# for data-quality review purposes and was
# not used as a substantive analytical
# variable in this study.
##################################################
# CREATE TOTAL ELIGIBLE CLASSROOM TEACHERS
# BEFORE OMITTING NAs
sof_tra <- sof_tra %>% mutate (total_eligible_classroom_teachers = tchr_3_lt5_count + tchr_gt5_count)
# REVIEW ELIGIBLE CLASSROOM TEACHER COUNTS
# BEFORE OMITTING NAs
summary(sof_tra$total_eligible_classroom_teachers)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NAs
## 0.0 23.0 59.5 244.1 154.8 7083.0 11
# CREATE DV: TEACHER RETENTION ALLOTMENT FUNDING PER ELIGIBLE CLASSROOM TEACHER ($)
# BEFORE OMITTING NAs
sof_tra <- sof_tra %>% mutate (tra_funding_per_eligible_classroom_teacher = if_else ( total_eligible_classroom_teachers > 0, tra_allot / total_eligible_classroom_teachers, NA_real_))
# REVIEW MISSING VALUES IN DEPENDENT VARIABLE
# BEFORE OMITTING NAs
sum(is.na(sof_tra$tra_funding_per_eligible_classroom_teacher))
## [1] 58
sum(is.nan(sof_tra$tra_funding_per_eligible_classroom_teacher))
## [1] 0
# REVIEW DISTRICTS WITH ZERO ELIGIBLE CLASSROOM TEACHERS
# BEFORE OMITTING NAs
sof_tra %>% filter(total_eligible_classroom_teachers == 0) %>% select(district_id, distname, total_eligible_classroom_teachers, tra_allot)
## # A tibble: 47 × 4
## district_id distname total_eligible_class…¹ tra_allot
## <chr> <chr> <dbl> <dbl>
## 1 015805 NEW FRONTIERS PUBLIC SCHOOLS INC 0 0
## 2 015950 REG XX EDUCATION SERVICE CENTER 0 0
## 3 019000 BOWIE COUNTY 0 0
## 4 031505 UNIVERSITY OF TEXAS RIO GRANDE … 0 0
## 5 057819 JEAN MASSIEU ACADEMY 0 0
## 6 057831 GATEWAY CHARTER ACADEMY 0 0
## 7 057851 BRIDGEWAY PREPARATORY ACADEMY 0 0
## 8 057950 REG X EDUCATION SERVICE CENTER 0 0
## 9 061501 UNIVERSITY OF NORTH TEXAS 0 0
## 10 070907 ITALY ISD 0 0
## # ℹ 37 more rows
## # ℹ abbreviated name: ¹total_eligible_classroom_teachers
# REVIEW CLEAN SOF TRA DEPENDENT VARIABLE
# DISTRIBUTION BEFORE OMITTING NAs
summary(sof_tra$tra_funding_per_eligible_classroom_teacher)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NAs
## 3702 7059 7467 6982 7667 8000 58
# CREATE CV: ELIGIBLE CLASSROOM TEACHERS WITH 5 OR MORE YEARS OF EXPERIENCE (%)
# Before Omitting NAs
sof_tra <- sof_tra %>% mutate(pct_eligible_teachers_5plus = if_else(total_eligible_classroom_teachers > 0,(tchr_gt5_count / total_eligible_classroom_teachers) * 100, NA_real_))
# REVIEW CV: ELIGIBLE CLASSROOM TEACHERS WITH 5 OR MORE YEARS OF EXPERIENCE (%)
# BEFORE OMITTING NAs
summary(sof_tra$pct_eligible_teachers_5plus) # REVIEW SUMMARY STATISTICS
## Min. 1st Qu. Median Mean 3rd Qu. Max. NAs
## 30.00 83.33 88.04 86.85 91.86 100.00 58
sum(is.na(sof_tra$pct_eligible_teachers_5plus)) # CHECK MISSING VALUES IN CONTROL VARIABLE
## [1] 58
# REVIEW CLEAN SOF TRA VARIABLE DISTRIBUTIONS
#BEFORE OMITTING NAs
summary(sof_tra %>% select(total_eligible_classroom_teachers, tra_allot, tra_funding_per_eligible_classroom_teacher, pct_eligible_teachers_5plus))
## total_eligible_classroom_teachers tra_allot
## Min. : 0.0 Min. : 0
## 1st Qu.: 23.0 1st Qu.: 172000
## Median : 59.5 Median : 452000
## Mean : 244.1 Mean : 1285918
## 3rd Qu.: 154.8 3rd Qu.: 1105000
## Max. :7083.0 Max. :31585000
## NAs :11 NAs :11
## tra_funding_per_eligible_classroom_teacher pct_eligible_teachers_5plus
## Min. :3702 Min. : 30.00
## 1st Qu.:7059 1st Qu.: 83.33
## Median :7467 Median : 88.04
## Mean :6982 Mean : 86.85
## 3rd Qu.:7667 3rd Qu.: 91.86
## Max. :8000 Max. :100.00
## NAs :58 NAs :58
# CREATE MASTER ANALYTIC DATASET
# BEFORE OMITTING NAs
colSums(
is.na(sof_tra)
)
## school_year
## 0
## district_id
## 0
## distname
## 0
## district_type_cd
## 0
## tot_enroll
## 0
## tchr_3_lt5_count
## 11
## tchr_gt5_count
## 11
## tchr_3_lt5_allot
## 0
## tchr_3_lt5_amt
## 0
## tchr_gt5_allot
## 0
## tchr_gt5_amt
## 0
## tra_allot
## 11
## total_eligible_classroom_teachers
## 11
## tra_funding_per_eligible_classroom_teacher
## 58
## pct_eligible_teachers_5plus
## 58