Learn R Programming

densityratio (version 0.2.1)

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

Description

Obtain predicted density ratio values from a naivedensityratio object

Usage

# S3 method for naivedensityratio
predict(object, newdata = NULL, log = FALSE, tol = 1e-06, ...)

Value

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

Arguments

object

A naive object

newdata

Optional matrix new data set to compute the density

log

A logical indicating whether to return the log of the density ratio

tol

Minimal density value to avoid numerical issues

...

Additional arguments to be passed to the function

See Also

predict, naive

Examples

Run this code
set.seed(123)
# Fit model
dr <- naive(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
naive(numerator_small, denominator_small, m=2, kernel="epanechnikov")

Run the code above in your browser using DataLab