[R] glm fit with no intercept

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Fri Jan 7 17:05:26 CET 2005


Hi Gudrun,

try the following:

y <- rbinom(100, 1, 0.5)
x <- rnorm(100)
##############
glm(y~x, family=binomial)
glm(y~x-1, family=binomial)

I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Gudrun Jonasdottir" <gudrunj at math.su.se>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, January 07, 2005 3:40 PM
Subject: [R] glm fit with no intercept


> 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?
>
> Regards,
> Gudrun
>
> -- 
> Gudrun Jonasdottir, M.Sc.
> Matematiska institutionen
> Stockholms Universitet
> SE- 106 91 Stockholm
>
> Work: +46 (0)8 16 45 56
> Mobile: +46 (0)709 779 800
> --------------------------------------------
> "När inget annat hjälper, läs instruktionsboken."
> - Canns axiom
>
> ______________________________________________
> 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
>




More information about the R-help mailing list