-
Notifications
You must be signed in to change notification settings - Fork 0
/
scaling-y1y5.do
82 lines (54 loc) · 2.43 KB
/
scaling-y1y5.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*******************************************************************************
Create 100 scale transformations
for years 1 and 5
*******************************************************************************/
////// Set up //////
* Load the file paths
do "$gituser/_filepaths.do"
* Ado path
adopath ++ "$gituser/ado"
* Upload raw test scores
use "$dropboxuser/$public/school/master/public_child_irt_scores_panel.dta", clear
* Keep years 1 and 5
keep if year == 1 | year == 5
* Keep kids tested twice
duplicates tag childuniqueid, gen(dup)
tab dup
keep if dup==1
drop dup
* Keep score vars of interest
drop *_pv*
drop *mle_se
drop district_name
drop *eap
* Gen the average test score
egen total_mle = rowmean(eng_theta_mle math_theta_mle urdu_theta_mle)
* Ren test score vars
foreach var of varlist *_theta_mle {
local varname = "`var'"
local newname = subinstr("`varname'", "theta_", "", .)
rename `var' `newname'
}
* Reshape scores wide
drop childcode hhid mid
reshape wide district mauzaid schoolid total_mle eng_mle math_mle urdu_mle, i(childuniqueid) j(year)
* Use the round 1 district/mauza for treatment assignment value
ren district1 district
ren mauzaid1 mauzaid
ren schoolid1 schoolid
* Merge in reportcard info
merge m:1 mauzaid using "$dropboxuser/$RCT/mauzas.dta", assert(3 2) keep(3)
* Save the test scores transformed data
save "$gituser/2_build/testcores_y1y5_wide.dta", replace
* Scale transformation : max gap
use "$gituser/2_build/testcores_y1y5_wide.dta", clear
scale_transformation, type(1) score1(total_mle1) score2(total_mle5) compgroup(reportcard) iterations(100) robust(20) monotonicity(2) save("$gituser/scaling/iterations100-y5-max.dta") //28minutes run time
* Scale transformation : min gap
use "$gituser/2_build/testcores_y1y5_wide.dta", clear
scale_transformation, type(2) score1(total_mle1) score2(total_mle5) compgroup(reportcard) iterations(100) robust(20) monotonicity(2) save("$gituser/scaling/iterations100-y5-min.dta")
* Scale transformation : max correlation
use "$gituser/2_build/testcores_y1y5_wide.dta", clear
scale_transformation, type(3) score1(total_mle1) score2(total_mle5) iterations(100) monotonicity(2) save("$gituser/scaling/iterations100-y5-corr.dta")
* Scale transformation : max r2
use "$gituser/2_build/testcores_y1y5_wide.dta", clear
scale_transformation, type(5) score1(total_mle1) score2(total_mle5) iterations(100) monotonicity(2) save("$gituser/scaling/iterations100-y5-r2.dta")