-
Notifications
You must be signed in to change notification settings - Fork 3
/
nprobust_illustration.do
69 lines (56 loc) · 3.51 KB
/
nprobust_illustration.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
********************************************************************************
** NPROBUST Stata Package
** Do-file for Empirical Illustration
** Authors: Sebastian Calonico, Matias D. Cattaneo, Max H. Farrell
********************************************************************************
** hlp2winpdf, cdn(lprobust) replace
** hlp2winpdf, cdn(kdrobust) replace
** hlp2winpdf, cdn(lpbwselect) replace
** hlp2winpdf, cdn(kdbwselect) replace
********************************************************************************
** net install nprobust, from(https://sites.google.com/site/nppackages/nprobust/stata) replace
********************************************************************************
clear all
set more off
set scheme sj
use nprobust_data.dta, clear
********************************************************************************
** generate grid points from 250 to 350 by 5
********************************************************************************
gen grid = 245 + 5 * _n if _n <= 21
********************************************************************************
** Kernel Density Estimation with Robust Bias-Corrected Confidence Intervals using MSE-DPI optimal bandwidth.
********************************************************************************
kdrobust chol1 if t==0, eval(grid) plot graph_options(name(chol1_t0)) bwselect(imse-dpi)
kdrobust chol1 if t==1, eval(grid) plot graph_options(name(chol1_t1)) bwselect(imse-dpi)
graph combine chol1_t0 chol1_t1
kdrobust chol2 if t==0, eval(grid) plot graph_options(name(chol2_t0)) bwselect(imse-dpi)
kdrobust chol2 if t==1, eval(grid) plot graph_options(name(chol2_t1)) bwselect(imse-dpi)
graph combine chol2_t0 chol2_t1
kdrobust cholf if t==0, eval(grid) plot graph_options(name(cholf_t0)) bwselect(imse-dpi)
kdrobust cholf if t==1, eval(grid) plot graph_options(name(cholf_t1)) bwselect(imse-dpi)
graph combine cholf_t0 cholf_t1
kdrobust comp if t==0, plot graph_options(name(comp_t0)) bwselect(imse-dpi)
kdrobust comp if t==1, plot graph_options(name(comp_t1)) bwselect(imse-dpi)
graph combine comp_t0 comp_t1
********************************************************************************
** Local Polynomial Regression with Robust Bias-Corrected Confidence Intervals using MSE-DPI optimal bandwidth.
********************************************************************************
lprobust cholf chol1 if t==0, eval(grid) bwcheck(21) plot graph_options(name(cholf_t0))
lprobust cholf chol1 if t==1, eval(grid) bwcheck(21) plot graph_options(name(cholf_t1))
graph combine cholf_t0 cholf_t1
lprobust comp chol1 if t==0, eval(grid) bwcheck(21) plot graph_options(name(comp_t0))
lprobust comp chol1 if t==1, eval(grid) bwcheck(21) plot graph_options(name(comp_t1))
graph combine comp_t0 comp_t1
lprobust cholf chol2 if t==0, eval(grid) bwcheck(21) plot graph_options(name(cholf_t0))
lprobust cholf chol2 if t==1, eval(grid) bwcheck(21) plot graph_options(name(cholf_t1))
graph combine cholf_t0 cholf_t1
lprobust comp chol2 if t==0, eval(grid) bwcheck(21) plot graph_options(name(comp_t0))
lprobust comp chol2 if t==1, eval(grid) bwcheck(21) plot graph_options(name(comp_t1))
graph combine comp_t0 comp_t1
********************************************************************************
** Optimal Bandwidth selectors for Local Polynomial Regression
********************************************************************************
lpbwselect cholf chol1 if t==0, eval(grid)
lpbwselect cholf chol1 if t==0, bwselect(ce-dpi) eval(grid)
lpbwselect cholf chol1 if t==0, bwselect(all) eval(grid)