Provides pre-implemented APIs to packages for joint density estimation. Optionally, custom fit and evaluation functions can be provided.
jd_method(package = NULL, fit_fun = NULL, eval_fun = NULL, cc = TRUE, ...)
package | character string of the package name; so far, only
|
---|---|
fit_fun | only used if |
eval_fun | only used if |
cc | only used if |
... | additional parameters passed to |
An object of class "jd_method"
.
# pre-implemented APIs cctools_method <- jd_method("cctools") kdevine_method <- jd_method("kdevine")#> Error in jd_method("kdevine"): installed version of 'kdevine' is too old, please update with install.packages("kdevine")np_method <- jd_method("np") # custom API (alternative implementation of kdevine method) require(kdevine)#>fit_kdevine <- function(x, ...) kdevine::kdevine(x, ...) eval_kdevine <- function(object, newdata, ...) kdevine::dkdevine(newdata, object) my_method <- jd_method(fit_fun = fit_kdevine, eval_fun = eval_kdevine, cc = FALSE)#> Error in value[[3L]](cond): fit_fun doesn't work: Error in (1 - h) * qs[i]: non-numeric argument to binary operator