fit.NB {HeritSeq} | R Documentation |
Fit negative binomial mixed models (NBMM) for one or more features.
Description
Fit NBMM for one or more features and output the fit parameters. It is used before the function computeVPC.NB(). This function also allows to test the presence of heritability via random effect variance of the model. To fit a NBMM, the glmmADMB package is needed.
Usage
fit.NB(CountMatrix, Strains, test = FALSE)
Arguments
CountMatrix |
Sequencing count matrix for a list of features. Each row is for one feature, and the columns are for samples. |
Strains |
Strain labels for the samples. |
test |
TRUE or FALSE (default). Test the presence of heritability
through examining the random effect variance |
Value
A list with two objects. The first object is a G \times 3
matrix indicating the fitted parameters for each feature. The columns are
ordered by \alpha_g, \sigma_g^2, \phi_g
.
Row names are feature names. If the argument test is set to
be true, the second object of the list consists of p-values for testing
the hypothesis that random effects \sigma_a^2 = 0
;
otherwise, the second object is NULL.
Examples
## Compute vpc for each feature under NBMM. This will take a while on the
## entire dataset. For the purpose of illustration, here we only fit on
## the first 2 features.
result.nb <- fit.NB(simData[1:2, ], strains)