Stata 15 help for twoway__kdensity_gen

Title

[G-2] twoway__kdensity_gen -- twoway kdensity subroutine

Syntax

twoway__kdensity_gen varname [weight] [if exp] [in in_range] , range(range) [ n(#) bwidth(#) area(#) generate(yvar xvar [, replace ]) kernel(kernel) kernel_names ]

fweights and aweights are allowed; see weights.

Description

twoway__kdensity_gen was written to help in parsing and generating variables for graph twoway kdensity, see [G-2] twoway kdensity.

Options

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 also available.

area(#) specifies the area adjustment. The number is multiplied with the kernel density estimates when yvar is generated. The default value is area(1).

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 kernel().

Stored results

twoway__kdensity_gen stores the following in r():

Scalars:

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

Macros:

r(varname) varname r(range) range from range(range) option r(kernel) name of kernel used to compute density estimates


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index