Learn R Programming

ks (version 1.6.13)

drvkde: Kernel density derivative estimation

Description

Compute kernel density derivative estimates and standard errors for multivariate data.

Usage

drvkde(x, drv, bandwidth, gridsize, range.x, binned=FALSE, se=TRUE, w)

Arguments

x
data matrix or matrix of binning counts
drv
vector of derivative indices
bandwidth
vector of bandwidths
gridsize
vector of grid sizes
range.x
list of vector of ranges for x
binned
TRUE if x is binned counts or FALSE if x is data matrix
se
flag for computing the standard error of kernel estimate
w
vector of weights (non-negative and sum is equal to sample size)

Value

  • Returns a list with fields x.grid - grid points est - kernel estimate of partial derivative of density function indicated by drv se - estimate of standard error of est (if se=TRUE).

Details

The estimates and standard errors are computed over a grid of binned counts x.grid. If the binned counts are not supplied then they are computed inside this function.

If gridsize and range.x are not supplied, they are computed inside this function.

References

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

Examples

Run this code
## univariate
x <- rnorm(100)
fhat <- drvkde(x=x, drv=0, bandwidth=0.1)    ## KDE of f
fhat1 <- drvkde(x=x, drv=1, bandwidth=0.1)   ## KDE of df/dx

Run the code above in your browser using DataLab