Skip to content

type III effect from glm()

2 messages · Mark Leeds, John Fox

#
Hi Simon: In below , test1 spelled out is count ~ siteall + yrs + 
district + yrs:district so this is fine.

but in test2 , you have years interacting with district but not the main 
effect for years. this is against the rules of marginality so I still 
think there's a problem. I would wait for John or the other wizaRds to 
respond ( you know who you are )  because I don't feel particularly 
confident giving advice on this because I bang my head against it often 
also. Plus, I gotta go home because it's getting light out soon ( i'm in 
the US on the east coast ). Good luck.
On Thu, Feb 19, 2009 at 6:10 AM, Simon Pickett wrote:

            
#
Dear Mark and Simon,

I assume from the variable names that siteall and district are factors and
that yrs is numeric. If that's the case, then the second model formula, ~
siteall + district + yrs:district, nests yrs within district, that is, will
fit a separate slope for years within each level of district -- what you'd
get by ~ siteall + district/years or ~ siteall + district + yrs %in%
district. This model is equivalent to ~ siteall + yrs*district, although
it's parametrized differently. To see what's happening, check
model.matrix(test1) and model.matrix(test2).

More generally, R avoids violating marginality. If you want "type-III"
tests, you could use the Anova() function in the car package, but if I
properly interpreted the meaning of the predictors, the "type-III" test for
the "main effect" of yrs is simply the test that the slope for yrs is 0 in
the first (reference) category of district, assuming that you're using the
default dummy-coded (contr.treatment) contrasts -- not generally a
particularly interesting hypothesis.

Regards,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox
On
glm(count~siteall+yrs*district,family=quasipoisson,weights=weight,data=m[x[[
i
glm(count~siteall+district+yrs:district,family=quasipoisson,weights=weight,d
a
glm(count~siteall+yrs+yrs:district,family=quasipoisson,weights=weight,data=m
[
glm(count~siteall+yrs:district,family=quasipoisson,weights=weight,data=m[x[[
i
http://www.R-project.org/posting-guide.html