fast_estimate_ziber | R Documentation |
This function implements Newton's method for solving zero of Expectation-Maximization equation at the limit of parameter convergence: a zero-inflated bernoulli model of transcript detection, modeling gene expression state (off of on) as a bernoulli draw on a gene-specific expression rate (Z in 0,1). Detection conditioned on expression is a logistic function of gene-level features. The bernoulli model is modeled numerically by a logistic model with an intercept.
fast_estimate_ziber(
x,
fp_tresh = 0,
gfeatM = NULL,
bulk_model = FALSE,
pos_controls = NULL,
rate_tol = 0.01,
maxiter = 100,
verbose = FALSE
)
x |
matrix. An expression data matrix (genes in rows, cells in columns) |
fp_tresh |
numeric. Threshold for calling a positive detection (D = 1). Default 0. |
gfeatM |
matrix. Numeric gene level determinants of drop-out (genes in rows, features in columns) |
bulk_model |
logical. Use median log-expression of gene in detected fraction as sole gene-level feature. Default FALSE. Ignored if gfeatM is specified. |
pos_controls |
logical. TRUE for all genes that are known to be expressed in all cells. |
rate_tol |
numeric. Convergence treshold on expression rates (0-1). |
maxiter |
numeric. The maximum number of steps per gene. Default 100. |
verbose |
logical. Whether or not to print the value of the likelihood at each iteration. |
a list with the following elements:
W coefficients of sample-specific logistic drop-out model
Alpha intercept and gene-level parameter matrix
X intercept
Beta coefficient of gene-specific logistic expression model
fnr_character the probability, per gene, of P(D=0|E=1)
p_nodrop 1 - the probability P(drop|Y), useful as weights in weighted PCA
expected_state the expected value E[Z] (1 = "on")
loglik the log-likelihood
convergencefor all genes, 0 if the algorithm converged and 1 if maxiter was reached
mat <- matrix(rpois(1000, lambda = 3), ncol=10)
mat = mat * matrix(1-rbinom(1000, size = 1, prob = .01), ncol=10)
ziber_out = suppressWarnings(fast_estimate_ziber(mat,
bulk_model = TRUE,
pos_controls = 1:10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.