[R] glm fit with no intercept

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jan 7 18:26:02 CET 2005


On Fri, 7 Jan 2005, Gudrun Jonasdottir wrote:

> I am currently trying to fit a generalized linear model using a binomial
> with the canonical link. The usual solution is to use the R function glm()
> in the package "stats". However, I run into problem when I want to fit a
> glm without an intercept. It is indicated that the solution is in changing

Where is it so indicated?

> the function glm.fit (also in "stats"), by specifying intercept=FALSE. I
> have not been successful in getting any output though.
>
> Any suggestion on how to fit a glm with no intercept?

>From MASS4:

ldose <- rep(0:5, 2)
numdead <- c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16)
sex <- factor(rep(c("M", "F"), c(6, 6)))
SF <- cbind(numdead, numalive = 20 - numdead)
glm(SF ~ sex+ ldose, family = binomial)
glm(SF ~ sex + ldose - 1, family = binomial) # no intercept
glm(SF ~ ldose - 1, family = binomial) # and not even a factor

Please tell us more of what you have tried.

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list