Learn R Programming

ks (version 1.2.1)

kde: Kernel density estimate for bivariate data

Description

Kernel density estimate for bivariate data.

Usage

kde(x, H, gridsize, supp=3.7, eval.points)

Arguments

x
matrix of data values
H
bandwidth matrix
gridsize
vector of number of grid points
supp
effective support for standard normal is [-supp, supp]
eval.points
points that density estimate is evaluated at

Value

  • Kernel density estimate is an object of class kde which is a list with 4 fields
  • xdata points - same as input
  • eval.pointspoints that density estimate is evaluated at
  • estimatedensity estimate at eval.points
  • Hbandwidth matrix

Details

The kernel density estimate is computed exactly i.e. binning is not used. If gridsize is not set to a specific value, then it defaults to 50 grid points in each co-ordinate direction i.e. c(50,50). Not required to be set if specifying eval.points.

If eval.points is not specified, then the density estimate is automatically computed over a grid whose resolution is controlled by gridsize (a grid is required for plotting).

References

Wand, M.P. & Jones, M.C. (1995) Kernel Smoothing. Chapman & Hall. London.

See Also

plot.kde

Examples

Run this code
data(unicef)
H.pi <- Hpi(unicef, nstage=1)
H.pi1 <- invvech(c(797.5755, -106.63338, 19.56761))
fhat <- kde(unicef, H.pi)

Run the code above in your browser using DataLab