Learn R Programming

ks (version 1.8.11)

kdde: Kernel density derivative estimate for multivariate data

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=FALSE, bgridsize, positive=FALSE, adj.positive, 
    w, deriv.vec=TRUE, verbose=FALSE)

Arguments

x
matrix of data values
H
bandwidth matrix
h
scalar bandwidth
deriv.order
derivative order (scalar)
gridsize
vector of number of grid points
gridtype
not yet implemented
xmin
vector of minimum values for grid
xmax
vector of maximum values for grid
supp
effective support for standard normal is [-supp, supp]
eval.points
points at which density estimate is evaluated
binned
flag for binned estimation. Default is FALSE.
bgridsize
vector of binning grid sizes
positive
flag if 1-d data are positive. Default is FALSE.
adj.positive
adjustment applied to data x <- log(x + adj.positive) when positive=TRUE. Default is the minimum of x.
w
vector of weights (non-negative and sum is equal to sample size). 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.

Value

  • The result is kernel density derivative estimate is an object of class kdde:
  • xdata points - same as input
  • eval.pointspoints at which the density estimate is evaluated
  • estimatedensity derivative estimate at eval.points
  • Hbandwidth matrix
  • hscalar bandwidth (1-d only)
  • wweights
  • deriv.orderderivative order (scalar)
  • deriv.indeach row is a vector of partial derivative indices

Details

Binning/exact estimation behaviour is the same as for kde.

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 rows of deriv.ind.

See Also

kde

Examples

Run this code
## univariate example
x <- rnorm.mixt(n=100, mus=1, sigmas=1, props=1)
fhat2 <- kdde(x=x, h=hpi(x), deriv.order=2)      ## d^2 f/dx^2 

## bivariate example
data(unicef)
H.scv <- Hscv(x=unicef)
fhat1 <- kdde(x=unicef, H=H.scv, deriv.order=1)   ## gradient vector

Run the code above in your browser using DataLab