Home

glmFit

glmFit, commonly written glmfit, is a function in MATLAB's Statistics and Machine Learning Toolbox that fits generalized linear models (GLMs) to data. It estimates model coefficients using the iteratively reweighted least squares (IRLS) algorithm and supports responses that follow distributions in the exponential family, such as normal, binomial, Poisson, and gamma. Users can specify a link function, choosing from canonical or alternative options, and may provide weights and offsets to model varying exposure or known effects.

Inputs and options: The main inputs are X, an n-by-p design matrix, and y, an n-by-1 response

Outputs: B contains the estimated coefficients for the predictors and the intercept. DEV is the model deviance,

Applications and behavior: GLMs fitted with glmfit enable a range of common analyses, including logistic regression

History and context: glmfit is part of MATLAB’s Statistics and Machine Learning Toolbox and has long been

vector.
The
function
accepts
a
distribution
spec
(DIST)
such
as
'normal',
'binomial',
'poisson',
or
'gamma',
and
a
'link'
specification.
Optional
inputs
include
'weights'
and
'offset',
with
additional
controls
accessible
through
an
options
structure
created
by
statset.
The
usual
call
returns
B,
the
coefficient
vector
including
the
intercept,
the
deviance
DEV,
and
a
stats
structure
with
diagnostic
information
such
as
standard
errors,
and,
if
requested,
t-statistics
and
p-values.
reflecting
the
goodness
of
fit.
STATS
is
a
structure
providing
supplementary
information
about
the
fit,
including
covariance
estimates
for
the
coefficients,
standard
errors,
and
other
diagnostic
quantities
useful
for
inference.
for
binary
data
(binomial
with
a
logit
link),
Poisson
regression
for
count
data
(Poisson
with
a
log
link),
and
gamma
regression
for
positive
continuous
data.
The
function
supports
offset
terms
to
handle
known
exposure
or
baseline
effects
and
can
incorporate
observation
weights
to
reflect
varying
precision
across
data
points.
used
for
flexible
modeling
of
diverse
data
types.
It
complements
related
functions
such
as
glmval
for
computing
predicted
responses
from
estimated
coefficients.