cckde {cctools} | R Documentation |
Continuous convolution density estimator
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
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 |
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, |
nu |
smoothness parameter of the USB distribution (see, |
... |
unused. |
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
# 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