[R] choose the intercept from glm and lm

Chuck Cleland ccleland at optonline.net
Tue Jan 8 20:55:03 CET 2008


On 1/8/2008 2:48 PM, Knut Krueger wrote:
> Hi to all,
> Is there a possibility to choose which value is used for the intercept 
> or does in not make any sense?
> f.e I would like to use outcome2 for the intercept
> 
> ## Dobson (1990) Page 93: Randomized Controlled Trial :
> counts <- c(18,17,15,20,10,20,25,13,12)
> outcome <- gl(3,1,9)
> treatment <- gl(3,3)
> print(d.AD <- data.frame(treatment, outcome, counts))
> glm.D93 <- glm(counts ~ outcome + treatment, family=poisson())
> summary(glm.D93
> 
> 
> Coefficients:
>               Estimate Std. Error  z value Pr(>|z|)    
> (Intercept)  3.045e+00  1.709e-01   17.815   <2e-16 ***
> outcome2    -4.543e-01  2.022e-01   -2.247   0.0246 *  
> outcome3    -2.930e-01  1.927e-01   -1.520   0.1285    
> treatment2   8.717e-16  2.000e-01 4.36e-15   1.0000    
> treatment3   4.557e-16  2.000e-01 2.28e-15   1.0000
> 
> 
> Regards Knut

   Here is one way:

outcome <- relevel(outcome, ref="2")

?relevel

> ______________________________________________
> 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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list