Description Usage Arguments Details Value Note Author(s) References See Also Examples
logbin
fits relative risk (loglink) binomial
regression models.
1 2 3 4 5 
formula 
an object of class 
mono 
a vector indicating which terms in

data 
an optional data frame, list or environment
(or object coercible by 
subset 
an optional vector specifying a subset of observations to be used in the fitting process. 
na.action 
a function which indicates what should happen when the data
contain 
start 
starting values for the parameters in the linear predictor. 
offset 
this can be used to specify an a
priori known component to be included in the linear
predictor during fitting. This should be 
control 
a list of parameters for controlling the
fitting process, passed to
With 
model 
a logical value indicating whether the model frame should be included as a component of the returned value. 
method 
a character string that determines which algorithm to use
to find the MLE. The main purpose of

accelerate 
for the 
control.method 
a list of control parameters for the fitting algorithm. This is passed to the If If any items are not specified, the defaults are used. 
warn 
a logical indicating whether or not warnings should be provided for nonconvergence 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
factor
s). Specifying a predictor as monotonic using
the mono
argument means that for continuous terms,
the associated coefficient will be restricted to be
nonnegative, and for categorical terms, the coefficients
will be nondecreasing in the order of the factor
levels
. This allows semiparametric monotonic regression
functions, in the form of unsmoothed stepfunctions. For
smooth regression functions see logbin.smooth
.
As well as allowing monotonicity constraints, the function
is useful when a standard GLM routine, such as
glm
, fails to converge with a loglink
binomial model. For convenience in comparing convergence on
the same model, logbin
can be used
as a wrapper function to glm
and glm2
through the method
argument.
If glm
does achieve successful convergence,
and 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 glm
successfully
converges, because of differences in the definition of the parameter
space. logbin
produces valid fitted values for covariate
values within the Cartesian product of the observed range of covariate
values, whereas glm
produces valid fitted values just
for the observed covariate combinations (assuming it successfully
converges). This issue is only relevant when logbin
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 "em"
.
The main computational method is an EMtype 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
argument.
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 loglikelihood function, from
which can be obtained the global maximum over the full
parameter space. See Marschner and Gillett (2012) for further
details.
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 turboem
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 "logbin"
,
which inherits from classes "glm"
and "lm"
.
The function summary.logbin
can be used
to obtain or print a summary of the results.
The generic accessor functions coefficients
,
fitted.values
and 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:
loglik 
the maximised loglikelihood. 
aic.c 
a smallsample corrected
version of Akaike's An Information Criterion
(Hurvich, Simonoff and Tsai, 1998). This is used by

xminmax 
the minimum and maximum observed values for each of the continuous covariates, to help define the covariate space of the model. 
As well as:
np.coefficients 
estimated coefficients associated with the nonpositive parameterisation corresponding to the MLE. 
nn.x 
nonnegative model matrix associated with

coefhist 
(if 
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. 2way 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). Nonlinear relationships can be included
by using logbin.smooth
.
Mark W. Donoghoe [email protected]
Hurvich, C. M., J. S. Simonoff and C.L. Tsai (1998). Smoothing parameter selection in nonparametric 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 logbinomial models. Biostatistics 13(1): 179–192.
logbin.smooth
for semiparametric 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 nonconvergence when glm is used
#======================================================
start.p < sum(heart$Deaths) / sum(heart$Patients)
fit.glm < glm(cbind(Deaths, PatientsDeaths) ~ factor(AgeGroup) + factor(Severity) +
factor(Delay) + factor(Region), family = binomial(log),
start = c(log(start.p), rep(1e4, 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, PatientsDeaths) ~ 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.