Skip to content

Commit

Permalink
included counterfactual analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfprice committed Oct 4, 2023
1 parent 9054d9f commit e8d60a6
Show file tree
Hide file tree
Showing 26 changed files with 2,089 additions and 311 deletions.
74 changes: 72 additions & 2 deletions calculate_opportunity_score.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,79 @@ school_corp_frame <- read_csv(here("data", "in_sc-data.csv")) |>
mutate(adj_academic = round(adj_academic, digits = 2)) |>
mutate(scoScore = round(scoScore, digits = 2))

# Conduct a counterfactual analysis to ensure fairness for school corporations.
# If a school corporation has an adjusted academic score **above** mean academic
# score + 1 standard deviation then adjust the non-white and free and
# reduced lunch percents to the state average if these are **lower** than the
# state mean. This gives some school corporations a little "bump" so that it
# cannot be said that any group is given an "unfair" advantage. If the newly
# calculated SCOscore is then >=1, then keep that counterfactual score.

urm_pct_mean <- round(mean(school_corp_frame$urm_pct)/100,2)
frl_pct_mean <- round(mean(school_corp_frame$frl_pct)/100,2)
adj_ac_mean <- round(mean(school_corp_frame$adj_academic),2)
adj_ac_sd <- round(sd(school_corp_frame$adj_academic), 2)
adj_ac_cutoff <- adj_ac_mean + adj_ac_sd

whatif_frame <- school_corp_frame |>
filter(adj_academic >= adj_ac_cutoff) |>
filter(scoScore < 1) |>
select(-scoScore) |>
mutate(
urm_pct = urm_pct / 100
) |>
mutate(
frl_pct = frl_pct / 100
) |>
mutate(urm_pct = ifelse(
urm_pct < urm_pct_mean,
urm_pct_mean,
urm_pct
)) |>
mutate(frl_pct = ifelse(
frl_pct < frl_pct_mean,
frl_pct_mean,
frl_pct
)) |>
mutate(
scoScore = (
((urm_pct * 1.5) + (frl_pct * 1.5) + (adj_academic)) / 3
)
) |>
mutate(scoScore = if_else(
scoScore < 1 & scoScore > 0.99,
1,
scoScore
)) |>
mutate(
scoScore = round(scoScore, 2)
) |>
filter(
scoScore >= 1
) |>
select(leaid, scoScore)

school_corp_frame$cf <- FALSE

school_corp_frame <- school_corp_frame |>
mutate(scoScore = ifelse(
leaid %in% whatif_frame$leaid,
whatif_frame$scoScore,
scoScore)) |>
mutate(cf = ifelse(
leaid %in% whatif_frame$leaid,
TRUE,
FALSE))

rural_opp_frame <- school_corp_frame |>
filter(urban_centric_locale %in% c("Town distant", "Town remote", "Rural fringe",
"Rural distant", "Rural remote")) |>
filter(scoScore >= 1)# |>
#filter(urm_pct >=50)
ggscatter(rural_opp_frame, "frl_pct", "urm_pct")

output_frame <- school_corp_frame |>
select(leaid, lea_name, enrollment, urban_centric_locale, urm_pct, frl_pct, academic = adj_academic, scoScore) |>
select(leaid, lea_name, cf, enrollment, urban_centric_locale, urm_pct, frl_pct, academic = adj_academic, scoScore) |>
write_csv(file = here("data", "in_scoscores.csv"))

school_corp_frame$urban_centric_locale <- factor(
Expand Down Expand Up @@ -137,7 +208,6 @@ urcl_pack = linearpackcircles(school_corp_frame,
area_multiplier = 1000)
urcl_pack


urcl_swarm <- ggplot(
school_corp_frame,
aes(
Expand Down
573 changes: 283 additions & 290 deletions data/in_scoscores.csv

Large diffs are not rendered by default.

282 changes: 282 additions & 0 deletions data/mds.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
lea_name,groups
Penn-Harris-Madison School Corp,2
Perry Township Schools,1
Peru Community Schools,5
Pike County School Corp,5
MSD Pike Township,2
Pioneer Regional School Corp,5
Plainfield Community School Corp,3
East Porter County School Corp,4
Plymouth Community School Corp,4
John Glenn School Corporation,5
Portage Township Schools,3
Porter Township School Corp,5
Prairie Heights Community Sch Corp,5
West Central School Corp,5
Rensselaer Central School Corp,5
Richland-Bean Blossom C S C,4
Richmond Community Schools,4
Rochester Community School Corp,5
Merrillville Community School Corp,3
Rossville Con School District,5
Rush County Schools,5
Salem Community Schools,5
Daleville Community Schools,5
Scott County School District 1,5
Scott County School District 2,4
Seymour Community Schools,3
MSD Shakamak Schools,5
Shelbyville Central Schools,4
Shoals Community School Corp,5
South Adams Schools,5
South Bend Community School Corp,1
South Gibson School Corporation,5
South Harrison Com Schools,4
South Henry School Corp,5
South Knox School Corp,5
South Madison Com Sch Corp,4
South Montgomery Com Sch Corp,5
South Newton School Corp,5
South Putnam Community Schools,5
South Ripley Com Sch Corp,5
South Spencer County Sch Corp,5
South Vermillion Com Sch Corp,5
Southeast Fountain School Corp,5
Southeast Dubois Co Sch Corp,5
Hamilton Southeastern Schools,1
Lewis Cass Schools,5
Southern Hancock Co Com Sch Corp,4
Randolph Southern School Corp,5
Southern Wells Com Schools,5
Southwestern-Jefferson Co Con,5
Southwestern Con Sch Shelby Co,5
Southwest School Corporation,5
Southwest Dubois Co Sch Corp,5
Southwest Parke Com Sch Corp,5
School Town of Speedway,5
Springs Valley Com School Corp,5
MSD Steuben County,4
Sunman-Dearborn Com Sch Corp,4
Switzerland County School Corp,5
Taylor Community School Corp,5
Tell City-Troy Twp School Corp,5
Tippecanoe School Corp,2
Tippecanoe Valley School Corp,5
Tipton Community School Corp,5
Tri-County School Corporation,5
Tri-Creek School Corporation,4
Triton School Corporation,5
Twin Lakes School Corp,5
Union Co/Clg Corner Joint Sch Dist,5
Union Township School Corp,5
Union School Corporation,3
Union-North United School Corp,5
Valparaiso Community Schools,3
Crothersville Community Schools,5
Vigo County School Corp,2
Vincennes Community School Corp,4
Wabash City Schools,5
MSD Wabash County Schools,5
Wa-Nee Community Schools,4
MSD Warren Township,2
Warrick County School Corp,2
Warsaw Community Schools,3
Washington Community Schools,4
MSD Washington Township,2
MSD Wayne Township,1
West Lafayette Com School Corp,4
Frankton-Lapel Community Schools,4
West Noble School Corporation,5
West Washington School Corp,5
Western Boone Co Com Sch Dist,5
Western Wayne Schools,5
Westfield-Washington Schools,2
Westview School Corporation,5
School City of Whiting,5
Whitko Community School Corp,5
White River Valley School District,5
MSD Southwest Allen County Schls,3
Adams Central Community Schools,5
Tri-Township Cons School Corp,5
North Central Parke Comm Schl Corp,5
Alexandria Community School Corp,5
Anderson Community School Corp,3
Argos Community Schools,5
Attica Consolidated School Corp,5
South Dearborn Community Sch Corp,5
Avon Community School Corp,2
Barr-Reeve Community Schools Inc,5
Bartholomew Con School Corp,2
Batesville Community School Corp,5
Baugo Community Schools,5
Beech Grove City Schools,4
Benton Community School Corp,5
Blackford County Schools,5
Bloomfield School District,5
Monroe County Community Sch Corp,2
Blue River Valley Schools,5
North Harrison Com School Corp,5
MSD Bluffton-Harrison,5
MSD Boone Township,5
Clay Community Schools,4
Bremen Public Schools,5
Brown County School Corporation,5
Brownsburg Community School Corp,2
Brownstown Cnt Com Sch Corp,5
C A Beard Memorial School Corp,5
Cannelton City Schools,5
Carmel Clay Schools,1
Carroll Consolidated School Corp,5
Caston School Corporation,5
Center Grove Community School Corp,2
Centerville-Abington Com Schs,5
DeKalb Co Ctl United Sch Dist,4
Central Noble Com School Corp,5
Perry Central Com Schools Corp,5
Randolph Central School Corp,5
Clark-Pleasant Community Sch Corp,3
Clarksville Community School Corp,4
Northwestern School Corp,5
Clinton Central School Corporation,5
Clinton Prairie School Corporation,5
South Central Com School Corp,5
Cloverdale Community Schools,5
Whitley County Con Schools,4
Concord Community Schools,3
Covington Community School Corp,5
Crawford County Community Sch Corp,5
Crawfordsville Community Schools,4
Crown Point Community School Corp,2
Culver Community Schools Corp,5
Danville Community School Corp,4
Decatur County Community Schools,5
MSD Decatur Township,3
Delaware Community School Corp,4
Delphi Community School Corp,5
Duneland School Corporation,3
Zionsville Community Schools,3
East Allen County Schools,2
School City of East Chicago,4
Lake Station Community Schools,5
East Gibson School Corporation,5
East Noble School Corporation,4
East Washington School Corp,5
Eastbrook Community Sch Corp,5
DeKalb Co Eastern Com Sch Dist,5
Eastern Greene Schools,5
Eastern Hancock Co Com Sch Corp,5
Eastern Howard School Corporation,5
Randolph Eastern School Corp,5
Shelby Eastern Schools,5
Edinburgh Community School Corp,5
Elkhart Community Schools,2
Elwood Community School Corp,5
Eminence Community School Corp,5
Evansville Vanderburgh School Corp,1
Fairfield Community Schools,5
Fayette County School Corporation,4
Flat Rock-Hawcreek School Corp,5
Fort Wayne Community Schools,1
Community Schools of Frankfort,4
Franklin Community School Corp,3
Franklin County Community Sch Corp,5
Lanesville Community School Corp,5
Franklin Township Com Sch Corp,2
Fremont Community Schools,5
Frontier School Corporation,5
Gary Community School Corp,4
Goshen Community Schools,3
Greater Clark County Schools,2
Greater Jasper Consolidated Schs,4
Greencastle Community School Corp,5
Greenfield-Central Com Schools,4
Greensburg Community Schools,5
Greenwood Community Sch Corp,4
Monroe-Gregg School District,5
Griffith Public Schools,5
Hamilton Community Schools,5
Hamilton Heights School Corp,5
School City of Hammond,2
Hanover Community School Corp,4
Western School Corporation,4
Wes-Del Community Schools,5
School Town of Highland,4
School City of Hobart,4
River Forest Community Sch Corp,5
Huntington Co Com Sch Corp,3
Indianapolis Public Schools,1
Jac-Cen-Del Community Sch Corp,5
Jay School Corporation,4
Jennings County School Corporation,4
Kankakee Valley School Corp,4
Knox Community School Corp,5
Kokomo School Corporation,3
Lafayette School Corporation,3
Lake Central School Corporation,2
Lake Ridge New Tech Schools,5
Lakeland School Corporation,5
Wawasee Community School Corp,4
LaPorte Community School Corp,3
MSD Lawrence Township,1
Lawrenceburg Community School Corp,5
Lebanon Community School Corp,4
Linton-Stockton School Corporation,5
Logansport Community Sch Corp,4
Loogootee Community Sch Corp,5
MSD Warren County,5
Maconaquah School Corp,5
Madison Consolidated Schools,4
Madison-Grant United School Corp,5
Marion Community Schools,4
Sheridan Community Schools,5
MSD Martinsville Schools,4
Michigan City Area Schools,3
Middlebury Community Schools,4
Milan Community Schools,5
Mill Creek Community Sch Corp,5
School City of Mishawaka,3
Mississinewa Community School Corp,4
Mitchell Community Schools,5
Cowan Community School Corp,5
Monroe Central School Corp,5
Eastern Pulaski Community Sch Corp,5
Mooresville Con School Corp,4
Yorktown Community Schools,4
Mt Vernon Community School Corp,4
MSD Mount Vernon,5
Muncie Community Schools,3
School Town of Munster,4
Nettle Creek School Corporation,5
New Albany-Floyd Co Con Sch,2
New Castle Community School Corp,4
MSD of New Durham Township,5
New Prairie United School Corp,4
Nineveh-Hensley-Jackson United,5
Noblesville Schools,2
North Adams Community Schools,5
North Daviess Com Schools,5
North Gibson School Corporation,5
North Judson-San Pierre Sch Corp,5
North Knox School Corp,5
North Lawrence Com Schools,4
North Miami Community Schools,5
North Montgomery Com Sch Corp,5
North Newton School Corp,5
MSD North Posey Co Schools,5
North Putnam Community Schools,5
North Spencer County Sch Corp,5
Tri-Central Community Schools,5
North Vermillion Com Sch Corp,5
North West Hendricks Schools,5
Northeast Dubois Co Sch Corp,5
North White School Corp,5
Northeast School Corp,5
Northeastern Wayne Schools,5
Northern Wells Community Schools,4
Northwest Allen County Schools,3
Shenandoah School Corporation,5
Northwestern Con School Corp,5
Oak Hill United School Corp,5
Oregon-Davis School Corp,5
Orleans Community Schools,5
Paoli Community School Corp,5
Loading

0 comments on commit e8d60a6

Please sign in to comment.