Efficient Generalized Linear Model ("eglm") is used to fit generalized
linear models in an equivalent way to "glm" but in a reduced
time depending on the design matrix and the family (or link).
eglm(
formula,
family = gaussian,
data,
weights,
subset,
na.action,
start = NULL,
etastart,
mustart,
offset,
control = list(...),
model = TRUE,
method = "eglm.wfit",
x = FALSE,
y = TRUE,
singular.ok = TRUE,
contrasts = NULL,
reduce = FALSE,
...
)an object of class "formula" (or one that can be
coerced to that class): a symbolic description of the model to be fitted.
The details of model specification are given under ‘Details’.
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, a family function or the result of a call to a family
function. See family for details of family functions.
an optional data frame, list or environment (or object coercible
by as.data.frame to a data frame) containing the variables in
the model. If not found in data, the variables are taken from
environment(formula), typically the environment from which lm
is called.
an optional vector of weights to be used in the fitting
process. Should be NULL or a numeric vector. If non-NULL, weighted
least squares is used with weights weights (that is, minimizing
sum(w*e^2)); otherwise ordinary least squares is used.
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
contain NAs. The default is set by the na.action setting of
options, and is na.fail if that is unset. The
‘factory-fresh’ default is na.omit. Another possible
value is NULL, no action. Value na.exclude can be
useful.
starting values for the parameters in the linear predictor.
starting values for the linear predictor.
starting values for the vector of means.
this can be used to specify an a priori known component
to be included in the linear predictor during fitting. This should be
NULL or a numeric vector or matrix of extents matching those of the
response. One or more offset terms can be included in the
formula instead or as well, and if more than one are specified their sum is
used. See model.offset.
a list of parameters for controlling the fitting process. For
eglm.wfit this is passed to glm.control.
a logical value indicating whether model frame should be included as a component of the returned value.
the method to be used in fitting the model. The default method
"eglm.wfit" uses iteratively reweighted least squares (IWLS): the
alternative "model.frame" returns the model frame and does no
fitting. User-supplied fitting functions can be supplied either as a
function or a character string naming a function, with a function which
takes the same arguments as glm.fit from the stats package.
If specified as a character string it is looked up from within the
eflm namespace.
logical values indicating whether the
model matrix (x) and the response vector (y)
used in the fitting process should be returned as components of the returned
value.
logical; if FALSE a singular fit is an error.
an optional list. See the contrasts.arg of
model.matrix.default.
logical; if TRUE an alternate design matrix of p * p is
used for the fitting instead of the traditional n * p design matrix.
For eglm: arguments to be used to form the default control argument if it is not supplied directly. For weights: further arguments passed to or from other methods.
An object of class "eglm" that behaves the same way as the "glm"
class, see the function "glm". This output also includes the
logical "reduce" and, depending on it, the reduced design matrix "xtx"
when the reduce argument is set to TRUE.
Models for eglm are specified symbolically.
A typical model has the form response ~ terms where response
is the (numeric) response vector and terms is a series of terms which
specifies a linear predictor for response. A terms specification of
the form first + second indicates all the terms in first
together with all the terms in second with duplicates removed. A
specification of the form first:second indicates the set of
terms obtained by taking the interactions of all terms in first
with all terms in second. The specification first*second
indicates the cross of first and second. This is
the same as first + second + first:second, and exactly the same as
"glm" from the stats package.
eglm(mpg ~ wt, family = gaussian, data = mtcars)
#>
#> Call: eglm(formula = mpg ~ wt, family = gaussian, data = mtcars)
#>
#> Coefficients:
#> (Intercept) wt
#> 37.285 -5.344
#>
#> Degrees of Freedom: 31 Total (i.e. Null); 30 Residual
#> Null Deviance: 1126
#> Residual Deviance: 278.3 AIC: 166