Function that fits generalized linear models
fit_glm(x, y, family, weights, offset, fast = TRUE)
A list with the following components:
logl
: the log likelihood of the fitted model.
coefficients
: regression coefficients.
df
: number of parameters (degrees of freedom).
sse
: residual sum of squares.
fit
: the fitted model object.
a matrix of predictors with nobs observations.
a vector for the outcome variable.
a family function e.g. stats::gaussian()
.
a numeric vector of length nobs of 'prior weights' to be used
in the fitting process. see stats::glm()
for details.
a numeric vector of length nobs of of a priori known component to be included in the linear predictor during fitting.
a logical which determines how the model is fitted. The default
TRUE
uses fast fitting routines (i.e. stats::glm.fit()
), while FALSE
uses the normal fitting routines (stats::glm()
) (used for the final output
of mfp2
).
The difference is mainly due to the fact that normal fitting routines have
to handle data.frames, which is a lot slower than using the model matrix
and outcome vectors directly.