Dataplot Vol 1 Vol 2

# KERNEL DENSITY WIDTH

Name:
KERNEL DENSITY WIDTH
Type:
Support Command
Purpose:
Specify the width parameter for a density plot.
Description:
The kernel density estimate, fn, of a set of n points from a density f is defined as:

$$f_n(x) = \frac{\sum_{j=1}^{n}{K\{\frac{(x - X_j)}{h}\}}} {nh}$$

where K is the kernel function h is the smoothing parameter or window width.

This command sets the value of the window width, h.

Following the recommendation of Silverman (1986), DATAPLOT uses a default width of

0.9*min(s,IQ/1.34)*n-1/5

where s is the sample standard deviation and IQ is the sample interquartile range. Silverman provides justification for this choice. Basically, it should perform reasonably for a wide variety of distributions. Note that the optimal width depends on the underlying function, which is what we are trying to estimate.

If the underlying data is in fact normally distributed, then Silverman (1986) shows that the optimal width is

1.06*s*n-1/5

where n is the number of points in the raw data and s is the sample standard deviation of the raw data.

It may be worthwhile to generate the density curve using several different values for the width. Silverman also recommends trying to transform skewed data sets to be symmetric.

Syntax:
KERNEL DENSITY WIDTH <value>
where <value> is a number or parameter that specifies the desired width.

The width should be strictly positive.

Examples:
KERNEL DENSITY WIDTH 0.3
KERNEL DENSITY WIDTH 1.2

LET S = STANDARD DEVIATION Y
LET A = 0.3*S
KERNEL DENSITY WIDTH A

Default:
The default window width is 0.9*min(s,IQ/1.34)*n-1/5 where n is the number of points in the raw data, s is the sample standard deviation, and IQ is the sample interquartile range.
Synonyms:
KERNEL WIDTH is a synonym for the KERNEL DENSITY WIDTH command.
Related Commands:
 KERNEL DENSITY PLOT = Generate a kernel density plot command. KERNEL DENSITY POINTS = Sets the number of points generated for the kernel density plot.
Reference:
B. W. Silverman (1982), "Kernel Density Estimation using the Fast Fourier Transform," Applied Statistics, Royal Statistical Society, Vol. 33.
Applications:
Density Estimation
Implementation Date:
2001/8
Program:
LET Y = NORMAL RANDOM NUMBERS FOR I = 1 1 1000
KERNEL DENSITY WIDTH 0.3
KERNEL DENSITY PLOT Y

NIST is an agency of the U.S. Commerce Department.

Date created: 8/14/2001
Last updated: 10/30/2015

Please email comments on this WWW page to alan.heckert@nist.gov.