*! version 1.0.0 05-26-2019

Title

ikbw -- computes optimal bandwidth for sharp RD, with local linear regressions and triangular kernel, following
Imbens and Kalyanaraman(2012).

Data

You need to have a dataset with one outcome variable (Y) and one forcing variable (X).

Syntax

ikbw varlist(numeric) [if] [in],
[CUToff(numlist)]

where the capital letters indicate how you can abbreviate option names.

varlist: (required) enter the list of variables you want to regress in this order: outcome variable (Y) and forcing variable (X).

[if] or [in]: (optional) like in any other STATA command, to restrict the sample you want to obtain your estimates from.

cutoff(numlist) or cut(numlist): (optional) the threshold that determines sharp assignment of treatment.
Individuals with forcing variable greater than or equal to the threshold are treated; otherwise, they are untreated.
The default value for cutoff is zero.

The code returns the scalars e(hwid): the optimal bandwidth;
and e(flag): number of singular matrices encountered during execution, in which case a pseudo-inverse is used.

Example

Estimate the optimal IK bandwidth

. ikbw Y X

Estimate the optimal IK bandwidth using the specified threshold c

. ikbw Y X, cut(c)

References

Imbens, G., and Kalyanaraman, K. (2012),
Optimal Bandwidth Choice for the Regression Discontinuity Estimator.
The Review of Economic Studies, Volume 79, Issue 3, Pages 933-959.

Contributor to this Code:

Wei Qian, University of Notre Dame.