Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mblogit

Baseline-Category Logit Models for Categorical and Multinomial Responses


Description

The function mblogit fits baseline-category logit models for categorical and multinomial count responses with fixed alternatives.

Usage

mblogit(
  formula,
  data = parent.frame(),
  random = NULL,
  subset,
  weights = NULL,
  na.action = getOption("na.action"),
  model = TRUE,
  x = FALSE,
  y = TRUE,
  contrasts = NULL,
  method = NULL,
  estimator = c("ML", "REML"),
  dispersion = FALSE,
  from.table = FALSE,
  groups = NULL,
  control = if (length(random)) mmclogit.control(...) else mclogit.control(...),
  ...
)

Arguments

formula

the model formula. The response must be a factor or a matrix of counts.

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. If not found in data, the variables are taken from environment(formula), typically the environment from which glm is called.

random

an optional formula that specifies the random-effects structure or NULL.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

weights

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

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.

model

a logical value indicating whether model frame should be included as a component of the returned value.

x, y

logical values indicating whether the response vector and model matrix used in the fitting process should be returned as components of the returned value.

contrasts

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

method

NULL or a character string, either "PQL" or "MQL", specifies the type of the quasilikelihood approximation to be used if a random-effects model is to be estimated.

estimator

a character string; either "ML" or "REML", specifies which estimator is to be used/approximated.

dispersion

a logical value or a character string; whether and how a dispersion parameter should be estimated. For details see dispersion.

from.table

a logical value; do the data represent a contingency table, e.g. were created by applying as.data.frame() a the result of table() or xtabs(). This relevant only if the response is a factor. This argument should be set to TRUE if the data do come from a contingency table. Correctly setting from.table=TRUE in this case, will lead to efficiency gains in computing, but more importantly overdispersion will correctly be computed if present.

groups

an optional formula that specifies groups of observations relevant for the specification of overdispersed response counts.

control

a list of parameters for the fitting process. See mclogit.control

...

arguments to be passed to mclogit.control or mmclogit.control

Details

The function mblogit internally rearranges the data into a 'long' format and uses mclogit.fit to compute estimates. Nevertheless, the 'user data' is unaffected.

Value

mblogit returns an object of class "mblogit", which has almost the same structure as an object of class "glm". The difference are the components coefficients, residuals, fitted.values, linear.predictors, and y, which are matrices with number of columns equal to the number of response categories minus one.

References

Agresti, Alan (2002). Categorical Data Analysis. 2nd ed, Hoboken, NJ: Wiley. doi: 10.1002/0471249688

Breslow, N.E. and D.G. Clayton (1993). "Approximate Inference in Generalized Linear Mixed Models". Journal of the American Statistical Association 88 (421): 9-25. doi: 10.1080/01621459.1993.10594284

See Also

The function multinom in package nnet also fits multinomial baseline-category logit models, but has a slightly less convenient output and does not support overdispersion or random effects. However, it provides some other options. Baseline-category logit models are also supported by the package VGAM, as well as some reduced-rank and (semi-parametric) additive generalisations. The package mnlogit estimates logit models in a way optimized for large numbers of alternatives.

Examples

library(MASS) # For 'housing' data
library(nnet)
library(memisc)

(house.mult<- multinom(Sat ~ Infl + Type + Cont, weights = Freq,
                       data = housing))


(house.mblogit <- mblogit(Sat ~ Infl + Type + Cont, weights = Freq,
                         data = housing))

summary(house.mult)

summary(house.mblogit)

mtable(house.mblogit)

mclogit

Multinomial Logit Models, with or without Random Effects or Overdispersion

v0.8.7.3
GPL-2
Authors
Martin Elff
Initial release
2021-03-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.