[R] multinom and contrasts

array chip arrayprofile at yahoo.com
Thu Apr 14 01:25:50 CEST 2005


Hi,

I found that using different contrasts (e.g.
contr.helmert vs. contr.treatment) will generate
different fitted probabilities from multinomial
logistic regression using multinom(); while the fitted
probabilities from binary logistic regression seem to
be the same. Why is that? and for multinomial logisitc
regression, what contrast should be used? I guess it's
helmert?

here is an example script:

library(MASS)
library(nnet)

      #### multinomial logistic
options(contrasts=c('contr.treatment','contr.poly'))
xx<-multinom(Type~Infl+Cont,data=housing[-c(1,10,11,22,25,30),])
yy<-predict(xx,type='probs')
yy[1:10,]

options(contrasts=c('contr.helmert','contr.poly'))
xx<-multinom(Type~Infl+Cont,data=housing[-c(1,10,11,22,25,30),])
zz<-predict(xx,type='probs')
zz[1:10,]


      ##### binary logistic
options(contrasts=c('contr.treatment','contr.poly'))
obj.glm<-glm(Cont~Infl+Type,family='binomial',data=housing[-c(1,10,11,22,25,30),])
yy<-predict(xx,type='response')

options(contrasts=c('contr.helmert','contr.poly'))
obj.glm<-glm(Cont~Infl+Type,family='binomial',data=housing[-c(1,10,11,22,25,30),])
zz<-predict(xx,type='response')

Thanks




More information about the R-help mailing list