impute_expectation | R Documentation |
This function is used to impute the data, weighted by probability of data coming from the zero-inflation part of the distribution.
impute_expectation(expression, impute_args)
expression |
the data matrix (genes in rows, cells in columns) |
impute_args |
arguments for imputation (see details) |
The imputation is carried out with the following formula: y_ij* = y_ij * Pr( No Drop | y_ij) + mu_i * Pr( Drop | y_ij).
impute_args must contain 2 elements: 1) p_nodrop = posterior probability of data not having resulted from drop-out (genes in rows, cells in columns) 2) mu = expected expression of dropped data (genes in rows, cells in columns)
the imputed expression matrix.
mat <- matrix(rpois(1000, lambda = 3), ncol=10)
mat = mat * matrix(1-rbinom(1000, size = 1, prob = .01), ncol=10)
mu = matrix(rep(3/ppois(0,lambda = 3,lower.tail = FALSE),1000),ncol = 10)
p_false = 1 / ( 1 + ppois(0, lambda = 3, lower.tail = TRUE ) /
(0.01 * ppois(0, lambda = 3, lower.tail = FALSE) ) )
p_nodrop = matrix(rep(1-p_false,1000),ncol = 10)
p_nodrop[mat > 0] = 1
impute_args = list()
impute_args = list(mu = mu, p_nodrop = p_nodrop)
imat = impute_expectation(mat,impute_args = impute_args)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.