[R] glm(y ~ -1 + c, "binomial") question

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu May 16 21:27:14 CEST 2002


On Thu, 16 May 2002, Yuelin Li wrote:

> This is a question about removing the intercept in a binomial
> glm() model with categorical predictors.  V&R (3rd Ed. Ch7) and
> Chambers & Hastie (1993) were very helpful but I wasn't sure I
> got all the answers.
>
> In a simplistic example suppose I want to explore how disability
> (3 levels, profound, severe, and mild) affects the dichotomized
> outcome.  The glm1 model (see below) is the same as glm2 (2 dummy
> variables coding sever and mild).  In both models the reference
> level is profound disability.
>
> My questions are:
>
> 1. How do I interpret the coefficients in the third model (the
> intercept is removed)?
>
> 2. Does glm3 make sense?  Does anyone ever want to construct a
> model like glm3?  If so, when?

When you don't want to do any comparisons between groups.

> 3. What is the algebraic specification of glm3?

Separate means for each group.  \mu_ = \mu_[i],
Y_i ~ binomial(\mu_i/n_i, n_i)  where [i] denotes the group of
observation i.

>
> Many thanks,
>
> -- Yuelin Li.
>
> -------------------
>
> categ <- factor(rep(c(1, 2, 3), times=c(20, 20, 20)),
>                 labels=c("P", "S", "M"))
> Y <- c(1,1,1,1,1,1,2,1,2,1,2,1,1,1,1,1,1,2,2,
>        1,2,2,1,2,2,1,2,1,2,1,1,2,2,2,2,2,2,2,2,1,
>        2,2,2,2,2,1,2,1,1,1,2,2,2,2,1,2,1,1,1,2)
> Y <- Y == 2
>
> glm1 <- glm(Y ~ categ, family="binomial")
> glm2 <- glm(Y ~ c(categ == "S") + c(categ == "M"), "binomial")
> glm3 <- glm(Y ~ -1 + categ, "binomial")
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list