Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

vkde

Variable kernel density estimate.


Description

Variable kernel density estimate for 2-dimensional data.

Usage

kde.balloon(x, H, h, gridsize, gridtype, xmin, xmax, supp=3.7, eval.points, 
   binned, bgridsize, w, compute.cont=TRUE, approx.cont=TRUE, verbose=FALSE)
kde.sp(x, H, h, gridsize, gridtype, xmin, xmax, supp=3.7, eval.points, 
   binned, bgridsize, w, compute.cont=TRUE, approx.cont=TRUE, verbose=FALSE)

Arguments

x

matrix of data values

H

bandwidth matrix. If this missing, Hns is called by default.

h

not yet implemented

gridsize

vector of number of grid points

gridtype

not yet implemented

xmin,xmax

vector of minimum/maximum values for grid

supp

effective support for standard normal

eval.points

vector or matrix of points at which estimate is evaluated

binned

flag for binned estimation.

bgridsize

vector of binning grid sizes

w

vector of weights. Default is a vector of all ones.

compute.cont

flag for computing 1% to 99% probability contour levels. Default is TRUE.

approx.cont

flag for computing approximate probability contour levels. Default is TRUE.

verbose

flag to print out progress information. Default is FALSE.

Details

The balloon density estimate kde.balloon employs bandwidths which vary at each estimation point (Loftsgaarden & Quesenberry, 1965). There are as many bandwidths as there are estimation grid points. The default bandwidth is Hns(,deriv.order=2) and the subsequent bandwidths are derived via a minimal MSE formula.

The sample point density estimate kde.sp employs bandwidths which vary for each data point (Abramson, 1982). There are as many bandwidths as there are data points. The default bandwidth is Hns(,deriv.order=4) and the subsequent bandwidths are derived via the Abramson formula.

Value

A variable kernel density estimate for bounded data is an object of class kde.

References

Abramson, I. S. (1982) On bandwidth variation in kernel estimates - a square root law. Annals of Statistics, 10, 1217-1223.

Loftsgaarden, D. O. & Quesenberry, C. P. (1965) A nonparametric estimate of a multivariate density function. Annals of Mathematical Statistics, 36, 1049-1051.

See Also

Examples

data(worldbank)
wb <- as.matrix(na.omit(worldbank[,4:5]))
xmin <- c(-70,-25); xmax <- c(25,70)
fhat <- kde(x=wb, xmin=xmin, xmax=xmax)
fhat.sp <- kde.sp(x=wb, xmin=xmin, xmax=xmax)
plot(fhat, display="persp", box=TRUE, phi=20, zlim=c(0,max(fhat.sp$estimate)))
plot(fhat.sp, display="persp", box=TRUE, phi=20, zlim=c(0,max(fhat.sp$estimate)))
if (interactive()){
fhat.ball <- kde.balloon(x=wb, xmin=xmin, xmax=xmax)
plot(fhat.ball, display="persp", box=TRUE, phi=20, zlim=c(0,max(fhat.sp$estimate)))}

ks

Kernel Smoothing

v1.12.0
GPL-2 | GPL-3
Authors
Tarn Duong [aut, cre], Matt Wand [ctb], Jose Chacon [ctb], Artur Gramacki [ctb]
Initial release
2021-02-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.