⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 twoway_histogram.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 08apr2005}{...}
{cmd:help twoway histogram} {right:dialogs:  {dialog twoway_overlay:overlaid twoway}{space 0}}
	{right:{dialog twoway_simple:single twoway}{space 2}}
{hline}
{* index histograms}{...}
{* index discrete tt option}{...}
{* index bin() tt option}{...}
{* index width() tt option}{...}
{* index start() tt option}{...}
{* index density tt option}{...}
{* index fraction tt option}{...}
{* index frequency tt option}{...}
{* index percent tt option}{...}
{* index gap() tt option}{...}

{title:Title}

{p2colset 5 35 37 2}{...}
{p2col :{hi:[G] graph twoway histogram} {hline 2}}Histogram plots{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 15 2}
{cmdab:tw:oway}
{cmdab:hist:ogram}
{it:varname}
{ifin}
{weight}
[{cmd:,}
[{it:discrete_options}|{it:continuous_options}]
{it:common_options}]

{p2colset 9 38 42 5}{...}
	{it:discrete_options}{col 38}description
	{hline 65}
	{cmdab:disc:rete}{...}
{col 38}specify data are discrete
	{cmdab:w:idth:(}{it:#}{cmd:)}{...}
{col 38}width of bins in {it:varname} units
	{cmd:start(}{it:#}{cmd:)}{...}
{col 38}theoretical minimum value
	{hline 65}

	{it:continuous_options}{col 38}description
	{hline 65}
	{cmd:bin(}{it:#}{cmd:)}{...}
{col 38}{it:#} of bins
	{cmdab:w:idth:(}{it:#}{cmd:)}{...}
{col 38}width of bins in {it:varname} units
	{cmd:start(}{it:#}{cmd:)}{...}
{col 38}lower limit of first bin
	{hline 65}

	{it:common_options}{col 38}description
	{hline 65}
	{cmdab:den:sity}{...}
{col 38}draw as density; the default
	{cmdab:frac:tion}{...}
{col 38}draw as fractions
	{cmdab:freq:uency}{...}
{col 38}draw as frequencies
	{cmdab:percent}{...}
{col 38}draw as percents

	{cmdab:vert:ical}{...}
{col 38}vertical bars; the default
	{cmdab:hor:izontal}{...}
{col 38}horizontal bars
	{cmd:gap(}{it:#}{cmd:)}{...}
{col 38}reduce width of bars, 0{ul:<}{it:#}<100

INCLUDE help gr_baropt

INCLUDE help gr_axlnk

INCLUDE help gr_twopt
	{hline 65}

{phang}
{cmd:fweight}s are allowed; see {help weight}.


{title:Description}

{pstd}
{cmd:twoway} {cmd:histogram} draws histograms of {it:varname}.
Also see {helpb histogram} for an easier-to-use alternative.


{title:Options for use in the discrete case}

{phang}
{cmd:discrete}
    specifies that {it:varname} is discrete and that each unique
    value of {it:varname} be given its own bin (bar of histogram).

{phang}
{cmd:width(}{it:#}{cmd:)}
    is rarely specified in the discrete case; it specifies the width of the
    bins.  The default is {cmd:width(}{it:d}{cmd:)}, where {it:d} is the
    observed minimum difference between the unique values of {it:varname}.

{pmore}
    Specify {cmd:width()} if you are concerned that your data are sparse.  For
    example, {it:varname} could in theory take on the values 1, 2, 3, ..., 9,
    but due to sparseness, perhaps only the values 2, 4, 7, and 8 are
    observed.  In this case, the default width calculation would produce
    {cmd:width(2)}, and you would want to specify {cmd:width(1)}.

{phang}
{cmd:start(}{it:#}{cmd:)}
    is also rarely specified in the discrete case; it specifies the
    theoretical minimum value of {it:varname}.  The default is
    {cmd:start(}{it:m}{cmd:)}, where {it:m} is the observed minimum
    value.

{pmore}
    As with {cmd:width()}, specify {cmd:start()} when you are concerned
    about sparseness.  In the previous example, you would also
    want to specify {cmd:start(1)}.  Note that {cmd:start()} does nothing
    more than add white space to the left side of the graph.

{pmore}
    {cmd:start()}, if specified, must be less than or equal to {it:m},
    or an error will be issued.


{title:Options for use in the continuous case}

{phang}
{cmd:bin(}{it:#}{cmd:)}
and
{cmd:width(}{it:#}{cmd:)}
    are alternatives that specify how the data are to be aggregated into
    bins.  {cmd:bin()} specifies the number of bins (from which the width
    can be derived), and {cmd:width()} specifies the bin width (from which
    the number of bins can be derived).

{pmore}
    If neither option is specified, the
    results are the same as if {cmd:bin(}{it:k}{cmd:)} were specified, where

{phang3}
{it:k} = min(sqrt({it:N}), 10*ln({it:N})/ln(10))

{pmore}
    and where {it:N} is the number of nonmissing observations of {it:varname}.

{phang}
{cmd:start(}{it:#}{cmd:)}
    specifies the theoretical minimum of {it:varname}.  The default is
    {cmd:start(}{it:m}{cmd:)}, where {it:m} is the observed minimum value of
    {it:varname}.

{pmore}
    Specify {cmd:start()} when you are concerned about sparse data.
    For instance, you might know that {it:varname} can go down to 0, but you
    are concerned that 0 may not be observed.

{pmore}
    {cmd:start()}, if specified, must be less than or equal to {it:m},
    or else an error will be issued.


{title:Options for use in both the discrete and continuous cases}

{phang}
{cmd:density},
{cmd:fraction},
{cmd:frequency}, and
{cmd:percent}
    are alternatives that specify whether you want the histogram scaled to
    density, fractional, or frequency units, or percentages.  {cmd:density} is
    the default.

{pmore}
    {cmd:density} scales the height of the bars so that the sum of their areas
    equals 1.

{pmore}
    {cmd:fraction} scales the height of the bars so that the sum of their
    heights equals 1.

{pmore}
    {cmd:frequency} scales the height of the bars so that each bar's
    height is equal to the number of observations in the category, and thus
    the sum of the heights is equal to the total number of nonmissing
    observations of {it:varname}.

{pmore}
    {cmd:percent} scales the height of the bars so that the sum of their
    heights equals 100.

{phang}
{cmd:vertical}
and
{cmd:horizontal}
    specify whether the bars are to be drawn
    vertically (the default) or horizontally.

{phang}
{cmd:gap(}{it:#}{cmd:)}
    specifies that the bar width be reduced by {it:#} percent.
    {cmd:gap(0)} is the default; {cmd:histogram} sets the width so that
    adjacent bars just touch.  If you wanted gaps between the bars, you 
    would specify, for instance, {cmd:gap(5)}.

{pmore}
    Also see {helpb twoway rbar} for other ways to set the display width
    of the bars.  Histograms are actually drawn using {cmd:twoway rbar} with a
    restriction that 0 be included in the bars; {cmd: twoway histogram} will
    accept any options allowed by {cmd:twoway rbar}.

{* fill areas, dimming and brightening}{...}
{* index colors, dimming and brightening}{...}
{* index color() tt option}{...}
{* index color intensity adjustment}{...}
{* index intensity, color, adjustment}{...}
INCLUDE help gr_baroptf

INCLUDE help gr_axlnkf

INCLUDE help gr_twoptf


{title:Remarks}

{pstd}
Remarks are presented under the headings

        {help twoway histogram##remarks1:Relationship between graph twoway histogram and histogram}
        {help twoway histogram##remarks2:Typical use}
        {help twoway histogram##remarks3:Use with by()}
        {help twoway histogram##remarks4:History}


{marker remarks1}{...}
{title:Relationship between graph twoway histogram and histogram}

{pstd}
{cmd:graph} {cmd:twoway} {cmd:histogram}{hline 2}documented here{hline 2}and
{cmd:histogram}{hline 2}documented in {helpb histogram}{hline 2}are almost the
same command.  {cmd:histogram} has the advantages that

{phang2}
    1.  it allows overlaying of a normal density or a kernel estimate of the
	density;

{phang2}
    2.  if a density estimate is overlaid, it scales the density to reflect
	the scaling of the bars.

{pstd}
{cmd:histogram} is implemented in terms of {cmd:graph}
{cmd:twoway} {cmd:histogram}.


{marker remarks2}{...}
{title:Typical use}

{pstd}
When you do not specify otherwise, {cmd:graph} {cmd:twoway} {cmd:histogram}
assumes that the variable is continuous:

	{cmd:. sysuse lifeexp, clear}

	{cmd:. tw histogram le}
	  {it:({stata "gr_example lifeexp: tw histogram le":click to run})}
{* graph gthist1}{...}

{pstd}
Even with a continuous variable, you may specify the {cmd:discrete} option
to see the individual values:

	{cmd:. tw histogram le, discrete}
	  {it:({stata "gr_example lifeexp: tw histogram le, discrete":click to run})}
{* graph gthist2}{...}


{marker remarks3}{...}
{title:Use with by()}

{pstd}
{cmd:graph} {cmd:twoway} {cmd:histogram} may be used with {cmd:by()}:

	{cmd:. sysuse lifeexp, clear}

	{cmd:. tw histogram le, discrete by(region, total)}
	  {it:({stata "gr_example lifeexp: tw histogram le, discrete by(region, total)":click to run})}
{* graph gthist3}{...}

{pstd}
In this case, specifying {cmd:frequency} is a good way to show both the
distribution and the overall contribution to the total:

{phang2}
	{cmd:. tw histogram le, discrete freq by(region, total)}
{p_end}
	  {it:({stata "gr_example lifeexp: tw histogram le, discrete freq by(region, total)":click to run})}
{* graph gthist4}{...}

{pstd}
The height of the bars reflects the number of countries.
In this case{hline 2}and in all the above examples{hline 2}we would do better
by obtaining population data on the countries and then typing

{phang2}
	{cmd:. tw histogram le [fw=pop], discrete freq by(region, total)}

{pstd}
so that bar height reflected total population.


{* index histories}{...}
{* index Beniger and Robyn}{...}
{* index Guerry, A. M.}{...}
{* index Pearson, Karl}{...}
{marker remarks4}{...}
{title:History}

{pstd}
According to Beniger and Robyn (1978, 4), although A. M. Guerry published a
histogram in 1833, the word "histogram" was first used by Karl Pearson in
1895.


{title:Also see}

{psee}
Manual:  {bf:[G] graph twoway histogram}

{psee}
Online:  
{helpb histogram};
{helpb twoway kdensity}
{p_end}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -