
Last chance! 50% off unlimited learning
Sale ends in
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", ...)
an object of class formula
which determines
the form of regression for the model parameter
an object of class formula
which determines
the form of regression for the model parameter NULL
meaning the formula is intercept only. An offset can
also be added in the formula.
an optional data.frame
containing the variables in
the model. If not found in data, the variables are taken from
environment(lamFormula)
.
optional vector of starting values for the coefficients of
the
optional vector of starting values for the coefficients of the
an integer for the summation term in the density (default 100).
optimisation method passed to optim
(default
"BFGS").
further arguments to be passed to optim
.
An object of class 'Comp' which is a list with all the components needed for the relevant S3 class methods.
A log link is used for regression of the model parameters
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
,
A Flexible Regression Model for Count Data, by Sellers & Shmueli, http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1127359
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab