Learn R Programming

feature (version 1.1-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)

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
flag to indicate: TRUE = x is binned counts or FALSE = x is data matrix. Default is TRUE
se
flag for computing standard error of kernel estimate. Default is TRUE

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. This function doesn't need to be used directly as it called from featureSignif.

References

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

See Also

featureSignif

Examples

Run this code
## univariate
data(earthquake)
eq3 <- -log10(-earthquake[,3])
fhat <- drvkde(x=eq3, drv=0, bandwidth=0.1)    ## KDE of f
fhat1 <- drvkde(x=eq3, drv=1, bandwidth=0.1)   ## KDE of df/dx

## trivariate
data(earthquake)
earthquake[,3] <- -log10(-earthquake[,3])
fhat <- drvkde(x=earthquake, drv=c(0,0,0), bandwidth=c(0.04,0.04,0.05),
               se=FALSE)     ## KDE of f
                                              
fhat212 <- drvkde(x=earthquake, drv=c(2,1,2), bandwidth=c(0.04,0.04,0.05),
                  se=FALSE)  ## KDE of d^3 f/ dx^2 dy dz^2

Run the code above in your browser using DataLab