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

kdde

Kernel density derivative estimate


Description

Kernel density derivative estimate for 1- to 6-dimensional data.

Usage

kdde(x, H, h, deriv.order=0, gridsize, gridtype, xmin, xmax, supp=3.7, 
    eval.points, binned, bgridsize, positive=FALSE, adj.positive, w,
    deriv.vec=TRUE, verbose=FALSE)
kcurv(fhat, compute.cont=TRUE)

## S3 method for class 'kdde'
predict(object, ..., x)

Arguments

x

matrix of data values

H,h

bandwidth matrix/scalar bandwidth. If these are missing, Hpi or hpi is called by default.

deriv.order

derivative order (scalar)

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

positive

flag if data are positive (1-d, 2-d). Default is FALSE.

adj.positive

adjustment applied to positive 1-d data

w

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

deriv.vec

flag to compute all derivatives in vectorised derivative. Default is TRUE. If FALSE then only the unique derivatives are computed.

verbose

flag to print out progress information. Default is FALSE.

compute.cont

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

fhat

object of class kdde with deriv.order=2

object

object of class kdde

...

other parameters

Details

For each partial derivative, for grid estimation, the estimate is a list whose elements correspond to the partial derivative indices in the rows of deriv.ind. For points estimation, the estimate is a matrix whose columns correspond to the rows of deriv.ind.

If the bandwidth H is missing from kdde, then the default bandwidth is the plug-in selector Hpi. Likewise for missing h.

The effective support, binning, grid size, grid range, positive parameters are the same as kde.

The summary curvature is computed by kcurv, i.e.

hat(s)(x) = -1(D^2 hat(f)(x) <0)*abs(det(D^2 hat(f)(x)))

where D^2 hat(f)(x) is the kernel Hessian matrix estimate. So hat{s} calculates the absolute value of the determinant of the Hessian matrix and whose sign is the opposite of the negative definiteness indicator.

Value

A kernel density derivative estimate is an object of class kdde which is a list with fields:

x

data points - same as input

eval.points

vector or list of points at which the estimate is evaluated

estimate

density derivative estimate at eval.points

h

scalar bandwidth (1-d only)

H

bandwidth matrix

gridtype

"linear"

gridded

flag for estimation on a grid

binned

flag for binned estimation

names

variable names

w

vector of weights

deriv.order

derivative order (scalar)

deriv.ind

martix where each row is a vector of partial derivative indices

See Also

Examples

set.seed(8192)
x <- rmvnorm.mixt(1000, mus=c(0,0), Sigmas=invvech(c(1,0.8,1)))
fhat <- kdde(x=x, deriv.order=1) ## gradient [df/dx, df/dy]
predict(fhat, x=x[1:5,])

## See other examples in ? plot.kdde

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.