glmm.nb: Negative Binomial Mixed Models

glmm.nbR Documentation

Negative Binomial Mixed Models

Description

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

Usage

  
glmm.nb(fixed, random, data, correlation,  
        niter = 30, epsilon = 1e-05, verbose = TRUE, ...)  

Arguments

fixed

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

random

a formula for the random-effects part. 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.

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

This 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 sets up and fits negative binomial mixed-effects models, which are the standard models for analyzing overdispersed 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. The object also contains the estimate of the dispersion parameter theta.

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 NBZIMM: Negative Binomial and Zero-Inflated Mixed Models, with Applications to Microbiome Data Analysis. BMC Bioinformatics 21(1):488.

See Also

lme, glmmPQL

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]

f = glmm.nb(y ~ Days + Age + Race + preg + offset(log(N)), random = ~ 1 | subject)
summary(f)


library(lme4)  # compared with lme4
f0 = glmer.nb(y ~ Days + Age + Race + preg + offset(log(N)) + (1 | subject))   
summary(f0)

library(mgcv)  # compared with mgcv
f0 = gam(y ~ Days + Age + Race + preg + offset(log(N)) + s(subject, bs="re"), 
         family=nb(), method="REML") 
summary(f0)

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


nyiuab/NBZIMM documentation built on April 21, 2022, 7 a.m.