-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoot_impute.do
More file actions
40 lines (25 loc) · 803 Bytes
/
Copy pathBoot_impute.do
File metadata and controls
40 lines (25 loc) · 803 Bytes
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
use "Data/missings_high.dta", clear
cap program drop boot_impute
program define boot_impute, rclass
preserve
mi set flong
mi register imputed wage hours ttl_exp age
mi impute chained (pmm, knn(5)) age ttl_exp hours wage ///
= wage0 grade tenure, add(35) rseed(723)
local mi_r2 = 0
mi describe
local mtotal = r(M)
forvalues i = 1/`mtotal' {
reg wage hours tenure ttl_exp grade age if _mi_m == `i'
local mi_r2 = `mi_r2' + e(r2)
}
return scalar mi_r2 = `mi_r2' / `mtotal'
restore
end
*bootstrap result=r(mi_r2), reps(20) seed(632): boot_impute
*estat bootstrap, percentile
*** Parallel ***
parallel initialize 5
parallel bs, expression(result=r(mi_r2)) reps(2000) seed(11 23 45 56 83) saving("Data/res_bootimpute.dta", replace): ///
boot_impute
estat bootstrap, percentile