[R] multinom() residual deviance
Bill.Venables at csiro.au
Bill.Venables at csiro.au
Sat Apr 9 05:43:48 CEST 2011
The two models you fit are quite different. The first is a binomial model equivalent to
fm <- glm(I(y == "a") ~ x, binomial, df)
which you can check leads to the same result. I.e. this model amalgamates classes "b" and "c" into one.
The second is a multivariate logistic model that considers all three classes defined by your factor y, (and has twice the number of parameters, among other things). The three clases, "a", "b" and "c" remain separate in the model.
Hence the two models are not directly comparable, so why should the deviance be?
Bill Venables.
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Sascha Vieweg [saschaview at gmail.com]
Sent: 09 April 2011 01:14
To: r-help at r-project.org
Subject: [R] multinom() residual deviance
Running a binary logit model on the data
df <- data.frame(y=sample(letters[1:3], 100, repl=T),
x=rnorm(100))
reveals some residual deviance:
summary(glm(y ~ ., data=df, family=binomial("logit")))
However, running a multinomial model on that data (multinom, nnet)
reveals a residual deviance:
summary(multinom(y ~ ., data=df))
On page 203, the MASS book says that "here the deviance is
comparing with the model that correctly predicts each person, not
the multinomial response for each cell of the mininal model",
followed by and instruction how to compare with the saturated
model.
For me as a beginner, this sounds like an important warning,
however, I don't know what the warning exactly means and hence do
not know what the difference between the residual deviance of the
former (binary) and the latter (multinomial) model is.
(I need the deviances to calculate some of the pseudo R-squares
with function pR2(), package "pscl".)
Could you give good advice?
Thanks
*S*
--
Sascha Vieweg, saschaview at gmail.com
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list