Stata 15 help for twoway__histogram_gen

Title

[G-2] twoway__histogram_gen -- Histogram subroutine

Syntax

twoway__histogram_gen varname [weight] [if exp] [in range] [, {discrete_options|continuous_options} common_options]

where discrete_options are

discrete_options Description ----------------------------------------------------------------- discrete specify data are discrete width(#) width of bins in varname units start(#) theoretical minimum value -----------------------------------------------------------------

and where continuous_options are

continuous_options Description ----------------------------------------------------------------- bin(#) # of bins width(#) width of bins in varname units start(#) lower limit of first bin -----------------------------------------------------------------

and where common_options are

common_options Description ----------------------------------------------------------------- density draw as density (default) fraction draw as fractions frequency draw as frequencies

generate(h x [, replace ]) generate variables

display display (bin) start and width ----------------------------------------------------------------

fweights are allowed; see weights.

Description

twoway__histogram_gen generates a variable containing densities, frequencies, or fractions of the occurrence of bins (class intervals) of varname.

This tool was written for generating histograms, see [G-2] graph twoway histogram.

Options

discrete_options affect the parameters needed to draw a discrete histogram. See [R] histogram for more details.

continuous_options affect the parameters needed to draw a continuous histogram. See [R] histogram for more details.

density, fraction, and frequency are alternatives. They specify whether you want the histogram scaled to density units, fractional units, or frequency. density is the default. See [R] histogram for more details.

generate(h x [, replace]) specifies the names of the variables to generate. The height of each bin will be placed in h, and the center of each bin will be placed in x. The replace option indicates that these variables may be replaced if they already exist.

display indicates that a short note be displayed indicating the number of bins, the lower limit of the first bin, and the width of the bins. The output displayed is determined by whether the discrete option was specified.

Stored results

twoway__histogram_gen stores the following in r():

Scalars:

r(N) number of observations r(bin) number of bins r(width) common width of the bins r(start) start() value or minimum value of varname r(min) lower limit of the first non-empty bin r(max) upper limit of the last bin r(area) area of the bars

Macros:

r(type) "density", "fraction" or "frequency"


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