deconvG: Base function of G-modeling deconvolution

Description Usage Arguments Value Note Examples

View source: R/g_model.R

Description

Base function used by deconvSingle to deconvolve the underlying distribution. We assume X ~ F(T) where F is the noise distribution. We assume that

log(T) = offset + γ Z + ε

P(T = 0) = β_0 + β_1 Z0

The goal is the recover the distribution of exp(log(T) - offset - gamma Z), which has density g and is discretized at exp(tau) (add 0 when zero inflation is allowed). There can be some warning messages for the optimization process, which can be ignored.

Usage

1
2
3
4
deconvG(tau, X, offset, family = c("Poisson", "Negative Binomial"),
  ignoreZero = F, zeroInflate = F, Z = NULL, Z0 = NULL, c0 = 1,
  NB.size = 100, only.value = F, pDegree = 5, aStart = 1,
  bStart = 0, gStart = 0, ...)

Arguments

tau

log of the discrete points of the deconvolved distribution

X

a vector of observed counts

offset

a vector with the same length as X. See details

family

family of the noise distribution, support either "Poisson" or "Negative Binomial" with known tuning parameter

ignoreZero

whether ignore the zero count. If true, then use truncated Poisson / Negative Binomial distribution. Default is False

zeroInflate

whether add zero inflation part to the deconvolved distribution to reflect transcriptional bursting. Default is True.

Z

covariates for nonzero mean. Default is NULL.

Z0

covariates for nonzero fraction. Used only when zeroInflate is True. Default is NULL.

c0

the tuning parameter on the L2 penalty term. Default is 1. c0 will be selected automatically in deconvSingle

NB.size

over-dispersion parameter when the family is Negative Binomial: mu = mu + mu^2/size

only.value

whether not to compute the estimation statistics but only the value of the optimized lieklihood. Used for likelihood ratio test.

pDegree

the degree of the Spline matrix. Default is 5.

aStart, bStart, gStart

initial values of the density parameters, the coefficients of Z0 and coefficients of Z

...

extra parameters for the nlm function

Value

a list with elements

stats

a list of two elements. One is the mat.dist, which is the matrix of the estimated distribution. The other is mat.coef, which is the matrix of the coefficients of Z and Z0

mle

the estimated parameters of the the density function

mle.g

the estimated coefficients of Z

value

the optimized penalized negative log-likelihood value

S

the fake information proportion

cov

the covariance of the parameters

bias

the bias of the parameters

cov.g

the covaraince of the estimated density points

cov.g.gamma

the covariance between the estimated density points and the coefficient of Z

loglik

the objective function being optimized

statsFunction

the function computing the relavant statistics

Note

This is an extension of the G-modeling package

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
X <- rpois(1000, 0.2 * 3)
lam.max <- quantile(X[!X == 0], probs = c(0.98))/0.2
tau <- seq(0, lam.max, length.out = 51)[-1]

Z <- rnorm(1000)

result <- deconvG(log(tau), X, zeroInflate = TRUE,
                     Z = Z,
                     Z0 = Z,
                     offset = rep(log(0.2), 1000))

jingshuw/descend documentation built on Nov. 2, 2021, 4:23 p.m.