GenKern (version 1.2-60)

KernSec: Univariate kernel density estimate

Description

Computes univariate kernel density estimate using Gaussian kernels which can also use non-equally spaced ordinates and adaptive bandwidths and local bandwidths

Usage

KernSec(x, xgridsize=100, xbandwidth, range.x)

Arguments

x
vector of x values
xgridsize
integer for number of ordinates at which to calculate the smoothed estimate: default=100
xbandwidth
value of x window width, or vector of local window widths, one for each x, or one for each range.x, or a vector of length xgridsize: default=dpik(x)
range.x
total range of the estimate in the x dimension, or a vector giving the x ordinates: default=range +- 1.5 * mean bandwidth

Value

xords
vector of ordinates
yden
vector of density estimates corresponding to each x ordinate

Acknowledgements

Written in collaboration with A.M.Pollard <mark.pollard@rlaha.ox.ac.uk> with the financial support of the Natural Environment Research Council (NERC) grant GR3/11395

References

Lucy, D. Aykroyd, R.G. & Pollard, A.M.(2002) Non-parametric calibration for age estimation . Applied Statistics 51(2): 183-196

See Also

KernSur per density hist bkde bkde2D dpik

Examples

Run this code
x <- c(2,4,6,8,10) 

z <- KernSec(x)				# simplest invocation
plot(z$xords, z$yden, type="l")

z <- KernSec(x, xbandwidth=2, range.x=c(0,8))
plot(z$xords, z$yden, type="l")

# local bandwidths
ords <- seq(from=0, to=14, length=100)
bands <- x/15
z <- KernSec(x, xbandwidth=bands, range.x=ords)
plot(z$xords, z$yden, type="l")         # should plot a wriggly line

bands <- seq(from=1, to=4, length=100)	# improvise a pilot estimate
z <- KernSec(x, xbandwidth=bands, range.x=ords)
plot(z$xords, z$yden, type="l") 

Run the code above in your browser using DataLab