jd_method: Joint density estimation methods

Description Usage Arguments Value Examples

Description

Provides pre-implemented APIs to packages for joint density estimation. Optionally, custom fit and evaluation functions can be provided.

Usage

1
2
jd_method(package = NULL, fit_fun = NULL, eval_fun = NULL, cc = TRUE,
  ...)

Arguments

package

character string of the package name; so far, only "cctools", "kdevine", "np" are implemented.

fit_fun

only used if package = NULL; a function of type function(x, ...) that fits a joint density model on a data matrix x. The ... can be used for passing additional parameters.

eval_fun

only used if package = NULL; a function of type function(object, newdata, ...) that takes an object fitted by fit_fun and evaluates the density estimate on newdata.

cc

only used if package = NULL; if TRUE, discrete variables (and the class indicator) are made continuous with cctools::cont_conv(); only use FALSE when your fit_fun can handle discrete variables.

...

additional parameters passed to fit_fun.

Value

An object of class "jd_method".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# pre-implemented APIs
cctools_method <- jd_method("cctools")
kdevine_method <- jd_method("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)

tnagler/jdify documentation built on May 31, 2019, 4:41 p.m.