[R] Getting vastly different results when running GLMs
Mark Difford
mark_difford at yahoo.co.uk
Wed Aug 17 22:23:35 CEST 2011
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.
More information about the R-help
mailing list