Re: [R] choose the intercept from glm and lm

From: Chuck Cleland <ccleland_at_optonline.net>
Date: Tue, 08 Jan 2008 14:55:03 -0500

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

______________________________________________
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.
Received on Tue 08 Jan 2008 - 20:00:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Jan 2008 - 10:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive