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.2 | 
| Depends: | R (≥ 2.10) | 
| Imports: | osqp, Rcpp, pbapply, ggplot2, ggh4x | 
| LinkingTo: | Rcpp, RcppArmadillo, RcppProgress | 
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) | 
| Published: | 2025-07-18 | 
| DOI: | 10.32614/CRAN.package.densityratio | 
| Author: | Thom Volker | 
| Maintainer: | Thom Volker <thombenjaminvolker at gmail.com> | 
| BugReports: | https://github.com/thomvolker/densityratio/issues | 
| License: | GPL (≥ 3) | 
| URL: | https://thomvolker.github.io/densityratio/, https://github.com/thomvolker/densityratio | 
| NeedsCompilation: | yes | 
| Citation: | densityratio citation info | 
| Materials: | README, NEWS | 
| CRAN checks: | densityratio results | 
| Reference manual: | densityratio.html , densityratio.pdf | 
| Vignettes: | Covariate shift adjustment (source) densityratio (source) High dimensional two-sample testing (source) | 
| Package source: | densityratio_0.2.2.tar.gz | 
| Windows binaries: | r-devel: densityratio_0.2.2.zip, r-release: densityratio_0.2.2.zip, r-oldrel: densityratio_0.2.2.zip | 
| macOS binaries: | r-release (arm64): densityratio_0.2.2.tgz, r-oldrel (arm64): densityratio_0.2.2.tgz, r-release (x86_64): densityratio_0.2.2.tgz, r-oldrel (x86_64): densityratio_0.2.2.tgz | 
| Old sources: | densityratio archive | 
Please use the canonical form https://CRAN.R-project.org/package=densityratio to link to this page.