Learn R Programming

densityratio (version 0.2.1)

predict.kliep: Obtain predicted density ratio values from a kliep object

Description

Obtain predicted density ratio values from a kliep object

Usage

# S3 method for kliep
predict(object, newdata = NULL, sigma = c("sigmaopt", "all"), ...)

Value

An array with predicted density ratio values from possibly new data, but otherwise the numerator samples.

Arguments

object

A kliep object

newdata

Optional matrix new data set to compute the density

sigma

A scalar with the Gaussian kernel width

...

Additional arguments to be passed to the function

See Also

predict, kliep

Examples

Run this code
set.seed(123)
# Fit model
dr <- kliep(numerator_small, denominator_small)
# Inspect model object
dr
# Obtain summary of model object
summary(dr)
# Plot model object
plot(dr)
# Plot density ratio for each variable individually
plot_univariate(dr)
# Plot density ratio for each pair of variables
plot_bivariate(dr)
# Predict density ratio and inspect first 6 predictions
head(predict(dr))
# Fit model with custom parameters
kliep(numerator_small, denominator_small,
      nsigma = 1, ncenters = 100, nfold = 10,
      epsilon = 10^{2:-5}, maxit = 500)

Run the code above in your browser using DataLab