logbin fits relative risk (log-link) binomial
1 2 3 4 5
an object of class
a vector indicating which terms in
an optional data frame, list or environment
(or object coercible by
an optional vector specifying a subset of observations to be used in the fitting process.
a function which indicates what should happen when the data
starting values for the parameters in the linear predictor.
this can be used to specify an a
priori known component to be included in the linear
predictor during fitting. This should be
a list of parameters for controlling the
fitting process, passed to
a logical value indicating whether the model frame should be included as a component of the returned value.
a character string that determines which algorithm to use
to find the MLE. The main purpose of
a list of control parameters for the fitting algorithm.
This is passed to the
If any items are not specified, the defaults are used.
a logical indicating whether or not warnings should be provided for non-convergence or boundary values.
arguments to be used to form the default
logbin fits a generalised linear model (GLM) with a
binomial error distribution and log link
function. Predictors are assumed to be continuous, unless
they are of class
factor, or are character or
logical (in which case they are converted to
factors). Specifying a predictor as monotonic using
mono argument means that for continuous terms,
the associated coefficient will be restricted to be
non-negative, and for categorical terms, the coefficients
will be non-decreasing in the order of the factor
levels. This allows semi-parametric monotonic regression
functions, in the form of unsmoothed step-functions. For
smooth regression functions see
As well as allowing monotonicity constraints, the function
is useful when a standard GLM routine, such as
glm, fails to converge with a log-link
binomial model. For convenience in comparing convergence on
the same model,
logbin can be used
as a wrapper function to
glm does achieve successful convergence,
logbin converges to an interior point, then the two
results will be identical. However, as illustrated in one of
the examples below,
glm may still experience convergence
problems even when
logbin converges to an interior point.
Note that if
logbin converges to a boundary point, then it
may differ slightly from
glm even if
converges, because of differences in the definition of the parameter
logbin produces valid fitted values for covariate
values within the Cartesian product of the observed range of covariate
glm produces valid fitted values just
for the observed covariate combinations (assuming it successfully
converges). This issue is only relevant when
converges to a boundary point. The adaptive barrier approach defines
the parameter space in the same way as
glm, so the
same comments apply when comparing its results to those from
method = "cem" or
The main computational method is an EM-type algorithm which accommodates
the parameter contraints in the model and is more stable than iteratively
reweighted least squares. This is done in one of two ways,
depending on the choice of the
method = "cem" implements a CEM algorithm (Marschner, 2014),
in which a collection of restricted parameter spaces is defined
that covers the full parameter space, and an EM algorithm is applied within each
restricted parameter space in order to find a collection of
restricted maxima of the log-likelihood function, from
which can be obtained the global maximum over the full
parameter space. See Marschner and Gillett (2012) for further
method = "em" implements a single EM algorithm
on an overparameterised model, and the MLE of this model
is transformed back to the original parameter space.
Acceleration of the EM algorithm in either case can be
achieved through the methods of the
package, specified through the
accelerate argument. However,
note that these methods do not have the guaranteed convergence of
the standard EM algorithm, particularly when the MLE is on the
boundary of its (possibly constrained) parameter space.
Alternatively, an adaptive barrier method can be used by specifying
method = "ab", which maximises the likelihood subject to
constraints on the fitted values.
logbin returns an object of class
which inherits from classes
summary.logbin can be used
to obtain or print a summary of the results.
The generic accessor functions
residuals can be used to
extract various useful features of the value returned by
logbin. Note that
effects will not work.
An object of class
"logbin" is a list containing the
same components as an object of class
"glm" (see the
"Value" section of
glm). It also includes:
the maximised log-likelihood.
a small-sample corrected
version of Akaike's An Information Criterion
(Hurvich, Simonoff and Tsai, 1998). This is used by
the minimum and maximum observed values for each of the continuous covariates, to help define the covariate space of the model.
As well as:
estimated coefficients associated with the non-positive parameterisation corresponding to the MLE.
non-negative model matrix associated with
Due to the way in which the covariate space is defined in the CEM algorithm,
models that include terms that are functionally dependent on one another
— such as interactions and polynomials — may give unexpected
results. Categorical covariates should always be entered directly
as factors rather than dummy variables. 2-way interactions between
factors can be included by calculating a new factor term that
has levels corresponding to all possible combinations of the factor
levels (see the Example). Non-linear relationships can be included
Mark W. Donoghoe [email protected]
Hurvich, C. M., J. S. Simonoff and C.-L. Tsai (1998). Smoothing parameter selection in non-parametric regression using an improved Akaike information criterion. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 60(2): 271–293.
Marschner, I. C. (2014). Combinatorial EM algorithms. Statistics and Computing 24(6): 921–940.
Marschner, I. C. and A. C. Gillett (2012). Relative risk regression: reliable and flexible methods for log-binomial models. Biostatistics 13(1): 179–192.
logbin.smooth for semi-parametric models
turboem for acceleration methods
constrOptim for the adaptive barrier approach.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
require(glm2) data(heart) #====================================================== # Model with periodic non-convergence when glm is used #====================================================== start.p <- sum(heart$Deaths) / sum(heart$Patients) fit.glm <- glm(cbind(Deaths, Patients-Deaths) ~ factor(AgeGroup) + factor(Severity) + factor(Delay) + factor(Region), family = binomial(log), start = c(log(start.p), -rep(1e-4, 8)), data = heart, trace = TRUE, maxit = 100) fit.logbin <- logbin(formula(fit.glm), data = heart, trace = 1) summary(fit.logbin) # Speed up convergence by using single EM algorithm fit.logbin.em <- update(fit.logbin, method = "em") # Speed up convergence by using acceleration methods fit.logbin.acc <- update(fit.logbin, accelerate = "squarem") fit.logbin.em.acc <- update(fit.logbin.em, accelerate = "squarem") #============================= # Model with interaction term #============================= heart$AgeSev <- 10 * heart$AgeGroup + heart$Severity fit.logbin.int <- logbin(cbind(Deaths, Patients-Deaths) ~ factor(AgeSev) + factor(Delay) + factor(Region), data = heart, trace = 1, maxit = 100000) summary(fit.logbin.int) vcov(fit.logbin.int) confint(fit.logbin.int) summary(predict(fit.logbin.int, type = "response")) anova(fit.logbin, fit.logbin.int, test = "Chisq")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.