# densratio: Estimate Density Ratio p(x)/q(x) In densratio: Density Ratio Estimation

## Description

Estimate Density Ratio p(x)/q(x)

## Usage

 ```1 2 3``` ```densratio(x1, x2, method = c("uLSIF", "RuLSIF", "KLIEP"), sigma = "auto", lambda = "auto", alpha = 0.1, kernel_num = 100, fold = 5, verbose = TRUE) ```

## Arguments

 `x1` numeric vector or matrix. Data from a numerator distribution p(x). `x2` numeric vector or matrix. Data from a denominator distribution q(x). `method` "uLSIF" (default), "RuLSIF", or "KLIEP". `sigma` positive numeric vector. Search range of Gaussian kernel bandwidth. `lambda` positive numeric vector. Search range of regularization parameter for uLSIF and RuLSIF. `alpha` numeric in [0, 1]. Relative parameter for RuLSIF. Default 0.1. `kernel_num` positive integer. Number of kernels. `fold` positive integer. Numer of the folds of cross validation for KLIEP. `verbose` logical (default TRUE).

## Value

densratio object that contains a function to compute estimated density ratio.

## Examples

 ```1 2 3 4 5 6 7 8 9``` ```x1 <- rnorm(200, mean = 1, sd = 1/8) x2 <- rnorm(200, mean = 1, sd = 1/2) densratio_obj <- densratio(x1, x2) new_x <- seq(0, 2, by = 0.05) estimated_density_ratio <- densratio_obj\$compute_density_ratio(new_x) plot(new_x, estimated_density_ratio, pch=19) ```

densratio documentation built on July 1, 2019, 1:02 a.m.