-
Notifications
You must be signed in to change notification settings - Fork 0
/
scaling.do
57 lines (42 loc) · 1.54 KB
/
scaling.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
/*******************************************************************************
Create 100 scale transformations
for years 1 and 2
*******************************************************************************/
////// 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 2
keep if year == 1 | year == 2
* 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'
}
* Keep only people observed twice
duplicates tag childuniqueid, gen(dup)
drop if dup==0
drop dup
* Reshape scores wide
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) nogen
* Save the test scores transformed data
save "$gituser/2_build/testcores_y1y2_wide.dta", replace
* Scale transformation
scale_transformation, type(1) score1(total_mle1) score2(total_mle2) compgroup(reportcard) iterations(100) save("$gituser/scaling/iterations100.dta")