**[TE] tebalance density** -- Covariate balance density

__Syntax__

Density plots for the propensity score

**tebalance** **density** [**,** *options*]

Density plots for a covariate

**tebalance** **density** *varname* [**,** *options*]

*options* Description
-------------------------------------------------------------------------
Main
**kernel(***kernel***)** specify the kernel function; default is
**kernel(epanechnikov)**
__bw__**idth(****#***)** rescale default bandwidth
**line***#***opts(***line_options***)** **twoway line** options for density line number *#*
*twoway_options* any options other than **by()** documented in
**[G-3]** *twoway_options*
__byop__**ts(***byopts***)** how subgraphs are combined, labeled, etc.
-------------------------------------------------------------------------

*kernel* Description
-------------------------------------------------------------------------
__tri__**angle** triangle kernel function; the default
__ep__**anechnikov** Epanechnikov kernel function
**epan2** alternative Epanechnikov kernel function
__bi__**weight** biweight kernel function
__cos__**ine** cosine trace kernel function
__gau__**ssian** Gaussian kernel function
__par__**zen** Parzen kernel function
__rec__**tangle** rectangle kernel function
-------------------------------------------------------------------------

__Menu__

**Statistics > Treatment effects > Balance > Graphs**

__Description__

**tebalance density** produces kernel density plots that are used to check
for covariate balance after estimation by a **teffects**
inverse-probability-weighted estimator, a **teffects** matching estimator, or
an **stteffects** inverse-probability-weighted estimator.

__Options__

+------+
----+ Main +-------------------------------------------------------------

**kernel(***kernel***)** specifies the kernel function for use in calculating the
kernel density estimates. The default kernel is the
**kernel(epanechnikov)**.

**bwidth(****#***)** specifies the factor by which the default bandwidths are to be
rescaled. A bandwidth is the half-width of the kernel, the width of
the density window around each point. Each kernel density plot has
its own bandwidth, and by default, each kernel density plot uses its
own optimal bandwidth; see **[R] kdensity**. **bwidth()** rescales each
plot's optimal bandwidth by the specified amount.

**line***#***opts(***line_options***)** specifies the line pattern, width, color, and
overall style of density line number *#*. The line numbers are in the
same order as the treatment levels specified in **e(tlevels)**.

*twoway_options* are any of the options documented in **[G-3]** *twoway_options*,
excluding **by()**. These include options for titling the graph (see
**[G-3]** *title_options*) and for saving the graph to disk (see **[G-3]**
*saving_option*). **tebalance density** uses **by()** to differentiate between
raw and weighted or matched samples, and some *twoway_options* will be
repeated for by **graph** and might be better specified as **byopts()**.

**byopts(***by_option***)** is as documented in **[G-3]** *by_options*. **byopts()** affects
how the subgraphs are combined, labeled, etc. **byopts()** generally
affects the entire graph, and some *by_option* may be better specified
as *twoway_options*; see **[G-3]** *twoway_options*.

__Example__

Setup
**. webuse cattaneo2**

Estimate the effect of a mother's smoking behavior (**mbsmoke**) on the
birthweight of her child (**bweight**), controlling for marital status
(**mmarried**), the mother's age (**mage**), whether the mother had a prenatal
doctor's visit in the baby's first trimester (**prenatal1**), and whether
this baby is the mother's first child (**fbaby**)
**. teffects psmatch (bweight) (mbsmoke mmarried mage prenatal1 fbaby),**
**generate(matchv)**

Look at the default density plots
**. tebalance density mage**

__Stored results__

After **teffects** or **stteffects** fits a binary treatment, **tebalance density**
stores the following in **r()**:

Scalars
**r(bwc_adj)** bandwidth for control in weighted or
matched-adjusted sample
**r(Nc_adj)** observations on control in weighted or
matched-adjusted sample
**r(bwt_adj)** bandwidth for treated in weighted or
matched-adjusted sample
**r(Nt_adj)** observations on treated in weighted or
matched-adjusted sample
**r(bwc_raw)** bandwidth for control in raw sample
**r(Nc_raw)** observations on control in raw sample
**r(bwt_raw)** bandwidth for treated in raw sample
**r(Nt_raw)** observations on treated in raw sample

Macros
**r(kernel)** name of kernel

After **teffects** or **stteffects** fits a multivalued treatment, **tebalance**
**density** stores the following in **r()**:

Scalars
**r(bw***#***_adj)** bandwidth for treatment level *#* in weighted or
matched-adjusted sample
**r(N***#***_adj)** observations on treatment level *#* in weighted or
matched-adjusted sample
**r(bw***#***_raw)** bandwidth for treatment level *#* in raw sample
**r(N***#***_raw)** observations on treatment level *#* in raw sample

Macros
**r(kernel)** name of kernel