[R] logit GLM without intercept

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Apr 22 18:16:32 CEST 2008


On Tue, 2008-04-22 at 17:04 +0200, gorgasal at gmx.de wrote:
> Hi Robert,
> 
> you can exclude the intercept by including "-1" in the formula:
> 
> value <- as.numeric(runif(20)<.4)
> ppm <- rnorm(20)
> glm(value~ppm-1,family=binomial)

Note that 0+ppm is the same thing, try it:

glm(value ~ 0 + ppm, family=binomial)

Your approach and that of Robert's are two ways to skin that particular
cat.

G

> 
> HTH
> Stephan
> 
> 
> > Dear Statisticians,
> > 
> > I would like to analyse my data with a GLM with binomial error distribution
> > and logit link function. The point is that I want a model fitted without
> > intercept, i.e. the fitted curve should start at y=0.5 for x=0. 
> > 
> > I tried it with the following code: 
> > 
> > glm(value~0+ppm, binomial)
> > 
> > Does this code yield the correct model or is there another possibility? I?d
> > appreciate it very much if you could help me out with this. I attached some
> > example data.
> > 
> > Thanks & all the best
> > 
> >    Robert
> 
> --
> 
> ______________________________________________
> 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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list