glmSparse is a thin wrapper around MatrixModels::glm4. The notable differences are that glmSparse always fits using a sparse model matrix, and that it provides an alternate interface for situations where the user wants to directly provide a sparse model matrix and response variable instead of using the more standard formula interface. For more details on the underlying implementation, see MatrixModels::glm4.

glmSparse(
  formula = NULL,
  family = stats::gaussian,
  data = NULL,
  weights = NULL,
  subset = NULL,
  na.action = stats::na.fail,
  start = NULL,
  etastart = NULL,
  mustart = NULL,
  offset = NULL,
  doFit = TRUE,
  control = list(...),
  model = TRUE,
  contrasts = NULL,
  x = NULL,
  y = NULL,
  drop.unused.levels = FALSE,
  ...
)

Arguments

formula

An object of class formula, (or one that can be coerced to that class): a symbolic description of the model to be fitted.

family

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.)

data

An optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model.

weights

an optional vector of ‘prior weights’ to be used in the fitting process. Should be NULL or a numeric vector.

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 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.

start

Starting values for the parameters in the linear predictor.

etastart

Starting values for the parameters in the predictor itself.

mustart

Starting values for the parameters in the vector of means.

offset

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 of length equal to the number of cases. One or more offset terms can be included in the formula instead or as well, and if more than one is specified, their sum is used. See model.offset.

doFit

Logical indicating if the model should be fitted (or just returned unfitted).

control

A list with options on fitting; currently passed unchanged to (hidden) function IRLS().

model

Currently ignored; here for back-compatibility with glm.

contrasts

Currently ignored; here for back-compatibility with glm.

x

Alternate interface for modeling. An already-constructed sparse model matrix (class 'dgCMatrix').

y

Alternate interface for modeling. A numeric response vector.

drop.unused.levels

Should factors have unused levels dropped? Defaults to FALSE.

...

Potentially arguments passed on to fitter functions; currently unused.

Value

An object of class glpModel.

See also

Matrix::sparse.model.matrix() for information on creating sparse model matrices, and MatrixModels::glm4() to understand more details on the implementation.