sim | R Documentation |
This function is to simulate overdispersed and/or zero-inflated count data with random effects.
sim(n.ind = 100, n.measure = 10, x.d, coef.d = 1, tau.d = 1.5, x.z, coef.z = 0, tau.z = 0, p.zero = 0, theta = 2)
n.ind |
number of individuals (or clusters). |
n.measure |
number of measures for each individual. |
x.d |
design matrix of fixed-effects in the count part (distribution part). If not given, |
coef.d |
coefficients of |
tau.d |
standard deviation of random effect in the count part. |
x.z |
design matrix of fixed-effects in the zero-inflation part. |
coef.z |
coefficients of |
tau.z |
standard deviation of random effect in the zero-inflation part. |
p.zero |
proportion of zeros from the the point mass at zero (i.e., not from the negative binomial count distribution). |
theta |
shape parameter for negative binomial model of the count part. |
a list containing individual ID ind.ID
, design matrices x.d
and x.z
, Total number T
, and count response y
.
Nengjun Yi, nyi@uab.edu
library(NBZIMM) d = sim(n.ind = 100, n.measure = 10, coef.d = 1, tau.d = 1.5, theta = 2, p.zero = 0) ind = d$ind.ID x = d$x.d y = d$y off = log(d$T) f1 = glmm.nb(y ~ offset(off) + x, random = ~ 1|ind) summary(f1) f1$theta d = sim(n.ind = 100, n.measure = 10, coef.d = 1, tau.d = 1.5, theta = 2, p.zero = 0.4) ind = d$ind.ID x = d$x.d y = d$y off = log(d$T) f1 = glmm.zinb(y ~ offset(off) + x | 1, random = ~ 1|ind) summary(f1) f1$theta unique(f1$zero.prob)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.