[R] glm fit with no intercept
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Fri Jan 7 17:14:29 CET 2005
"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.
--
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
More information about the R-help
mailing list