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

📄 histogram.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
📖 第 1 页 / 共 2 页
字号:
{smcl}
{* 23mar2005}{...}
{cmd:help histogram}{right:dialogs:  {bf:{dialog histogram}}  {dialog ehistogram:easy histogram}}
{hline}

{title:Title}

{p2colset 5 22 24 2}{...}
{p2col :{hi:[R] histogram} {hline 2}}Histograms for continuous and categorical variables
{p2colreset}{...}


{title:Syntax}

{p 8 18 2}
{opt hist:ogram}
{varname}
{ifin}
{weight}
[{cmd:,}
[{it:{help histogram##continuous_opts:continuous_opts}} {c |}
{it:{help histogram##discrete_opts:discrete_opts}}] {it:{help histogram##options:options}}]

{synoptset 34}{...}
{marker continuous_opts}{...}
{synopthdr :continuous_opts}
{synoptline}
{synopt :{opt bin(#)}}set number of bins to {it:#}{p_end}
{synopt :{opt w:idth(#)}}set width of bins to {it:#}{p_end}
{synopt :{opt start(#)}}set lower limit of first bin to {it:#}{p_end}
{synoptline}
{p2colreset}{...}

{synoptset 34}{...}
{marker discrete_opts}{...}
{synopthdr :discrete_opts}
{synoptline}
{synopt :{opt d:iscrete}}specify that the data are discrete{p_end}
{synopt :{opt w:idth(#)}}set width of bins to {it:#}{p_end}
{synopt :{opt start(#)}}set theoretical minimum value to {it:#}{p_end}
{synoptline}
{p2colreset}{...}

{synoptset 34 tabbed}{...}
{marker options}{...}
{synopthdr}
{synoptline}
{syntab :Main}
{synopt :{opt den:sity}}draw as density; the default{p_end}
{synopt :{opt frac:tion}}draw as fractions{p_end}
{synopt :{opt freq:uency}}draw as frequencies{p_end}
{synopt :{opt percent}}draw as percentages{p_end}
{synopt :{opt gap(#)}}add gap between bars, 0 {ul:<} {it:#} < 100{p_end}
{synopt :{it:{help twoway bar:bar_options}}}rendition of bars{p_end}

{syntab :Normal density}
{synopt :{opt norm:al}}add a normal density to the graph{p_end}
{synopt :{opth normop:ts(line_options)}}affect rendition of normal density

{syntab :KDE}
{synopt :{opt kden:sity}}add a kernel density estimate to the graph{p_end}
{synopt :{opth kdenop:ts(kdensity:kdensity_options)}}affect rendition of kernel density{p_end}

{syntab :Bar labels}
{synopt :{opt addl:abels}}add label heights to bars{p_end}
{synopt :{opth addlabop:ts(marker_label_options)}}affect rendition of labels{p_end}

{syntab :Add plot}
{synopt :{opth "addplot(addplot_option:plot)"}}add other plots to the histogram

{syntab :Y-Axis, X-Axis, Title, Caption, Legend, Overall, By}
{synopt :{it:{help twoway_options}}}any options documented in {bind:{bf:[G]} {it:twoway_options}}{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}{cmd:fweight}s are allowed; see {help weight}.


{title:Description}

{pstd}
{cmd:histogram} draws histograms of {varname}, which is assumed to be the name
of a continuous variable unless the {opt discrete} option is specified.


{title:Options for use in the continuous case}

{dlgtab:Main}

{phang}
{opt bin(#)} and {opt width(#)} are alternatives.  They specify how the data
are to be aggregated into bins; {opt bin()} by specifying the number of bins
(from which the width can be derived), and {opt width()} by specifying the bin
width (from which the number of bins can be derived).

{pmore}
If neither option is specified, results are as if {opt bin(k)} were specified,
where

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

{pmore}
    and where {it:N} is the (weighted) number of observations.

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

{pmore}
Specify {opt start()} when you are concerned about sparse data, for instance,
if you know that {it:varname} can have a value of 0, but you are concerned
that 0 may not be observed.

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


{title:Options for use in the discrete case}

{dlgtab:Main}

{phang}
{opt discrete} specifies that {varname} is discrete and that you want each
unique value of {it:varname} to have its own bin (bar of histogram).

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

{pmore} 
Specify {opt width()} if you are concerned that your data are sparse.
For example, in theory, {it:varname} could take on the values, say, 1, 2, 3,
..., 9, but due to the 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}
{opt start(#)} is also rarely specified in the discrete case; it specifies the
theoretical minimum value of {varname}.  The default is {opt start(m)},
where {it:m} is the observed minimum value.

{pmore}
As with {opt width()}, you specify {opt start(#)} if you are concerned that
your data are sparse.  In the previous example, you might also want to specify
{cmd:start(1)}.  Note that {opt start()} does nothing more than add white
space to the left side of the graph.

{pmore}
The value of {it:#} in {opt start()} must be less than or equal to {it:m}, or
an error will be issued.


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

{dlgtab:Main}

{phang}
{opt density},
{opt fraction},
{opt frequency}, and
{opt percent} specify whether you want the histogram scaled to density units,
fractional units, frequencies, or percentages.  {opt density} is the default.

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

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

{pmore}
{opt frequency} scales the height of the bars so that each individual bar's
height is equal to the number of observations in the category.  Thus the sum
of the heights is equal to the total number of observations.

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

{phang}
{opt gap(#)} specifies that the adjacent bars have a gap between them by
reducing the width by {it:#} percent.  {cmd:gap(0)} is the default.  By
default, {cmd:histogram} sets the width so that the adjacent bars just touch.
If you want gaps between the bars, specify, for instance, {cmd:gap(5)}.

{pmore}
Also see {it:bar_options} below for another way to set the display width of
the bars.

{phang}
{it:bar_options} are any of the labels allowed by {cmd:graph} {cmd:twoway}
{cmd:bar}; see {helpb twoway bar}.

{pmore}
One of the more useful {it:bar_options} is {opt barwidth(#)}, which specifies
the width of the bars in {it:varname} units.  By default, {cmd:histogram} draws
the bars so that adjacent bars just touch.  If you want gaps between the bars,
do not specify {cmd:histogram}'s {opt width()} option{hline 2}which would
change how the histogram is calculated{hline 2}but specify the {it:bar_option}
{opt barwidth()} or {cmd:histogram} option {opt gap}, both of which affect
only how the bar is rendered.

{pmore}
The {it:bar_option} {opt horizontal} cannot be used with the {cmd:addlabels}
option.

{dlgtab:Normal density}

{phang}
{opt normal} specifies that the histogram be overlaid with an appropriately
scaled normal density.  The normal will have the same mean and standard
deviation as the data.

{phang}
{opt normopts(line_options)}
    specifies details about the rendition of the normal curve, such as
    the color and style of line used.  See {helpb twoway line}.

{dlgtab:KDE}

{phang}
{opt kdensity} specifies that the histogram be overlaid with an
appropriately scaled kernel density estimate of the density.  By default, the
estimate will be produced using the Epanechnikov kernel with an "optimal"
halfwidth.  This default corresponds to the default of {opt kdensity}; see
{helpb kdensity}.  How the estimate is produced can be controlled using
the {opt kdenopts()} option described below.

{phang}
{opt kdenopts(kdensity_options)} specifies details about how the
kernel density estimate is to be produced along with details about the
rendition of the resulting curve, such as the color and style of line used.
This is described in {helpb twoway kdensity}.  As an example, if you
wanted to produce kernel density estimates using the Gaussian kernal with
optimal halfwidth, you would specify {cmd:kdenopts(gauss)} and if you also

⌨️ 快捷键说明

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