glm.comp {CompGLM} | R Documentation |
A function in similar format to glm
which provides a
linear form regressing on the parameters lambda and mu.
glm.comp(lamFormula, nuFormula = NULL, data, lamStart = NULL, nuStart = NULL, sumTo = 100L, method = "BFGS", ...)
lamFormula |
an object of class |
nuFormula |
an object of class |
data |
an optional |
lamStart |
optional vector of starting values for the coefficients of the λ regression. |
nuStart |
optional vector of starting values for the coefficients of the ν regression. |
sumTo |
an integer for the summation term in the density (default 100). |
method |
optimisation method passed to |
... |
further arguments to be passed to |
A log link is used for regression of the model parameters λ and ν, that is:
log(λ) = β X
log(ν) = ζ Y
where: β is the vector of coefficients for the parameter λ, ζ is the vector of coefficients for the parameter ν, X is the model matrix for the parameter λ, and Y is the model matrix for the parameter ν.
The parameter vectors are calculated via maximum likelihood using the
general optimisation function optim
. A Poisson model will
be fit using glm.fit
and (unless starting values are
supplied) the coefficients will be used as starting values for the
parameter vector β.
Several S3 functions have been implemented for model analysis
print
, coef
, extractAIC
,
logLik
, predict
, and summary
,
An object of class 'Comp' which is a list with all the components needed for the relevant S3 class methods.
Jeffrey Pollock <jeffpollock9@gmail.com>
A Flexible Regression Model for Count Data, by Sellers & Shmueli, http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1127359
set.seed(1) n <- 5000 x1 <- rnorm(n, -1.0, 0.5) x2 <- rnorm(n, 1.0, 0.7) x3 <- rnorm(n, 2.0, 0.4) y <- rpois(n, exp(-0.5 + 0.3 * x1 + 0.8 * x2 + 0.2 * x3)) data <- data.frame(y, x1, x2, x3) model <- glm.comp(y ~ ., data = data) print(model) summary(model) coef(model) head(predict(model)) AIC(model)