[R] Estimate of intercept in loglinear model
Mark Difford
mark_difford at yahoo.co.uk
Mon Nov 7 20:04:02 CET 2011
On Nov 07, 2011 at 7:59pm Colin Aitken wrote:
> How does R estimate the intercept term \alpha in a loglinear
> model with Poisson model and log link for a contingency table of counts?
Colin,
If you fitted this using a GLM then the default in R is to use so-called
treatment contrasts (i.e. Dunnett contrasts). See ?contr.treatment. Take the
first example on the ?glm help page
## 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())
anova(glm.D93)
summary(glm.D93)
< snip >
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 1.338e-15 2.000e-01 0.000 1.0000
treatment3 1.421e-15 2.000e-01 0.000 1.0000
< snip >
> levels(outcome)
[1] "1" "2" "3"
> levels(treatment)
[1] "1" "2" "3"
So here the intercept represents the estimated counts at the first level of
"outcome" (i.e. outcome = 1) and the first level of "treatment" (i.e.
treatment = 1).
> predict(glm.D93, newdata=data.frame(outcome="1", treatment="1"))
1
3.044522
Regards, Mark.
-----
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
--
View this message in context: http://r.789695.n4.nabble.com/Estimate-of-intercept-in-loglinear-model-tp4009905p4012346.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list