orglm: Fitting Order-Restricted Generalised Linear Models

Description Usage Arguments Details Value Author(s) References See Also


orglm is used to fit generalised linear models with restrictions on the parameters, specified by giving a description of the linear predictor, a description of the error distribution, and a description of a matrix with linear constraints. The quadprog package is used to apply linear constraints on the parameter vector.


orglm(formula, family = gaussian, data, weights, subset, na.action,
  start = NULL, etastart, mustart, offset, control = list(...),
  model = TRUE, method = "", x = FALSE, y = TRUE,
  contrasts = NULL, constr, rhs, nec, ...), y, weights = rep(1, nobs), start = NULL, etastart = NULL,
  mustart = NULL, offset = rep(0, nobs), family = gaussian(),
  control = list(), intercept = TRUE, constr, rhs, nec)



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


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 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 orglm is called.


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


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


a list of parameters for controlling the fitting process. For orglm 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 "" uses iteratively reweighted least squares with a quadradic programming step included at each iteration.


is a design matrix of dimension n * p


is a vector of observations of length n.


an optional list. See the contrasts.arg of model.matrix.default.


a matrix with linear constraints. The columns of this matrix should correspond to the columns of the design matrix.


right hand side of the linear constraint formulation. A numeric vector with a length corresponding to the rows of constr.


Number of equality constrints. The first nec constraints defined in constr are treated as equality constraints; the remaining ones are inequality constraints.


For orglm: arguments to be used to form the default control argument if it is not supplied directly.


logical. Should an intercept be included in the null model?


Non-NULL weights can be used to indicate that different observations have different dispersions (with the values in weights being inversely proportional to the dispersions); or equivalently, when the elements of weights are positive integers w_i, that each response y_i is the mean of w_i unit-weight observations. For a binomial GLM prior weights are used to give the number of trials when the response is the proportion of successes: they would rarely be used for a Poisson GLM. If more than one of etastart, start and mustart is specified, the first in the list will be used. It is often advisable to supply starting values for a quasi family, and also for families with unusual links such as gaussian("log"). For the background to warning messages about ‘fitted probabilities numerically 0 or 1 occurred’ for binomial GLMs, see Venables & Ripley (2002, pp. 197–8).


An object of class "orglm" is a list containing at least the following components:


a named vector of coefficients


the working residuals, that is the residuals in the final iteration of the IWLS fit. Since cases with zero weights are omitted, their working residuals are NA.


the fitted mean values, obtained by transforming the linear predictors by the inverse of the link function.


the numeric rank of the fitted linear model.


the family object used.


the linear fit on link scale.


up to a constant, minus twice the maximized log-likelihood. Where sensible, the constant is chosen so that a saturated model has deviance zero.


The deviance for the null model, comparable with deviance. The null model will include the offset, and an intercept if there is one in the model. Note that this will be incorrect if the link function depends on the data other than through the fitted mean: specify a zero offset to force a correct calculation.


the number of iterations of IWLS used.


the working weights, that is the weights in the final iteration of the IWLS fit.


the weights initially supplied, a vector of 1s if none were.


the residual degrees of freedom of the unconstrained model.


the residual degrees of freedom for the null model.


if requested (the default) the y vector used. (It is a vector even for a binomial model.)


logical. Was the IWLS algorithm judged to have converged?


logical. Is the fitted value on the boundary of the attainable values?


Modification of the original by Daniel Gerhard. The original R implementation of glm was written by Simon Davies working for Ross Ihaka at the University of Auckland, but has since been extensively re-written by members of the R Core team. The design was inspired by the S function of the same name described in Hastie & Pregibon (1992).


See Also

glm, solve.QP

goric documentation built on April 19, 2021, 5:06 p.m.