Estimate the empirical conditional cumulative distribution function
Usage
ccdf(
Y,
X,
Z = NULL,
method = c("OLS", "logistic"),
fast = TRUE,
space_y = FALSE,
number_y = 10
)Arguments
- Y
a numeric vector of size
ncontaining the preprocessed expressions fromnsamples (or cells).- X
a data frame containing numeric or factor vector(s) of size
ncontaining the variable(s) to be tested (the condition(s) to be tested).- Z
a data frame containing numeric or factor vector(s) of size
ncontaining the covariate(s).- method
a character string indicating which method to use to compute the CCDF, either
'OLS'or'logistic'. Default is'OLS'for greater computational speed.- fast
a logical flag indicating whether the fast implementation of logistic regression should be used. Only if
method == 'logistic'. Default isTRUE.- space_y
a logical flag indicating whether the y thresholds are spaced. When
space_yisTRUE, a regular sequence between the minimum and the maximum of the observations is used. Default isFALSE.- number_y
an integer value indicating the number of y thresholds (and therefore the number of regressions) to perform the test. Only used if
space_yisTRUE. Default is10.
Value
A list with the following elements:
cdf: a vector of the cumulative distribution function of a given gene.ccdf: a vector of the conditional cumulative distribution function of a given gene, computed givenX. Only ifZisNULL.ccdf_nox: a vector of the conditional cumulative distribution function of a given gene, computed givenZonly (i.e.Xis ignored.). Only ifZis notNULL.ccdf_x: a vector of the conditional cumulative distribution function of a given gene, computed givenXandZ. Only ifZis notNULL.y_sort: a vector of the sorted expression points at which the CDF and the CCDFs are calculated.x_sort: a vector of the variables associated withy_sort.z_sort: a vector of the covariates associated withy_sort. Only ifZis notNULL.
Details
The space_y / number_y grid controls both the
resolution of the statistic and its computational cost. See
cit_multi for details on this trade-off.
References
Gauthier M, Agniel D, Thiébaut R & Hejblum BP (2021). Distribution-free complex hypothesis testing for single-cell RNA-seq differential expression analysis, bioRxiv 445165. doi:10.1101/2021.05.21.445165 .