Last data update: 2014.03.03

R: Multinomial Logistic Regression
mlogitR Documentation

Multinomial Logistic Regression

Description

Fits a multinomial logistic regression model to a nominal scale outcome.

Usage

mlogit(formula, data, control = glm.control())

Arguments

formula

An object of class formula containing a symbolic description of the model to be fit. See the documentation of formula for details.

data

An optional data frame containing the variables in the model. If not found in 'data', the variables are taken from the environment from which 'mlogit' is called.

control

A list of parameters for controlling the fitting process. See the documentation of glm.control for details.

Details

The function mlogit fits a multinomial logistic regression model for a multi-valued outcome with nominal scale. The implementation and behaviour are designed to mimic those of glm, but the options are (as yet) more limited. Missing values are not allowed in the data.

The model is fitted without using a reference outcome category; the parameters are made identifiable by the requirement that the sum of corresponding regression coefficients over the outcome categories is zero.

Value

An object of (S4) class mlogit. The class has slots: coefficients (matrix), standard.err (matrix), fitted.values (matrix), x (matrix), y (matrix), formula (formula), call (call), df.null (numeric), df.residual (numeric), null.deviance (numeric), deviance (numeric), iter (numeric), converged (logical).

Methods implemented for the mlogit class are coefficients, fitted.values, residuals and which extract the relevant quantities, and summary, which gives the same output as with a glm object.

Author(s)

Jelle Goeman: j.j.goeman@lumc.nl; Jan Oosting

See Also

glm, multinom.

Examples

  y <- factor(rep(1:4, 5))
  x <- 1:20
  fit <- mlogit(y ~ x)
  summary(fit)
  residuals(fit)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(globaltest)
Loading required package: survival
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/globaltest/mlogit.Rd_%03d_medium.png", width=480, height=480)
> ### Name: mlogit
> ### Title: Multinomial Logistic Regression
> ### Aliases: mlogit mlogit-class residuals,mlogit-method
> ###   fitted.values,mlogit-method coefficients,mlogit-method
> ###   summary,mlogit-method show,mlogit-method
> ### Keywords: nonlinear
> 
> ### ** Examples
> 
>   y <- factor(rep(1:4, 5))
>   x <- 1:20
>   fit <- mlogit(y ~ x)
>   summary(fit)

Call:
mlogit(y ~ x) 

Deviance Residuals:
      Min      1Q  Median      3Q    Max
1 -0.9284 -0.8078 -0.6726 -0.0719 1.8595
2 -0.8081 -0.7823 -0.7388 -0.1121 1.7427
3 -0.8081 -0.7823 -0.7388 -0.1121 1.7427
4 -0.9284 -0.8078 -0.6726 -0.0719 1.8595

Coefficients:

Outcome category 1:
            Estimate Std.Error z-value Pr(>|z|)
(Intercept)   0.4721    0.7691  0.6139   0.5393
x            -0.0465    0.0695 -0.6680   0.5042

Outcome category 2:
            Estimate Std.Error z-value Pr(>|z|)
(Intercept)   0.1762    0.7953  0.2216   0.8246
x            -0.0153    0.0681 -0.2245   0.8224

Outcome category 3:
            Estimate Std.Error z-value Pr(>|z|)
(Intercept)  -0.1450    0.8345 -0.1737   0.8621
x             0.0153    0.0681  0.2245   0.8224

Outcome category 4:
            Estimate Std.Error z-value Pr(>|z|)
(Intercept)  -0.5034    0.8907 -0.5652   0.5720
x             0.0465    0.0695  0.6680   0.5042

Null deviance:     55.452 on 57 degrees of freedom
Residual deviance: 54.689 on 54 degrees of freedom
AIC: 66.689 

Number of Fisher Scoring iterations: 4 
>   residuals(fit)
               1          2          3          4
 [1,]  0.6370189 -0.2785506 -0.2083033 -0.1501650
 [2,] -0.3501301  0.7228076 -0.2137266 -0.1589510
 [3,] -0.3373572 -0.2755332  0.7809536 -0.1680632
 [4,] -0.3246832 -0.2735745 -0.2242451  0.8225028
 [5,]  0.6878715 -0.2713197 -0.2293050 -0.1872467
 [6,] -0.2997136  0.7312266 -0.2342090 -0.1973041
 [7,] -0.2874582 -0.2659417  0.7610600 -0.2076602
 [8,] -0.2753817 -0.2628323 -0.2434816  0.7816956
 [9,]  0.7364973 -0.2594543 -0.2478182 -0.2292248
[10,] -0.2518392  0.7441821 -0.2519350 -0.2404079
[11,] -0.2404079 -0.2519350  0.7441821 -0.2518392
[12,] -0.2292248 -0.2478182 -0.2594543  0.7364973
[13,]  0.7816956 -0.2434816 -0.2628323 -0.2753817
[14,] -0.2076602  0.7610600 -0.2659417 -0.2874582
[15,] -0.1973041 -0.2342090  0.7312266 -0.2997136
[16,] -0.1872467 -0.2293050 -0.2713197  0.6878715
[17,]  0.8225028 -0.2242451 -0.2735745 -0.3246832
[18,] -0.1680632  0.7809536 -0.2755332 -0.3373572
[19,] -0.1589510 -0.2137266  0.7228076 -0.3501301
[20,] -0.1501650 -0.2083033 -0.2785506  0.6370189
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>