cckde: Continuous convolution density estimator

Description Usage Arguments Details References Examples

View source: R/cckde.R

Description

The continuous convolution kernel density estimator is defined as the classical kernel density estimator based on continuously convoluted data (see cont_conv()). cckde() fits the estimator (including bandwidth selection), dcckde() and predict.cckde() can be used to evaluate the estimator.

Usage

1
2
3
4
5
6
cckde(x, bw = NULL, mult = 1, theta = 0, nu = 5, ...)

dcckde(x, object)

## S3 method for class 'cckde'
predict(object, newdata, ...)

Arguments

x

a matrix or data frame containing the data (or evaluation points).

bw

vector of bandwidth parameter; if NULL, the bandwidths are selected automatically by likelihood cross validation.

mult

bandwidth multiplier; either a positive number or a vector of such. Each bandwidth parameter is multiplied with the corresponding multiplier.

theta

scale parameter of the USB distribution (see, dusb()).

nu

smoothness parameter of the USB distribution (see, dusb()). The estimator uses the Epanechnikov kernel for smoothing and the USB distribution for continuous convolution (default parameters correspond to the uniform distribution on [-0.5, 0.5].

...

unused.

object

cckde object.

newdata

matrix or data frame containing evaluation points.

Details

If a variable should be treated as ordered discrete, declare it as ordered(), factors are expanded into discrete dummy codings.

References

Nagler, T. (2017). A generic approach to nonparametric function estimation with mixed data. arXiv:1704.07457

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# dummy data with discrete variables
dat <- data.frame(
    F1 = factor(rbinom(10, 4, 0.1), 0:4),
    Z1 = ordered(rbinom(10, 5, 0.5), 0:5),
    Z2 = ordered(rpois(10, 1), 0:10),
    X1 = rnorm(10),
    X2 = rexp(10)
)

fit <- cckde(dat)  # fit estimator
dcckde(dat, fit)   # evaluate density
predict(fit, dat)  # equivalent

cctools documentation built on May 2, 2019, 8:51 a.m.