disgam {COZIGAM}R Documentation

Fitting Discrete Generalized Additive Models with Model Selection Criterion

Description

Fit a discrete Generalized Additive Model (GAM) to data and calculate the logarithmic marginal likelihood.

Usage

disgam (formula, size=NULL, family = poisson(), data=list(), ...)

Arguments

formula A GAM formula. This is exactly like the formula for a GLM except that smooth terms can be added to the right hand side of the formula (and a formula of the form y ~ . is not allowed). Smooth terms are specified by expressions of the form: s(var1,var2,...,k=12,fx=FALSE,bs="tp",by=a.var) where var1, var2, etc. are the covariates which the smooth is a function of and k is the dimension of the basis used to represent the smooth term. by can be used to specify a variable by which the smooth should be multiplied.
size Number of trials. Must be specified when family is binomial.
family This is a family object specifying the distribution and link to use in fitting etc. See glm and family for more details. Currently support Poisson and binomial distributions.
data A data frame or list containing the model response variable and covariates required by the formula.
... Additional arguments to be passed to the low level regression fitting functions.

Details

It is necessary to assess whether there is zero-inflation in count data, e.g., Poisson or binomial data. The model selection approach can be used to determine whether a zero-inflated model is needed. To do that, we can fit both a ZIGAM and a regular GAM to the data, and then compare the logarithmic marginal likelihoods from these two models. Higher logarithmic marginal likelihood from the ZIGAM would indicate that there is zero-inflation in the count data. Otherwise, we can simply fit a regular GAM instead of a ZIGAM. See Liu and Chan (2008) for more detail.

Value

A list containing the following components:

fit.gam A fitted GAM assuming there is no zero-inflation in the data.
V.beta The estimated covariance matrix of the GAM.
mu The fitted mean values.
formula Model formula.
family The family used.
loglik, ploglik The (penalized) log-likelihood of the fitted model.
logE Approximated logarithmic marginal likelihood by Laplace method used for model selection.

Author(s)

Hai Liu and Kung-Sik Chan

References

Liu, H and Chan, K.S. (2008) Constrained Generalized Additive Model with Zero-Inflated Data. Technical Report 388, Department of Statistics and Actuarial Science, The University of Iowa. http://www.stat.uiowa.edu/techrep/tr388.pdf

See Also

zigam

Examples

## Poisson Response
set.seed(11)
n <- 200
x1 <- runif(n, 0, 1)

eta0 <- f0(x1)/4 - 0.5
mu0 <- exp(eta0)

y <- rpois(rep(1,n), mu0) # generating non-zero-inflated data

res.gam <- disgam(y~s(x1), family=poisson) # fit a regular GAM
res.zigam <- zigam(y~s(x1), maxiter=10, family=poisson) # fit a ZIGAM

res.gam$logE > res.zigam$logE # compare the model selction criterion

# Another example
set.seed(11)
n <- 200
x1 <- runif(n, 0, 1)
eta0 <- f0(x1)/4 - 0.5
mu0 <- exp(eta0)

alpha0 <- 0.4
delta0 <- 0.8
p0 <- .Call("logit_linkinv", alpha0 + delta0 * eta0, PACKAGE = "stats")

# Generating zero-inflated Poisson count data
z <- rbinom(rep(1,n), 1, p0)
y <- rpois(rep(1,n), mu0)
y[z==0] <- 0

res.gam <- disgam(y~s(x1), family=poisson) # fit a regular GAM
res.zigam <- zigam(y~s(x1), family=poisson) # fit a ZIGAM

res.gam$logE < res.zigam$logE # compare the model selction criterion


[Package COZIGAM version 2.0-1 Index]