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.
cckde(x, bw = NULL, mult = 1, theta = 0, nu = 5, ...) dcckde(x, object) # S3 method for cckde predict(object, newdata, ...)
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. |
If a variable should be treated as ordered discrete, declare it as
ordered()
, factors are expanded into discrete dummy codings.
Nagler, T. (2017). A generic approach to nonparametric function estimation with mixed data. arXiv:1704.07457
# 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#> [1] 0.006360467 0.014830314 0.014789641 0.005534092 0.011112256 0.014951847 #> [7] 0.011272190 0.012159131 0.004525394 0.007624159predict(fit, dat) # equivalent#> [1] 0.006360467 0.014830314 0.014789641 0.005534092 0.011112256 0.014951847 #> [7] 0.011272190 0.012159131 0.004525394 0.007624159