📄 kdensity.hlp
字号:
{smcl}
{* 09mar2005}{...}
{cmd:help kdensity}{right:dialog: {bf:{dialog kdensity}}}
{hline}
{title:Title}
{p2colset 5 21 23 2}{...}
{p2col :{hi:[R] kdensity} {hline 2}}Univariate kernel density estimation{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 17 2}
{cmd:kdensity} {varname} {ifin} {weight} [{cmd:,} {it:options}]
{synoptset 29 tabbed}{...}
{synopthdr}
{synoptline}
{syntab :Main}
{synopt :{opt ep:anechnikov}}Epanechnikov kernel function; the default{p_end}
{synopt :{opt epan2}}alternative Epanechnikov kernel function{p_end}
{synopt :{opt bi:weight}}biweight kernel function{p_end}
{synopt :{opt cos:ine}}cosine trace{p_end}
{synopt :{opt gau:ssian}}Gaussian kernel function{p_end}
{synopt :{opt par:zen}}Parzen kernel function{p_end}
{synopt :{opt rec:tangle}}rectangle kernel function{p_end}
{synopt :{opt tri:angle}}triangle kernel function{p_end}
{synopt :{opth g:enerate(newvar:newvar_x newvar_d)}}store the estimation points in {it:newvar_x} and the density estimate in {it:newvar_d}{p_end}
{synopt :{opt width(#)}}halfwidth of kernel{p_end}
{synopt :{opt n(#)}}estimate density using {it:#} points; default is min(N, 50){p_end}
{synopt :{opt at(var_x)}}estimate density using the values specified by {it:var_x}{p_end}
{synopt :{opt nogr:aph}}suppress graph{p_end}
{syntab :Kernel plot}
{synopt :{it:{help cline_options}}}affect rendition of the plotted kernel density estimate{p_end}
{syntab :Density plots}
{synopt :{opt nor:mal}}add normal density to the graph{p_end}
{synopt :{opth normopts(cline_options)}}affect rendition of normal density{p_end}
{synopt :{opt stu:dent(#)}}add Student's t density with {it:#} degrees of freedom to the graph{p_end}
{synopt :{opth stopts(cline_options)}}affect rendition of the Student's t density{p_end}
{syntab :Add plot}
{synopt :{opth "addplot(addplot_option:plot)"}}add other plots to the generated graph{p_end}
{syntab :Y-Axis, X-Axis, Title, Caption, Legend, Overall}
{synopt :{it:{help twoway_options}}}any options other than {opt by()} documented in {bind:{bf:[G] {it:twoway_options}}}{p_end}
{synoptline}
{p2colreset}{...}
{pstd}
{cmd:fweight}s and {cmd:aweight}s are allowed; see {help weight}.
{title:Description}
{pstd}
{cmd:kdensity} produces kernel density estimates and graphs the result.
{title:Options}
{dlgtab:Main}
{phang}
{opt epanechnikov}, {opt epan2}, {opt biweight}, {opt cosine}, {opt gaussian},
{opt parzen}, {opt rectangle}, and {opt triangle} specify the kernel. By
default, {opt epanechnikov}, specifying the Epanechnikov kernel, is used.
{phang}
{opth "generate(newvar:newvar_x newvar_d)"} stores the results of the
estimation. {it:newvar_x} will contain the points at which the density is
estimated. {it:newvar_d} will contain the density estimate.
{phang}
{opt width(#)} specifies the halfwidth of the kernel, the width of the density
window around each point. If {opt width()} is not specified, the "optimal"
width is calculated and used; see {bind:{bf:[R] kdensity}}. The optimal width
is the width that would minimize the mean integrated squared error if the data
were Gaussian and a Gaussian kernel were used, so it is not optimal in any
global sense. In fact, for multimodal and highly skewed densities, the
"optimal" width is usually too wide and oversmooths the density.
{phang}
{opt n(#)} specifies the number of points at which the density estimate is to
be evaluated. The default is min(N,50), where N is the number of
observations in memory.
{phang}
{opt at(var_x)} specifies a variable that contains the values at which the
density should be estimated. This option allows you to more easily obtain
density estimates for different variables or different subsamples of a
variable and then overlay the estimated densities for comparison.
{phang}
{opt nograph} suppresses the graph. This option is often used in combination
with the {opt generate()} option.
{dlgtab:Kernel plot}
{phang}
{it:cline_options} affect the rendition of the plotted kernel density
estimate. See {it:{help connect_options}}.
{dlgtab:Density plots}
{phang}
{opt normal} requests that a normal density be overlaid on the density
estimate for comparison.
{phang}
{opt normopts(cline_options)} specifies details about the rendition
of the normal curve, such as the color and style of line used. See
{it:{help connect_options}}.
{phang}
{opt student(#)} specifies that a Student's t density with {it:#} degrees
of freedom be overlaid on the density estimate for comparison.
{phang}
{opt stopts(cline_options)} affect the rendition of the Student's t density.
See {it:{help connect_options}}.
{dlgtab:Add plot}
{phang}
{opt addplot(plot)} provides a way to add other plots to the generated graph.
See {it:{help addplot_option}}.
{dlgtab:Y-Axis, X-Axis, Title, Caption, Legend, Overall}
{phang}
{it:twoway_options} are any of the options documented in
{it:{help twoway_options}}, excluding {opt by()}. These include options for
titling the graph (see {it:{help title_options}}) and options for saving the
graph to disk (see {it:{help saving_option}}).
{title:Examples}
{phang}{cmd:. kdensity length}
{phang}{cmd:. kdensity length, w(20)}
{phang}{cmd:. kdensity weight, parzen nogr gen(x2 parzen)}
{title:Also see}
{psee}
Manual: {bf:[R] kdensity}
{psee}
Online: {helpb graph}, {helpb histogram}, {helpb lowess}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -