[G-2] twoway__kdensity_gen -- twoway kdensity subroutine
twoway__kdensity_gen varname [weight] [if exp] [in in_range] ,
[ n(#) bwidth(#) area(#) generate(yvar xvar [, replace ])
kernel(kernel) kernel_names ]
fweights and aweights are allowed; see weights.
twoway__kdensity_gen was written to help in parsing and generating
variables for graph twoway kdensity, see [G-2] twoway kdensity.
range(range) specifies the range of values for xvar. Here range can be a
pair of numbers identifying the minimum and maximum, or range can be
a variable. If range is a variable, the range is determined by the
values of r(min) and r(max) after
. summarize range if exp in in_range, meanonly
n(#) specifies the number of evaluation points. The default is n(1).
bwidth(#) specifies the smoothing parameter. This is the same bwidth()
option as for kdensity, see [R] kdensity. The old width() option is
area(#) specifies the area adjustment. The number is multiplied with the
kernel density estimates when yvar is generated. The default value
generate(yvar xvar [, replace]) specifies the names of the variables to
generate. The grid of values is placed in xvar, and kernel density
estimates are placed in yvar. The replace option indicates that
these variables may be replaced if they already exist.
kernel(kernel) specifies kernel weight functions in kernel where kernel
is defined in kdensity##kernel.
kernel_names are the names for kernel weight functions accepted by
kdensity. This old syntax may not be combined with the new syntax
twoway__kdensity_gen stores the following in r():
r(n) number of evaluation points
r(min) minimum of range()
r(max) maximum of range()
r(delta) distance between grid points
r(area) area multiplier
r(width) smoothing parameter
r(range) range from range(range) option
r(kernel) name of kernel used to compute density estimates