densityratio: Distribution Comparison Through Density Ratio Estimation

Fast, flexible and user-friendly tools for distribution comparison through direct density ratio estimation. The estimated density ratio can be used for covariate shift adjustment, outlier-detection, change-point detection, classification and evaluation of synthetic data quality. The package implements multiple non-parametric estimation techniques (unconstrained least-squares importance fitting, ulsif(), Kullback-Leibler importance estimation procedure, kliep(), spectral density ratio estimation, spectral(), kernel mean matching, kmm(), and least-squares hetero-distributional subspace search, lhss()). with automatic tuning of hyperparameters. Helper functions are available for two-sample testing and visualizing the density ratios. For an overview on density ratio estimation, see Sugiyama et al. (2012) <doi:10.1017/CBO9781139035613> for a general overview, and the help files for references on the specific estimation techniques.

Version: 0.2.0
Depends: R (≥ 2.10)
Imports: osqp, Rcpp, pbapply, ggplot2
LinkingTo: Rcpp, RcppArmadillo, RcppProgress
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
Published: 2025-05-19
DOI: 10.32614/CRAN.package.densityratio
Author: Thom Volker ORCID iD [aut, cre], Carlos Gonzalez Poses [ctb], Erik-Jan van Kesteren [ctb]
Maintainer: Thom Volker <thombenjaminvolker at gmail.com>
BugReports: https://github.com/thomvolker/densityratio/issues
License: GPL (≥ 3)
URL: https://thomvolker.github.io/densityratio/
NeedsCompilation: yes
Citation: densityratio citation info
Materials: README NEWS
CRAN checks: densityratio results

Documentation:

Reference manual: densityratio.pdf
Vignettes: Covariate shift adjustment (source)
densityratio (source)
High dimensional two-sample testing (source)

Downloads:

Package source: densityratio_0.2.0.tar.gz
Windows binaries: r-devel: not available, r-release: not available, r-oldrel: not available
macOS binaries: r-release (arm64): densityratio_0.2.0.tgz, r-oldrel (arm64): densityratio_0.2.0.tgz, r-release (x86_64): not available, r-oldrel (x86_64): not available

Linking:

Please use the canonical form https://CRAN.R-project.org/package=densityratio to link to this page.