This function is an implementation of the IRLS estimation algorithm adjusted
to the specific usage within the function SplineReg_GLM
.
IRLSfit(
x,
y,
weights = rep(1, nobs),
mustart = NULL,
offset = rep(0, nobs),
family = gaussian(),
control = list()
)
A list containing:
a named vector containing the estimated regression coefficients;
the working residuals, which are the residuals from the
final iteration of the IRLS fit. Cases with zero weights are omitted, and
their working residuals are NA
;
the working residuals after the final IRLS iteration. They are used within the knot placement steps of stage A of GeDS;
the fitted mean values, obtained by transforming the predictor by the inverse of the link function;
the numeric rank of the fitted linear model;
the family
object used;
the fitted predictor;
a vector containing the deviances obtained at each IRLS iteration;
the deviance at the last IRLS iteration;
The deviance for the null model (see
glm
documentation);
the number of IRLS iterations performed;
the working weights after the last IRLS iteration;
the ``prior weights" (see the weights
argument);
the residual degrees of freedom;
the residual degrees of freedom for the null model;
the vector of values of the response variable used in the fitting;
the transformed responses computed after the last IRLS iteration;
logical. Was the IRLS algorithm judged to have converged?
logical. Is the fitted value on the boundary of the attainable values?
In addition, non-empty fits will have components qr
, R
and
effects
relating to the final weighted linear fit, see
lm.fit
documentation.
a matrix of regression functions (e.g. B-splines and/or terms of the parametric part) evaluated at the sample values of the covariate(s).
a vector of size \(N\) containing the observed values of the response variable \(y\).
an optional vector of prior weights for the observations, used when weighted IRLS fitting is required. By default, this is a vector of 1s.
initial values for the vector of means of the response variable in the IRLS regression estimation. Must be a vector of length \(N\).
a vector of size \(N\) that can be used to specify a fixed covariate to be included in the predictor model avoiding the estimation of its corresponding regression coefficient. In the case that more than one covariate is fixed, the user should sum the corresponding coordinates of the fixed covariates to produce one common \(N\)-vector of coordinates.
a description of the error distribution and link function to be
used in the model. This can be a character string naming a family function
(e.g. "gaussian"
), the family function itself (e.g.
gaussian
) or the result of a call to a family function
(e.g. gaussian()
). See family for details on family
functions.
a list of parameters for controlling the IRLS fitting process
to be passed on to glm.control
. See
glm.fit
for further details.
This function is a slightly modified version of the
glm.fit
from the package stats to which we refer
for further details. The difference in the inputs of IRLSfit
and
glm.fit
is that the former admits initial values only
for the vector of means.
The output from IRLSfit
has some additional slots compared to
glm.fit
. We note that the slots weights
,
res2
and z
contain values of the IRLS weights, ``working
residuals" and transformed responses computed after the last IRLS
iteration, i.e. they are based on the estimated coefficients that are
returned by IRLSfit
.
The source code of IRLSfit
contains also some commented lines that
produce useful plots at each IRLS iteration. Normally, printing these plots
is time consuming, but they could be run for inspection purposes.