dispersion
mclogit
0.8.6.2
Overdispersion in Multinomial Logit Models¶
Description¶
The function dispersion()
extracts the dispersion parameter from a multinomial logit
model or computes a dispersion parameter estimate based on a given method. This
dispersion parameter can be attached to a model using update()
. It can also given as
an argument to summary()
.
Usage¶
dispersion(object,method, ...)
## S4 method for signature 'mclogit'
dispersion(object,method=NULL, ...)
Arguments¶
object
-
an object that inherits class
"mclogit"
. When passed todispersion()
, it should be the result of a call ofmclogit()
ofmblogit()
, without random effects. method
-
a character string, either
"Afroz"
,"Fletcher"
,"Pearson"
, or"Deviance"
, that specifies the estimator of the dispersion; orNULL
, in which case the default estimator,"Afroz"
is used. The estimators are discussed in Afroz et al. (2019). ...
-
other arguments, ignored or passed to other methods.
Examples¶
library(MASS) # For 'housing' data
# Note that with a factor response and frequency weighted data,
# Overdispersion will be overestimated:
house.mblogit <- mblogit(Sat ~ Infl + Type + Cont, weights = Freq,
data = housing)
Iteration 1 - Deviance = 3493.764
Iteration 2 - Deviance = 3470.111
Iteration 3 - Deviance = 3470.084
Iteration 4 - Deviance = 3470.084
converged
dispersion(house.mblogit,method="Afroz")
[1] 20.45129
dispersion(house.mblogit,method="Deviance")
[1] 26.69295
summary(house.mblogit)
Call:
mblogit(formula = Sat ~ Infl + Type + Cont, data = housing, weights = Freq)
Equation for Medium vs Low:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.4192 0.1729 -2.424 0.015342 *
InflMedium 0.4464 0.1416 3.153 0.001613 **
InflHigh 0.6649 0.1863 3.568 0.000359 ***
TypeApartment -0.4357 0.1725 -2.525 0.011562 *
TypeAtrium 0.1314 0.2231 0.589 0.555980
TypeTerrace -0.6666 0.2063 -3.232 0.001230 **
ContHigh 0.3609 0.1324 2.726 0.006420 **
Equation for High vs Low:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.1387 0.1592 -0.871 0.383570
InflMedium 0.7349 0.1369 5.366 8.03e-08 ***
InflHigh 1.6126 0.1671 9.649 < 2e-16 ***
TypeApartment -0.7356 0.1553 -4.738 2.16e-06 ***
TypeAtrium -0.4080 0.2115 -1.929 0.053730 .
TypeTerrace -1.4123 0.2001 -7.056 1.71e-12 ***
ContHigh 0.4818 0.1241 3.881 0.000104 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Null Deviance: 3694
Residual Deviance: 3470
Number of Fisher Scoring iterations: 4
Number of observations: 1681
phi.Afroz <- dispersion(house.mblogit,method="Afroz")
summary(house.mblogit, dispersion=phi.Afroz)
Call:
mblogit(formula = Sat ~ Infl + Type + Cont, data = housing, weights = Freq)
Equation for Medium vs Low:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.4192 0.7821 -0.536 0.593
InflMedium 0.4464 0.6402 0.697 0.487
InflHigh 0.6649 0.8427 0.789 0.432
TypeApartment -0.4357 0.7802 -0.558 0.578
TypeAtrium 0.1314 1.0090 0.130 0.897
TypeTerrace -0.6666 0.9327 -0.715 0.476
ContHigh 0.3609 0.5987 0.603 0.548
Equation for High vs Low:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1387 0.7201 -0.193 0.8475
InflMedium 0.7349 0.6193 1.187 0.2375
InflHigh 1.6126 0.7558 2.134 0.0348 *
TypeApartment -0.7356 0.7022 -1.048 0.2968
TypeAtrium -0.4080 0.9565 -0.427 0.6704
TypeTerrace -1.4123 0.9051 -1.560 0.1211
ContHigh 0.4818 0.5614 0.858 0.3923
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Dispersion: 20.45129 on 130 degrees of freedom
Null Deviance: 3694
Residual Deviance: 3470
Number of Fisher Scoring iterations: 4
Number of observations: 1681
summary(update(house.mblogit, dispersion="Afroz"))
Call:
mblogit(formula = Sat ~ Infl + Type + Cont, data = housing, weights = Freq)
Equation for Medium vs Low:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.4192 0.7821 -0.536 0.593
InflMedium 0.4464 0.6402 0.697 0.487
InflHigh 0.6649 0.8427 0.789 0.432
TypeApartment -0.4357 0.7802 -0.558 0.578
TypeAtrium 0.1314 1.0090 0.130 0.897
TypeTerrace -0.6666 0.9327 -0.715 0.476
ContHigh 0.3609 0.5987 0.603 0.548
Equation for High vs Low:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1387 0.7201 -0.193 0.8475
InflMedium 0.7349 0.6193 1.187 0.2375
InflHigh 1.6126 0.7558 2.134 0.0348 *
TypeApartment -0.7356 0.7022 -1.048 0.2968
TypeAtrium -0.4080 0.9565 -0.427 0.6704
TypeTerrace -1.4123 0.9051 -1.560 0.1211
ContHigh 0.4818 0.5614 0.858 0.3923
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Dispersion: 20.45129 on 130 degrees of freedom
Null Deviance: 3694
Residual Deviance: 3470
Number of Fisher Scoring iterations: 4
Number of observations: 1681
# In order to be able to estimate overdispersion accurately,
# data like the above (which usually comes from applying
# 'as.data.frame' to a contingency table) the model has to be
# fitted with the optional argument 'from.table=TRUE':
house.mblogit.corrected <- mblogit(Sat ~ Infl + Type + Cont, weights = Freq,
data = housing, from.table=TRUE,
dispersion="Afroz")
Iteration 1 - Deviance = 38.84842
Iteration 2 - Deviance = 38.66222
Iteration 3 - Deviance = 38.6622
Iteration 4 - Deviance = 38.6622
converged
# Now the estimated dispersion parameter is no longer larger than 20,
# but just bit over 1.0.
summary(house.mblogit.corrected)
Call:
mblogit(formula = Sat ~ Infl + Type + Cont, data = housing, weights = Freq,
dispersion = "Afroz", from.table = TRUE)
Equation for Medium vs Low:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.4192 0.1832 -2.289 0.02842 *
InflMedium 0.4464 0.1499 2.977 0.00533 **
InflHigh 0.6649 0.1974 3.369 0.00189 **
TypeApartment -0.4357 0.1827 -2.384 0.02284 *
TypeAtrium 0.1314 0.2363 0.556 0.58189
TypeTerrace -0.6666 0.2184 -3.051 0.00440 **
ContHigh 0.3609 0.1402 2.573 0.01461 *
Equation for High vs Low:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1387 0.1686 -0.823 0.416418
InflMedium 0.7349 0.1450 5.067 1.41e-05 ***
InflHigh 1.6126 0.1770 9.110 1.20e-10 ***
TypeApartment -0.7356 0.1645 -4.473 8.19e-05 ***
TypeAtrium -0.4080 0.2240 -1.821 0.077370 .
TypeTerrace -1.4123 0.2120 -6.662 1.20e-07 ***
ContHigh 0.4818 0.1315 3.665 0.000837 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Dispersion: 1.121765 on 34 degrees of freedom
Null Deviance: 262.1
Residual Deviance: 38.66
Number of Fisher Scoring iterations: 4
Number of observations: 1681