lme.zig | R Documentation |
This function sets up and fits zero-inflated gaussian mixed models for analyzing zero-inflated continuous responses with multilevel data structures (for example, clustered data and longitudinal studies).
lme.zig(fixed, random, data, correlation,
zi_fixed = ~1, zi_random = NULL,
niter = 30, epsilon = 1e-05, verbose = TRUE, ...)
fixed |
a formula for the fixed-effects part of the Gaussian model, including the continuous normal outcome. This argument is the same as in the function |
random |
a formula for the random-effects part of the Gaussian 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 |
data |
a data.frame containing all the variables. |
correlation |
an optional correlation structure. It is the same as in the function |
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 |
... |
further arguments for |
Zero-inflated gaussian models are two-component mixture models combining a point mass at zero with Gaussian (normal) for continuous outcome. Thus, there are two sources of zeros: zeros may come from either the point mass at zero or the normal 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 continuous 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.
A fitted model object of class lme
inheriting from lme
, which can be summarized by functions in the package nlme for the distribution part.
The object contains additional components for the zero-inflation part:
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; |
Nengjun Yi, nyi@uab.edu
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.
lme
, glmmPQL
, glmm.zinb
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 gaussian model
y0 = log(y+1)
data = data.frame(y0=y0, Days=Days, Age=Age, Race=Race, preg=preg, N=N, subject=subject)
f = lme.zig(fixed = y0 ~ Days + Age + Race + preg + offset(log(N)),
random = ~ 1 | subject, data = data)
summary(f)
summary(f$zi.fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.