ltc-code 0.1.98__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {ltc_code-0.1.98 → ltc_code-0.2.0}/PKG-INFO +1 -1
  2. {ltc_code-0.1.98 → ltc_code-0.2.0}/pyproject.toml +1 -1
  3. ltc_code-0.2.0/src/ltc_code/.DS_Store +0 -0
  4. ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update/check_cmo_apps.do +374 -0
  5. ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update/christel_house.py +645 -0
  6. ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update/democracy_prep.py +986 -0
  7. ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update/green_dot.py +434 -0
  8. ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update/helpers.py +2830 -0
  9. ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update/ilt.py +557 -0
  10. ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update/kipp_nj.py +310 -0
  11. ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update/main.py +213 -0
  12. ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update/mappings.py +1316 -0
  13. ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update/rocketship.py +1078 -0
  14. ltc_code-0.2.0/src/ltc_code/20260630_census_disclosure/aspire.py +337 -0
  15. ltc_code-0.2.0/src/ltc_code/20260630_census_disclosure/christel_house.py +598 -0
  16. ltc_code-0.2.0/src/ltc_code/20260630_census_disclosure/democracy_prep.py +947 -0
  17. ltc_code-0.2.0/src/ltc_code/20260630_census_disclosure/green_dot.py +417 -0
  18. ltc_code-0.2.0/src/ltc_code/20260630_census_disclosure/ilt.py +557 -0
  19. ltc_code-0.2.0/src/ltc_code/20260630_census_disclosure/kipp.py +381 -0
  20. ltc_code-0.2.0/src/ltc_code/20260630_census_disclosure/kipp_nj.py +1383 -0
  21. ltc_code-0.2.0/src/ltc_code/20260630_census_disclosure/rocketship.py +962 -0
  22. ltc_code-0.2.0/src/ltc_code/20260630_census_disclosure/yes_prep.py +436 -0
  23. ltc_code-0.2.0/src/ltc_code/aspire.py +405 -0
  24. ltc_code-0.2.0/src/ltc_code/june30.py +216 -0
  25. ltc_code-0.2.0/src/ltc_code/yes_prep.py +502 -0
  26. {ltc_code-0.1.98 → ltc_code-0.2.0}/README.md +0 -0
  27. {ltc_code-0.1.98/src/ltc_code → ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update}/aspire.py +0 -0
  28. {ltc_code-0.1.98/src/ltc_code → ltc_code-0.2.0/src/ltc_code/20260614_new_build_scripts_update}/yes_prep.py +0 -0
  29. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/__init__.py +0 -0
  30. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/check_cmo_apps.do +0 -0
  31. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/christel_house.py +0 -0
  32. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/green_dot.py +0 -0
  33. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/helpers.py +0 -0
  34. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/june13.py +0 -0
  35. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/june2.py +0 -0
  36. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/june5.py +0 -0
  37. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/june7.py +0 -0
  38. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/kipp_nj.py +0 -0
  39. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/kipp_tx.py +0 -0
  40. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/main.py +0 -0
  41. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/mappings.py +0 -0
  42. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/may27.py +0 -0
  43. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/polars_dates.py +0 -0
  44. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/rocketship.py +0 -0
  45. {ltc_code-0.1.98 → ltc_code-0.2.0}/src/ltc_code/schema_mapping.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ltc-code
3
- Version: 0.1.98
3
+ Version: 0.2.0
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.9
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ltc-code"
3
- version = "0.1.98"
3
+ version = "0.2.0"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"
Binary file
@@ -0,0 +1,374 @@
1
+ * 2.1_nsc_prep_for_analysis
2
+ * Sarah Cohodes
3
+ * Prepare NSC data for analysis
4
+ ** transform long file to student level file
5
+ ** based on MA NSC programs
6
+
7
+ clear all
8
+ set more off
9
+ cap log close _all
10
+ set seed 123256789
11
+
12
+
13
+ /* paths */
14
+ global basepath "P:\Long_Term_Charter"
15
+
16
+ cd "$basepath"
17
+
18
+ // raw data
19
+ global raw "$basepath\data\raw"
20
+ global lotto "$basepath\data\charter_lottery_data"
21
+
22
+ // intermediate data
23
+ global saves "$basepath\data\interim"
24
+ global data "$basepath\data"
25
+ global data_clean "$basepath\data\clean"
26
+
27
+ // data
28
+ global data_cmo "$basepath\data\clean\new_build\cmo_apps"
29
+ global data_wide "$basepath\data\clean\new_build\cmo_apps\stata_collapsed"
30
+ global data_long "$basepath\data\clean\new_build\cmo_apps\stata"
31
+
32
+ // code
33
+ global do "$basepath\programs\explore_sarah\check_cmo_apps"
34
+
35
+ // output
36
+ global output "$do\tables_figures"
37
+ global log "$do\log_files"
38
+
39
+
40
+ **who is in sample
41
+ global cmo aspire democracy_prep ilt christel_house rocketship yes_prep
42
+ global cmo_minus christel_house democracy_prep ilt christel_house rocketship yes_prep //makes combined file (don't need first alpha aspire)
43
+ global cmo_plus combined aspire christel_house yes_prep democracy_prep ilt // rocketship
44
+
45
+ *rocketship built but not clear enough nondegenerate lottos to include, plus unbalanced.
46
+
47
+ *just add new cmo here if one at a time
48
+ *global cmo democracy_prep
49
+
50
+
51
+ *************
52
+ *SWITCHES*
53
+ *************
54
+
55
+ global analysis_file 1 //assemble analysis file
56
+ global analysis 1 //basic analysis
57
+ *make version that is initialL_offer only
58
+
59
+
60
+ if $analysis_file==1{
61
+
62
+ foreach cmo of global cmo {
63
+ foreach type in wide long {
64
+ use "${data_`type'}/`cmo'.dta", clear
65
+ *CMO SPECIFIC FIXES
66
+
67
+ if "`cmo'" == "yes_prep" {
68
+ cap g enroll=offer_accepted
69
+ }
70
+
71
+ if "`cmo'" == "aspire" | "`cmo'" == "rocketship" {
72
+ g late_app=0
73
+ }
74
+
75
+ if "`cmo'" == "rocketship" {
76
+ destring school_year, replace
77
+ destring sid_cepr, replace
78
+ keep if school_year>=2016
79
+ }
80
+
81
+ *bring in cohort
82
+ merge m:1 sid_cepr using "$saves/IDS_ltc.dta", keep(1 3)
83
+ g nsc_sample = 1 if cohort>=2010&cohort<=2023 //update here when have new NSC data
84
+
85
+
86
+ *nsc degrees
87
+ merge m:1 sid_cepr using "$saves/flat_degrees_NSC_ltc.dta" , keep(1 3) nogen //NSC last updated 2024
88
+
89
+ *merge nsc enrollment
90
+ merge m:1 sid_cepr using "$saves/flat_enrollment_NSC_ltc.dta" , keep(1 3) nogen
91
+
92
+ g opeid = ID_FSC_firstinst
93
+ destring opeid, replace
94
+
95
+ merge m:1 sid_cepr using "$data_clean/sent_to_nsc.dta", nogen keep(1 3)
96
+ replace sent_to_nsc=0 if sent_to_nsc==.
97
+
98
+
99
+ *College characteristics from Chetty paper
100
+ merge m:1 opeid using "$data_clean\chetty_college.dta", nogen force keep(1 3) ///
101
+ keepusing(k_mean k_mean_m k_mean_f opeid superopeid institution_name superopeid_name ///
102
+ *mean*insuff* *mean*never* tier grad_rate_150_p_2013 exp_instr_pc_2013 flagship ipeds_enrollment_2013)
103
+ ren institution_name institution_name
104
+ ren superopeid_name superopeid_name
105
+
106
+ *spread insufficient and never attend outcomes
107
+ foreach v of varlist *_insuff* *_never* {
108
+ egen max=max(`v')
109
+ replace `v'=max
110
+ drop max
111
+ }
112
+
113
+
114
+
115
+ merge m:1 ID_FSC_firstinst using "${saves}/temp2.dta", keep(1 3) nogen
116
+
117
+ * merging base file with new IPEDS data
118
+ merge m:1 ID_FSC_firstinst using "${saves}/temp0.dta", keep(1 3) nogen
119
+
120
+ *will have to come back to this it uses 1.12_ipeds educationdata
121
+ *merge m:1 unitid using "$data_clean\ipeds_data.dta", nogen force keep(1 3)
122
+
123
+ compress
124
+
125
+ *** replace k_mean for those who don't attend college
126
+ ***** note there are a few colleges that don't match and those get a different number
127
+ replace k_mean = k_mean_insuff if k_mean==.&opeid!=. // insufficient data college
128
+
129
+ replace k_mean= k_mean_never if k_mean==.
130
+
131
+ *outcomes are processed more below
132
+
133
+
134
+ foreach v of varlist att*Y1* {
135
+ replace `v'=0 if `v'==. & cohort<=2023
136
+ replace `v'=. if cohort>2023
137
+ }
138
+ foreach v of varlist att*Y2* {
139
+ replace `v'=0 if `v'==. & cohort<=2022
140
+ replace `v'=. if cohort>2022
141
+ }
142
+ foreach v of varlist att*Y3* cmp*Y3*{
143
+ replace `v'=0 if `v'==. & cohort<=2021
144
+ replace `v'=. if cohort>2021
145
+ }
146
+ foreach v of varlist att*Y4* cmp*Y4*{
147
+ replace `v'=0 if `v'==. & cohort<=2020
148
+ replace `v'=. if cohort>2020
149
+ }
150
+ foreach v of varlist att*Y5* cmp*Y5* {
151
+ replace `v'=0 if `v'==. & cohort<=2019
152
+ replace `v'=. if cohort>2019
153
+ }
154
+ foreach v of varlist att*Y6* cmp*Y6*{
155
+ replace `v'=0 if `v'==. & cohort<=2018
156
+ replace `v'=. if cohort>2018
157
+ }
158
+ foreach v of varlist att*Y7* cmp*Y7* {
159
+ replace `v'=0 if `v'==. & cohort<=2017
160
+ replace `v'=. if cohort>2017
161
+ }
162
+ foreach v of varlist att*Y8* cmp*Y8*{
163
+ replace `v'=0 if `v'==. & cohort<=2016
164
+ replace `v'=. if cohort>2016
165
+ }
166
+
167
+
168
+ *this should be by first institution
169
+ tab college_name_first if tier == . & (cmp_BA_byY6 == 1 | att_4yr_byY2 == 1), mis
170
+
171
+ egen group = group(college_name_first)
172
+ bys group: egen mode_tier = mode(tier)
173
+ bys group: egen median_tier = median(tier)
174
+
175
+ replace tier = mode_tier if tier == . & (cmp_BA_byY6 == 1 | att_4yr_byY2 == 1)
176
+ replace tier = median_tier if tier == . & (cmp_BA_byY6 == 1 | att_4yr_byY2 == 1)
177
+ replace tier = 8 if college_name_first == "BENJAMIN FRANKLIN INSTITUTE OF TECHNOL" & tier == .
178
+ replace tier = 8 if college_name_first == "BENJAMIN FRANKLIN INSTITUTE OF TECHNOLOGY" & tier == .
179
+ replace tier = 8 if college_name_first == "BENJAMIN FRANKLIN INSTITUTE OF TECHNOLOG" & tier == .
180
+ replace tier = 7 if college_name_first == "DELAWARE STATE UNIVERSITY" & tier == .
181
+ replace tier = 5 if college_name_first == "FRAMINGHAM STATE UNIVERSITY" & tier == .
182
+ replace tier = 11 if college_name_first == "FLORIDA CAREER COLLEGE - MIAMI" & tier == .
183
+ replace tier = 7 if college_name_first == "NEW COLLEGE OF FLORIDA" & tier == .
184
+ replace tier = 8 if college_name_first == "NEWBURY COLLEGE" & tier == .
185
+ replace tier = 4 if college_name_first == "NORTHWESTERN UNIVERSITY" & tier == .
186
+ replace tier = 7 if college_name_first == "THE OHIO STATE UNIVERSITY" & tier == .
187
+ replace tier = 7 if college_name_first == "TROY UNIVERSITY" & tier == .
188
+ replace tier = 8 if college_name_first == "UNITY COLLEGE" & tier == .
189
+ replace tier = 8 if college_name_first == "UNIVERSITY OF NORTHWESTERN OHIO - COLL OF TECH" & tier == .
190
+
191
+ * generating aggregate categories for each tier
192
+
193
+ g hselective = 0
194
+ replace hselective = 1 if tier == 1 | tier == 2 | tier == 3 | tier == 4
195
+
196
+ g selective = 0
197
+ replace selective = 1 if tier == 5 | tier == 6
198
+
199
+ g nonselective = 0
200
+ replace nonselective = 1 if tier == 7 | tier == 8 | tier == 9 | tier == 10 | tier == 11
201
+
202
+ g insufficient_dta = 0
203
+ replace insufficient_dta = 1 if tier == 13
204
+
205
+ g BA_byY6_hselective = cmp_BA_byY6*hselective
206
+ g BA_byY6_selective = cmp_BA_byY6*selective
207
+ g BA_byY6_nonselective = cmp_BA_byY6*nonselective
208
+ g BA_byY6_insufficient = cmp_BA_byY6*insufficient_dta
209
+
210
+ * generating aggregate categories for Barrons ranks
211
+
212
+ * fixing missing values of the Barrons rank variable
213
+
214
+ tab college_name_first if barrons_rank == "" & (cmp_BA_byY6==1 | att_4yr_inY2 == 1), mis
215
+
216
+ bys group: egen mode_rank = mode(barrons_rank)
217
+
218
+ replace barrons_rank = mode_rank if barrons_rank == "" & (cmp_BA_byY6 == 1 | att_4yr_inY2 == 1)
219
+
220
+ replace barrons_rank = "Highly Competitive" if (college_name_first == "NORTHWESTERN UNIVERSITY" & barrons_rank == "") | (college_name_first == "CASE WESTERN RESERVE UNIVERSITY" & barrons_rank == "")
221
+
222
+ g hcompetitive = 0
223
+ replace hcompetitive = 1 if barrons_rank == "Highly Competitive" | barrons_rank == "Most Competitive" | barrons_rank == "Very Competitive"
224
+
225
+ g competitive = 0
226
+ replace competitive = 1 if barrons_rank == "Competitive" | barrons_rank == "Special" | (college_name_first == "LIBERTY UNIVERSITY" & barrons_rank == "")
227
+
228
+ g noncompetitive = 0
229
+ replace noncompetitive = 1 if barrons_rank == "Non Competitive" | barrons_rank == "Unranked" | barrons_rank == "Less Competitive" | (college_name_first == "LANDMARK COLLEGE" & barrons_rank == "")
230
+
231
+ * generating graduation variables by aggregate ranks
232
+
233
+ g BA_byY6_hcompetitive = cmp_BA_byY6*hcompetitive
234
+ g BA_byY6_competitive = cmp_BA_byY6*competitive
235
+ g BA_byY6_noncompetitive = cmp_BA_byY6*noncompetitive
236
+ drop _m
237
+
238
+ foreach n of numlist 1/6 {
239
+ label var att_any_byY`n' "Attend Any by Y`n'"
240
+ label var att_2yr_byY`n' "Attend 2-Year by Y`n'"
241
+ label var att_4yr_byY`n' "Attend 4-Year by Y`n'"
242
+ }
243
+ foreach n of numlist 4/6 {
244
+ label var cmp_any_byY`n' "Complete BA or AA by Y`n'"
245
+ label var cmp_AA_byY`n' "Complete AA by Y`n'"
246
+ label var cmp_BA_byY`n' "Complete BA by Y`n'"
247
+ }
248
+
249
+ sort _all
250
+ compress
251
+ save "$data_clean\baseanalysisfile_ltc_lotto_`cmo'_`type'.dta", replace
252
+ } //end type loop
253
+ } // end cmo loop
254
+
255
+ * create combined file
256
+ /*
257
+ use "$data_clean\baseanalysisfile_ltc_lotto.dta", clear
258
+ drop if cmo_name=="ROCKETSHIP"
259
+ drop if cmo_name=="YES PREP"
260
+ drop if cmo_name=="ASPIRE PUBLIC SCHOOLS"
261
+ drop if cmo_name=="DEMOCRACY PREP"
262
+ drop if cmo_name=="INTERNATIONAL LEADERSHIP OF TEXAS"
263
+ drop if cmo_name=="GREEN DOT PUBLIC SCHOOLS"
264
+ drop if cmo_name=="HARMONY PUBLIC SCHOOLS"
265
+
266
+ save "$data_clean\old_wide.dta", replace
267
+ */
268
+ foreach type in wide long {
269
+ use "$data_clean\baseanalysisfile_ltc_lotto_aspire_`type'.dta", replace
270
+ foreach cmo_minus of global cmo_minus {
271
+ append using "$data_clean\baseanalysisfile_ltc_lotto_`cmo_minus'_`type'.dta", force
272
+ }
273
+ sort sid_cepr
274
+ compress
275
+ save "$data_clean\baseanalysisfile_ltc_lotto_combined_`type'.dta", replace
276
+
277
+ }
278
+
279
+ } // end analysis_file loop
280
+
281
+ if $analysis==1{
282
+ foreach cmo of global cmo_plus {
283
+
284
+ use "$data_clean\baseanalysisfile_ltc_lotto_`cmo'_wide.dta", clear
285
+
286
+ *set up offer/outcome types
287
+ if "`cmo'" == "ilt" {
288
+ global offer initial_offer
289
+ global outcomes att_any_byY2 att_4yr_byY2 att_2yr_byY2
290
+ }
291
+ else {
292
+ global offer initial_offer offer
293
+ global outcomes att_any_byY2 att_4yr_byY2 att_2yr_byY2 cmp_any_byY6 cmp_BA_byY6 cmp_AA_byY6
294
+ }
295
+
296
+ cap g late_app = 0
297
+ cap g application_cancel = 0
298
+ cap replace initial_offer = 0 if initial_offer ==.
299
+
300
+ *basic setup
301
+ drop if application_cancel==1
302
+ drop if late_app==1
303
+
304
+ bys sid_cepr: gen ww = _N
305
+ gen w = 1/ww
306
+
307
+ *identify degenerate lotteries
308
+ bys risk_set: gen risk_set_count = _N
309
+ bys risk_set: egen risk_set_offer = sum(offer)
310
+ g degenerate = risk_set_count == risk_set_offer
311
+ g nondegenerate = 1-degenerate
312
+ g all = 1
313
+
314
+ tempfile results_`cmo'
315
+ postfile t str32( model offertype lottotype outcome) mean_control beta se n using `results_`cmo'', replace
316
+
317
+ foreach offertype in $offer {
318
+ foreach lottotype in all nondegen{
319
+ reghdfe p_his `offertype' [aw = w] if cohort<=2025&`lottotype'==1, absorb(risk_set) cluster(sid_cepr)
320
+ local beta = _b[`offertype']
321
+ local se = _se[`offertype']
322
+ local n = e(N)
323
+ qui margins , at(`offertype'=0)
324
+ local mean = r(b)[1,1]
325
+ post t ("Balance") ("`offertype'") ("`lottotype'") ("Percent Hispanic") (`mean') (`beta') (`se') (`n')
326
+ }
327
+ }
328
+
329
+ foreach offertype in $offer {
330
+ foreach lottotype in all nondegen{
331
+ reghdfe enroll `offertype' [aw = w] if cohort<=2025&`lottotype'==1, absorb(risk_set) cluster(sid_cepr)
332
+ local beta = _b[`offertype']
333
+ local se = _se[`offertype']
334
+ local n = e(N)
335
+ qui margins , at(`offertype'=0)
336
+ local mean = r(b)[1,1]
337
+ post t ("First Stage") ("`offertype'") ("`lottotype'") ("Enroll") (`mean') (`beta') (`se') (`n')
338
+ }
339
+ }
340
+
341
+ foreach var in $outcomes {
342
+ local label : variable label `var'
343
+ foreach offertype in $offer {
344
+ foreach lottotype in all nondegen{
345
+
346
+ reghdfe `var' `offertype' [aw = w] if nsc_sample==1 & cohort<=2025& `lottotype'==1, absorb(risk_set) cluster(sid_cepr)
347
+ local beta = _b[`offertype']
348
+ local se = _se[`offertype']
349
+ local n = e(N)
350
+ qui margins , at(`offertype'=0)
351
+ local mean = r(b)[1,1]
352
+ post t ("Reduced Form") ("`offertype'") ("`lottotype'") ("`label'") (`mean') (`beta') (`se') (`n')
353
+
354
+ ivreghdfe `var' (enroll = `offertype') if nsc_sample==1 & cohort<=2025& `lottotype'==1, ///
355
+ absorb(risk_set) cluster(sid_cepr)
356
+ local beta = _b[enroll]
357
+ local se = _se[enroll]
358
+ local n = e(N)
359
+ *retain mean from above
360
+ post t ("2SLS") ("`offertype'") ("`lottotype'") ("`label'") (`mean') (`beta') (`se') (`n')
361
+
362
+ }
363
+ }
364
+ }
365
+
366
+ postclose t
367
+
368
+ preserve
369
+ use `results_`cmo'', clear
370
+ export excel using "$output\basic_results_`cmo'_20260608.xlsx", replace firstrow(variables)
371
+ restore
372
+
373
+ } //end cmo loop
374
+ } //end analysis loop