*! version 1.0.0 24/jul2020

help warpdenm1 [STB-38: snp13]

Title

warpdenm1 -- Kernel density estimation (Updated version)

Syntax

warpdenm1 varname [if] [in] , bwidth(#)
mval(#)
kercode(#)
[step
nosort
numodes
modes
nuamodes
amodes
npoints
gen(denvar midvar)
nograph
graph_options]

Description

warpdenm1 estimates univariate density estimator by means of the
ASH-WARPing procedure (Scott, 1985, 1992; Haerdle, 1991), draws the result
and provide modality information.

Options

bwidth(#) is the smoother parameter h (binwidth for histograms,
frequency polygons and averaged shifted histograms or FP-ASH; bandwidth
for kernel density estimators)

mval(#) is the number of averaged shifted histograms used to calculate
the required density estimations.

kercode(#) specifies the weight function (kernel) to calculate the
univariate densities according to the following numerical codes:

1 = Uniform
2 = Triangle
3 = Epanechnikov
4 = Quartic (Biweight)
5 = Triweight
6 = Gaussian

step is included to draw the step (histogram like) version. The default is
the linear interpolated (polygon) version.

nosort is used to indicate that the data have been sorted by varname (to save
time in repeated estimations).

numodes display the number of modes (maxima) in the density estimation.

modes lists the estimated values for each mode. The numodes option must
be included first.

nuamodes display the number of antimodes (minima) in the density estimation.

amodes lists the estimated values for each antimode. The nuamodes option must
be included first.

npoints gives the number of points used for estimation.

gen(denvar midvar) permits to create two variables containing
respectively the estimated density and the corresponding midpoints
used for calculation.

nograph suppresses the graph drawing

graph_options are any of the options allowed with graph, twoway.

Remarks

bwidth, mval, and kercode, are not optional. If the user does not
provide them, the program halts and displays an error message on screen.

This program is an all Stata command. In contrast with warpden it does not
require any external executable file. The user is warned that this implementation
is not as fast as warpden, specially with a high value for M. It is
based on the programs for density estimation presented in Salgado-Ugarte, et al.
(1993) which in turn are adapted versions of the algorithms and programs
provided by Haerdle (1991) and Scott (1992).

The "smoothness" of the resulting estimate can be regulated by changing the
bandwidth: wide intervals produce smooth results; narrow intervals give noiser
results.

Except for the Gaussian all the weight functions are supported on [-1,1].

As mval increases, the approximation is closer to the true kernel estimation,
but the quantity of calculation increases too. A good compromise is to use an
mval around 10 (Haerdle, 1991).

This procedure can be regarded as a descriptive smoother of histograms
besides a nonparametric density estimator.

Examples

. use bufsnow

. warpdenm1 snow, bwidth(10) mval(1) kercode(2) step

Will display a histogram for snow using a bindwidth of 10.

. warpdenm1 snow, b(10) m(1) k(2)

Will display a frequency polygon for snow.

. warpdenm1 snow, b(10) m(5) k(2) step

Will display the estimate from averaging five histograms with the
triangle weight function.

. warpdenm1 snow, b(15) m(10) k(4) gen(denq15 midq15) nog

Will calculate the WARPing approximation for the Quartic kernel, and will
generate two variables with the resulting density estimation and the
corresponding midpoints, without any graphical display.

. warpdenm1 snow, b(3) m(10) k(6) numo mo nuamo amo np nog

Will display the number of modes, antimodes, and their corresponding
estimates; besides it reports the number of points used to estimate density.

References

Haerdle, W. (1991) Smoothing Techniques with Implementation in S.
Springer-Verlag Chapter 2: 43-84; Chapters 1-2: 1-84.
Ortiz-Martinez, E.L., I.H. Salgado-Ugarte and M.P. Velasco de Leon
(2011) Nonparametric classification of fossil gymnosperm's foliar
area. 2011 Mexican Stata Users Group Meeting Proceedings.
Salgado-Ugarte, I.H. (2002) Suavizacion no parametrica para analisis de
datos. DGAPA and FES Zaragoza, UNAM. Mexico. 139 p.
Salgado-Ugarte, I.H., M. Shimizu, and T. Taniuchi (1993) snp6: Exploring
the shape of univariate data using kernel density estimators. Stata
Technical Bulletin 16: 8-19.
Salgado-Ugarte, I.H., M. Shimizu, and T. Taniuchi (1995a) snp6.1: ASH,
WARPing, and kernel density estimation for univariate data. Stata
Technical Bulletin 26: 23-31.
Salgado-Ugarte, I.H., M. Shimizu, and T. Taniuchi (1995b) snp6.2: Practical
Rules for bandwidth selection in univariate density estimation. Stata
Technical Bulletin 27: 5-19.
Salgado-Ugarte, I.H., M. Shimizu, and T. Taniuchi (1997) snp13:
Nonparametric assessment of multimodality for univariate data. Stata
Technical Bulletin 38: 27-35.
Scott, D.W. (1992) Multivariate Density Estimation: Theory, Practice,
and Visualization. John Wiley Chapter 6: 125-143; Chapters 3-6: 47-193.
Silverman, B.W. (1986) Density Estimation for Statistics and Data
Analysis. Chapman and Hall.

Authors

Original version:
Isaias H. Salgado-Ugarte, Makoto Shimizu and Toru Taniuchi
University of Tokyo, Faculty of Agriculture,
Department of Fisheries, Yayoi 1-1-1, Bunkyo-ku
Tokyo 113, Japan.(Fax 81-3-3812-0529)
Updated version:
Isaías H. Salgado-Ugarte & V. Mitsui Saito-Quezada
Laboratorio de Biometría y Biología Pesquera
Facultad de Estudios Superiores Zaragoza
Universidad Nacional Autónoma de México
isalgado@unam.mx

Also see

STB: snp6 (STB-16); snp6.1 (STB-26); snp6.2 (STB-27); snp6.4 (STB-38)

On-line: help for warpdens, kerneld, bandw, l2cvwarp, bcvwarp, kernreg, numode