impute_expectation: Imputation of zero abundance based on general zero-inflated...

Description Usage Arguments Details Value Examples

View source: R/ziber.R

Description

This function is used to impute the data, weighted by probability of data coming from the zero-inflation part of the distribution.

Usage

1

Arguments

expression

the data matrix (genes in rows, cells in columns)

impute_args

arguments for imputation (see details)

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)

Value

the imputed expression matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

scone documentation built on Nov. 8, 2020, 5:20 p.m.