Skip to content

densityratio

Distribution Comparison Through Density Ratio Estimation

v0.2.2 · Jul 18, 2025 · GPL (>= 3)

Description

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.

Downloads

CRAN

247

Last 30 days

17471st

711

Last 90 days

3.2K

Last year

Trend: +10.3% (30d vs prior 30d)

r2u CRAN

48

Last 30 days

129

Last 90 days

471

Last year

Trend: -5.9% (30d vs prior 30d)

autoCRAN

0

Last 7 days

13

Last 30 days

0

All-time

autoCRAN-only: this name is served only by autoCRAN, so the count is exact.

CRAN Check Status

2 NOTE
11 OK
Show all 13 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang NOTE
r-devel-linux-x86_64-debian-gcc NOTE
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (2 non-OK)
NOTE r-devel-linux-x86_64-debian-clang

tests

Running ‘testthat.R’ [263s/60s]
Running R code in ‘testthat.R’ had CPU time 4.4 times elapsed time
NOTE r-devel-linux-x86_64-debian-gcc

tests

Running ‘testthat.R’ [165s/50s]
Running R code in ‘testthat.R’ had CPU time 3.3 times elapsed time

Check History

NOTE 10 OK · 4 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Apr 22, 2026
NOTE r-devel-linux-x86_64-debian-clang

tests

Running ‘testthat.R’ [276s/67s]
Running R code in ‘testthat.R’ had CPU time 4.1 times elapsed time
NOTE r-devel-linux-x86_64-debian-gcc

tests

Running ‘testthat.R’ [167s/49s]
Running R code in ‘testthat.R’ had CPU time 3.4 times elapsed time
NOTE r-oldrel-macos-arm64

installed package size

installed size is  8.1Mb
  sub-directories of 1Mb or more:
    libs   6.3Mb
NOTE r-oldrel-macos-x86_64

installed package size

installed size is  8.3Mb
  sub-directories of 1Mb or more:
    libs   6.4Mb
ERROR 9 OK · 4 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Apr 18, 2026
NOTE r-devel-linux-x86_64-debian-clang

tests

Running ‘testthat.R’ [258s/78s]
Running R code in ‘testthat.R’ had CPU time 3.3 times elapsed time
NOTE r-devel-linux-x86_64-debian-gcc

tests

Running ‘testthat.R’ [170s/51s]
Running R code in ‘testthat.R’ had CPU time 3.3 times elapsed time
ERROR r-devel-windows-x86_64

whether package can be installed

Installation failed.
See 'd:/Rcompile/CRANpkg/local/4.6/densityratio.Rcheck/00install.out' for details.
NOTE r-oldrel-macos-arm64

installed package size

installed size is  8.1Mb
  sub-directories of 1Mb or more:
    libs   6.3Mb
NOTE r-oldrel-macos-x86_64

installed package size

installed size is  8.3Mb
  sub-directories of 1Mb or more:
    libs   6.4Mb
NOTE 8 OK · 6 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Apr 10, 2026
NOTE r-devel-linux-x86_64-debian-clang

compiled code

File ‘densityratio/libs/densityratio.so’:
  Found non-API call to R: ‘R_UnboundValue’

Compiled code should not call non-API entry points in R.

See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual,
and section ‘Moving into C API compliance’ for issues with the use of
non-API entry points.
NOTE r-devel-linux-x86_64-debian-gcc

tests

Running ‘testthat.R’ [165s/49s]
Running R code in ‘testthat.R’ had CPU time 3.4 times elapsed time
NOTE r-devel-windows-x86_64

compiled code

File 'densityratio/libs/x64/densityratio.dll':
  Found non-API call to R: 'R_UnboundValue'

Compiled code should not call non-API entry points in R.

See 'Writing portable packages' in the 'Writing R Extensions' manual,
and section 'Moving into C API compliance' for issues with the use of
non-API entry points.
NOTE r-patched-linux-x86_64

compiled code

File ‘densityratio/libs/densityratio.so’:
  Found non-API call to R: ‘R_UnboundValue’

Compiled code should not call non-API entry points in R.

See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual,
and section ‘Moving into C API compliance’ for issues with the use of
non-API entry points.
NOTE r-oldrel-macos-arm64

installed package size

installed size is  8.1Mb
  sub-directories of 1Mb or more:
    libs   6.3Mb
NOTE r-oldrel-macos-x86_64

installed package size

installed size is  8.3Mb
  sub-directories of 1Mb or more:
    libs   6.4Mb
ERROR 8 OK · 5 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Apr 9, 2026
NOTE r-devel-linux-x86_64-debian-clang

compiled code

File ‘densityratio/libs/densityratio.so’:
  Found non-API call to R: ‘R_UnboundValue’

Compiled code should not call non-API entry points in R.

See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual,
and section ‘Moving into C API compliance’ for issues with the use of
non-API entry points.
ERROR r-devel-linux-x86_64-debian-gcc

whether package can be installed

Installation failed.
See ‘/home/hornik/tmp/R.check/r-devel-gcc/Work/PKGS/densityratio.Rcheck/00install.out’ for details.
NOTE r-devel-windows-x86_64

compiled code

File 'densityratio/libs/x64/densityratio.dll':
  Found non-API call to R: 'R_UnboundValue'

Compiled code should not call non-API entry points in R.

See 'Writing portable packages' in the 'Writing R Extensions' manual,
and section 'Moving into C API compliance' for issues with the use of
non-API entry points.
NOTE r-patched-linux-x86_64

compiled code

File ‘densityratio/libs/densityratio.so’:
  Found non-API call to R: ‘R_UnboundValue’

Compiled code should not call non-API entry points in R.

See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual,
and section ‘Moving into C API compliance’ for issues with the use of
non-API entry points.
NOTE r-oldrel-macos-arm64

installed package size

installed size is  8.1Mb
  sub-directories of 1Mb or more:
    libs   6.3Mb
NOTE r-oldrel-macos-x86_64

installed package size

installed size is  8.3Mb
  sub-directories of 1Mb or more:
    libs   6.4Mb
NOTE 10 OK · 4 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026
NOTE r-devel-linux-x86_64-debian-clang

tests

Running ‘testthat.R’ [273s/69s]
Running R code in ‘testthat.R’ had CPU time 4 times elapsed time
NOTE r-devel-linux-x86_64-debian-gcc

tests

Running ‘testthat.R’ [163s/50s]
Running R code in ‘testthat.R’ had CPU time 3.3 times elapsed time
NOTE r-oldrel-macos-arm64

installed package size

installed size is  8.1Mb
  sub-directories of 1Mb or more:
    libs   6.3Mb
NOTE r-oldrel-macos-x86_64

installed package size

installed size is  8.3Mb
  sub-directories of 1Mb or more:
    libs   6.4Mb

Reverse Dependencies (1)

imports

Dependency Network

Dependencies Reverse dependencies osqp Rcpp pbapply ggplot2 ggh4x automatedRecLin densityratio

Version History

4 tracked
new 0.2.2 Mar 10, 2026
updated 0.2.2 ← 0.2.1 diff Jul 17, 2025
updated 0.2.1 ← 0.2.0 diff Jun 17, 2025
new 0.2.0 May 18, 2025