[R] Expressing a multinomial GLM as a series of binomial GLMs

Charles Berry ccberry at ucsd.edu
Wed Jul 23 06:43:15 CEST 2014


Charles Berry <ccberry <at> ucsd.edu> writes:

> 
> Scherber, Christoph <cscherb1 <at> gwdg.de> writes:
> 
> > 
> > Dear all,
> > 
> > I am trying to express a multinomial GLM (using nnet) as a series of GLM
> models.

[deleted]

> 
> Doing the obvious comparison:
> 
> ggen.preds <- 
>     sapply( levels(multicats), 
>             function(x) predict(glm(I(multicats==x)~multiplan1,
>                          family=binomial),type="response"))
> 
> max(abs(ggen.preds-predict(m2,type="probs")))
> ## [1] 1.349607e-06

 
> The predictions are the same - up to numerical issues in the algorithms.
> 

But as John Fox points out this does not hold for the general case.

It worked here because the regressor has two categories.

HTH,

Chuck



More information about the R-help mailing list