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

View source: R/predict.R

predict.naivedensityratioR Documentation

Obtain predicted density ratio values from a naivedensityratio object

Description

Obtain predicted density ratio values from a naivedensityratio object

Usage

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

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

Value

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

See Also

predict, naive

Examples

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")

densityratio documentation built on June 8, 2025, 11:17 a.m.