naive {densityratio} | R Documentation |
Naive density ratio estimation
Description
The naive approach creates separate kernel density estimates for
the numerator and the denominator samples, and then evaluates their
ratio for the denominator samples. For multivariate data, the density ratio
is computed after a orthogonal linear transformation, such that the new
variables can be treated as independent. To reduce the dimensionality of
the PCA solution, one can set the number of components by setting the
m
parameter to an integer value smaller than the number of variables.
Usage
naive(
df_numerator,
df_denominator,
m = NULL,
bw = "SJ",
kernel = "gaussian",
n = 2L^11,
...
)
Arguments
df_numerator |
|
df_denominator |
|
m |
|
bw |
the smoothing bandwidth to be used. See stats::density for more information. |
kernel |
the kernel to be used. See stats::density for more information. |
n |
|
... |
further arguments passed to stats::density |
Value
naivedensityratio
object
See Also
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")