Skip to content

Getting vastly different results when running GLMs

3 messages · Luke Duncan, Mark Difford, Michael Dewey

#
On Aug 17, 2011; 5:43pm Luke Duncan wrote:
Hi Luke,

The differences you are seeing are almost certainly due to different
contrast codings: Statistica probably uses sum-to-zero contrasts whereas R
uses treatment (Dunnett) contrasts by default. You would be well advised to
consult a local statistician for a deeper understanding.

For some immediate insight do the following:

## Fits your model with different contrasts + a few other things.
##
library(car)
?contrast
?contr.treatment
model1 <- glm((cbind(spec,total)) ~ behav * loc, family=binomial,
data=behdata, contrasts=list(behav="contr.treatment",
loc="contr.treatment"))
model2 <- glm((cbind(spec,total)) ~ behav * loc, family=binomial,
data=behdata, contrasts=list(behav="contr.sum", loc="contr.sum"))

summary(model1)
summary(model2)
anova(model1, model2)      ## see: models seem different but are identical

## Type I SS
anova(model1)
anova(model2)

## Type II SS
library(car)
Anova(model1, type="II")
Anova(model2, type="II")

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/Getting-vastly-different-results-when-running-GLMs-tp3750496p3751115.html
Sent from the R help mailing list archive at Nabble.com.
#
At 16:43 17/08/2011, Luke Duncan wrote:
Response in line below
If you have extracted your variables from the data.frame you do not 
need the data=
Why did it delete 19 observations?
In general if you have an interaction you need to be cautious about 
making statement about the underlying main effects. You have found 
that the effect of sun differs for different behaviours so making an 
overall statement about sun may be problematic.
Michael Dewey
info at aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html