Suppose we have m+1 samples, labeled as 0, 1, ..., m,
whose population distributions satisfy the density ratio
model (DRM) (see drmdel
for the definition
of DRM). The cdfDRM
function estimates the
cumulative distribution functions (CDF), F_k,
of the populations.
1 
k 
a vector of labels of populations whose CDFs are to be estimated, with k[i] = 0, 1, ..., m. 
x 
It can be: (1) a list whose length is the same as the argument "k". The i^th component of this list must be a vector of values at which the CDF of population k[i] is estimated. (2) a single vector of values, in which case, each CDF is estimated at the same values given by this vector. (3) NULL (default), in which case, each CDF is estimated at the values of all the observed data points. 
drmfit 
a fitted DRM object (an output from the

interpolation 
a logical variable specifying whether to linearly interpolate the estimated CDF to make a smooth CDF estimate; The default is TRUE. 
A list whose length is the same as the argument "k". The i^th component of the list is a data frame with the following two columns:
x: values at which the CDF of population k[i] is estimated.
cdf_est: the corresponding estimated CDF values of population k[i].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31  # Data generation
set.seed(25)
n_samples < c(100, 200, 180, 150, 175) # sample sizes
x0 < rgamma(n_samples[1], shape=5, rate=1.8)
x1 < rgamma(n_samples[2], shape=12, rate=1.2)
x2 < rgamma(n_samples[3], shape=12, rate=1.2)
x3 < rgamma(n_samples[4], shape=18, rate=5)
x4 < rgamma(n_samples[5], shape=25, rate=2.6)
x < c(x0, x1, x2, x3, x4)
# Fit a DRM with the basis function q(x) = (x, log(abs(x))),
# which is the basis function for gamma family. This basis
# function is the builtin basis function 6.
drmfit < drmdel(x=x, n_samples=n_samples, basis_func=6)
# Estimate the CDF of population 1 at c(3, 7.5, 11) and that
# of population 3 at c(2, 6).
cdf_est1 < cdfDRM(k=c(1, 3), x=list(c(3, 7.5, 11), c(2, 6)),
drmfit=drmfit)
# Show the output.
names(cdf_est1)
cdf_est1$F1
cdf_est1$F3
# Estimate the CDF of population 2 and 4 at the observed
# data points.
cdf_est < cdfDRM(k=c(2, 4), drmfit=drmfit)
# Show the output.
names(cdf_est)
cdf_est$F2
cdf_est$F4

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.