[R] glm fit with no intercept
Göran Broström
gb at tal.stat.umu.se
Fri Jan 7 23:47:16 CET 2005
On Fri, Jan 07, 2005 at 05:14:29PM +0100, Peter Dalgaard wrote:
> "Gudrun Jonasdottir" <gudrunj at math.su.se> writes:
>
> > Dear R-help list members,
> >
> > 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
> > 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?
>
> Use -1 in the model formula.
>
> x <- sample(0:1,10,rep=T)
> d <- runif(10)
> summary(glm(x~d-1,family=binomial))
>
> > "När inget annat hjälper, läs instruktionsboken."
> > - Canns axiom
>
> .. i närvarande fall: "An Introduction to R", Ch.11.
.. i föreliggande fall: (or, .. i detta fall:) is better Swedish.
But maybe it was Danish:-). Anyway, I agree.
HTH, Göran
>
> --
> O__ ---- Peter Dalgaard Blegdamsvej 3
> c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
> (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Göran Broström tel: +46 90 786 5223
Department of Statistics fax: +46 90 786 6614
Umeå University http://www.stat.umu.se/egna/gb/
SE-90187 Umeå, Sweden e-mail: gb at stat.umu.se
More information about the R-help
mailing list