simReg: Simulate Poisson-Gamma data whose component means vary with covariates.
Description
simReg is used to simulate data from a combined model for the Poisson and Gamma components of a Poisson-Gamma distribution. This formuation allows the distribution to vary with covariates.
Usage
simReg( n, lambda.tau, mu.Z.tau, alpha, offset1=NULL, X=NULL)
Value
A data frame containing the random draws, the offset (if not NULL), and the covariates. The data frame has an attribute called "coef" that lists the values used for the simulation.
Arguments
n
number of observations
lambda.tau
vector of coefficients for Poisson part of model.
mu.Z.tau
vector of coefficients for Gamma component of model. Its length must be equal to the length of lambda.tau.
alpha
scalar for Gamma dispersion.
offset1
vector of offset values (for Poisson part of the process). If NULL (default) a vector of zeros is created and used.
X
a design matrix with appropriate elements for simulation. If NULL (default) then one will be created.
Author
Scott D. Foster
Details
The observed random variables y_i are assumed to arise from the process: y_i=sum(z_{i1}+z_{i2}+...+z_{in_i}) where n_i is a Poisson variable with mean lambda and z_{ij} is a Gamma variable with mean mu.Z and variance mu.Z^2 / alpha.
The Poisson mean is given by lambda=exp( X %*% lambda.tau) where X is a suitable design matrix whose first column is full of 1s and whose remain columns are random draws from a standard normal.
The Gamma mean is given by mu.Z=exp( X %*% mu.Z.tau) where X is identical to before.
References
Foster, S.D. and Bravington, M.V. (2013) A Poisson-Gamma Model for Analysis of Ecological Non-Negative Continuous Data. Journal of Environmental and Ecological Statistics20: 533-552