Stata Command: dkdensity

Stata Command: dkdensity.ado

The "deconvolution" identifies the distribution of Xi even if Xi is not observed, but with two measurements X1i and X2i of Xi with measurement errors e1i = X1i - Xi and e2i = X2i - Xi, respectively. The graph below depicts a deconvolution kernel density estimate for the distribution of total factor productivity (TFP), ω1982,i, of Chilean firms in the food industry in 1982 along with its 95% uniform confidence band (Kato and Sasaki, 2018). The residuals of production functions in 1982 and 1983 are r1982,i = ω1982,i + ε1982,i. and r1983,i = ω1983,i + ε1983,i = ω1982,i + η1983,i + ε1983,i, where ω denotes productivity, η denotes a productivity shock, and ε denotes an idiosyncratic shock. Therefore, X1i = r1982,i and X2i = r1983,i serve as repeated measurement for Xi = ω1982,i with measurement errors, e1i = ε1982,i and e2i = η1983,i + ε1983,i, respectively. The graph is automatically produced by the Stata command dkdensity as follows:

TFP1982

Installation:

. ssc install dkdensity

Usage:

. use "example_1982_1983.dta"

. dkdensity resid1982 resid1983, numx(100) domain(4)

Help:

. help dkdensity

Reference: Kato, K. and Y. Sasaki (2018) Uniform Confidence Bands in Deconvolution with Unknown Error Distribution. Journal of Econometrics, 207 (1), pp. 129-161. Paper.

Title
dkdensity -- Executes deconvolution kernel density estimation and a construction of its uniform confidence band.
Syntax
dkdensity x1 x2 [if] [in] [, numx(real) domain(real) cover(real) tp(real)]
Description
dkdensity executes deconvolution kernel density estimation and a construction of its uniform confidence band based on Kato and Sasaki (2018). The command requires as input two measurements, x1 and x2, of the unobserved latent variable x with classical measurement errors, e1 = x1 - x and e2 = x2 - x, respectively. The output consists of a deconvolution kernel density estimates of f(x) and their uniform confidence band over a domain of x.
Options
numx(real) sets the number of grid points of x for deconvolution kernel density estimation and its uniform confidence band. The default value is numx(20).
domain(real) sets the domain of deconvolution kernel density estimation and its uniform confidence band. The default value domain(2) defines the domain as +/- 2 standard deviations of x.
cover(real) sets the nominal uniform coverage probability for the uniform confidence band. The default value cover(0.95) constructs a 95% uniform confidence band.
tp(real) sets the scale-normalized tuning parameter. The default value is tp(0.2).
Examples
Total factor productivity of individual firms in Chile (x1982 first measurement of x, x1983 second measurement of x)
Constructing a uniform confidence band in the domain corresponding to +/- 4 standard deviations of x:
. use "example_1982_1983.dta" . dkdensity x1982 x1983, numx(100) domain(4)
Construction of a 90% uniform confidence band:
. use "example_1982_1983.dta" . dkdensity x1982 x1983, numx(100) domain(4) cover(0.90)
Stored results
dkdensity stores the following in e():
Scalars r(N) observations
Macros r(cmd) dkdensity
Matrices r(x) vector of x r(fx) vector of density values r(lower) confidence band (lower boundary) r(upper) confidence band (upper boundary)
Reference
Kato, K. and Y. Sasaki. 2018. Uniform Confidence Bands in Deconvolution with Unknown Error Distribution. Journal of Econometrics, 207 (1), pp. 129-161. Link to Paper.
Authors
Kengo Kato, Cornell University, Ithaca, NY. Yuya Sasaki, Vanderbilt University, Nashville, TN.