glmm.zinb: Zero-Inflated Negative Binomial Mixed Models

glmm.zinbR Documentation

Zero-Inflated Negative Binomial Mixed Models

Description

This function sets up and fits zero-inflated negative binomial mixed models for analyzing zero-inflated count responses with multilevel data structures (for example, clustered data and longitudinal studies).

Usage

  
glmm.zinb(fixed, random, data, correlation, 
        zi_fixed = ~1, zi_random = NULL,
        niter = 30, epsilon = 1e-05, verbose = TRUE, ...)  

Arguments

fixed

a formula for the fixed-effects part of the negative binomial model, including the count outcome. This argument is the same as in the function lme in the package nlme.

random

a formula for the random-effects part of the negative binomial model. It only contain the right-hand side part, e.g., ~ time | id, where time is a variable, and id the grouping factor. This argument is the same as in the function lme in the package nlme.

data

a data.frame containing all the variables.

correlation

an optional correlation structure. It is the same as in the function lme in the package nlme.

zi_fixed, zi_random

formulas for the fixed and random effects of the zero inflated part. only contain the right-hand side part.

niter

maximum number of iterations.

epsilon

positive convergence tolerance.

verbose

logical. If TRUE, print out number of iterations and computational time.

...

further arguments for lme.

Details

Zero-inflated models are two-component mixture models combining a point mass at zero with a negative binomial distribution for count response. Thus, there are two sources of zeros: zeros may come from either the point mass at zero or the negative binomial distribution. For modeling the unobserved state, a logistic model (or logistic mixed model) is used.

The function is an alteration of the function glmmPQL in the package MASS, which fits generalized linear mixed models using Penalized Quasi-Likelihood and works by repeated calls to the function lme in the package nlme. It incorporates EM algorithms into the procedure of glmmPQL to fit zero-inflated mixed models for analyzing zero-inflated count responses in mutilevel study designs, for example, clustered and longitudinal studies. The function allows for multiple and correlated group-specific (random) effects (the argument random) and various types of within-group correlation structures (the argument correlation) described by corStruct in the package nlme.

Value

A fitted model object of class lme inheriting from lme, which can be summarized by functions in the package nlme for the count distribution part.

The object contains additional components for the zero-inflation part:

theta

the estimate of the dispersion parameter;

zero.prob

the zero-state probabilities;

zero.indicator

the conditional expectations of the zero indicators;

zi.fit

the fitted logistic (mixed) model for the zero-inflation part;

Author(s)

Nengjun Yi, nyi@uab.edu

References

Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer.

Venables, W. N. and Ripley, B. D. (2002) "Modern Applied Statistics with S". Fourth edition. Springer.

Xinyan Zhang, Himel Mallick, Xiangqin Cui, Andrew K. Benson, and Nengjun Yi (2017) Negative Binomial Mixed Models for Analyzing Microbiome Count Data. BMC Bioinformatics 18(1):4.

Xinyan Zhang, Yu-Fang Pei, Lei Zhang, Boyi Guo, Amanda Pendegraft, Wenzhuo Zhuang and Nengjun Yi (2018) Negative Binomial Mixed Models for Analyzing Longitudinal Microbiome Data. Frontiers in Microbiology 9:1683.

Xinyan Zhang and Nengjun Yi 2020 Fast Zero-Inflated Negative Binomial Mixed Models for Analyzing Longitudinal Metagenomics Data. Bioinformatics. doi: 10.1093/bioinformatics/btz973.

Xinyan Zhang, Boyi Guo, and Nengjun Yi 2020 Zero-Inflated Gaussian Mixed Models for Analyzing Longitudinal Microbiome Data. PLoS One 15(11):e0242073.

Xinyan Zhang and Nengjun Yi 2020 NBZIMM: Negative Binomial and Zero-Inflated Mixed Models, with Applications to Microbiome Data Analysis. BMC Bioinformatics 21(1):488.

See Also

lme, glmmPQL, glmm.nb, lme.zig

Examples


library(NBZIMM)

# load data
data(Romero)
names(Romero)

otu = Romero$OTU; dim(otu)
sam = Romero$SampleData; dim(sam)
colnames(sam)

N = sam[, "Total.Read.Counts"]        
Days = sam$GA_Days; Days = scale(Days)
Age = sam$Age; Age = scale(Age)
Race = sam$Race
preg = sam$pregnant; table(preg)
subject = sam[, "Subect_ID"]; table(subject)

# analyze one response
y = otu[, 1]

# zero-inflated negative binomial models

data = data.frame(y=y, Days=Days, Age=Age, Race=Race, preg=preg, N=N, subject=subject)
f = glmm.zinb(fixed = y ~ Days + Age + Race + preg + offset(log(N)), 
              random = ~ 1 | subject, data = data, zi_fixed = ~1) 
summary(f)
summary(f$zi.fit)

library(glmmTMB) # compared with glmmTMB
f0 = glmmTMB(y ~ Days + Age + Race + preg + offset(log(N)) + (1 | subject), data = data, 
            family = nbinom2, zi = ~ 1)
summary(f0)


nyiuab/NBZIMM documentation built on June 14, 2024, 1:45 a.m.