Skip to content
Back to formatted view

Raw Message

Message-ID: <1313612615104-3751115.post@n4.nabble.com>
Date: 2011-08-17T20:23:35Z
From: Mark Difford
Subject: Getting vastly different results when running GLMs
In-Reply-To: <CAE9UE+--OdEWO=ArnwgEx9nrQ4gP_OoKNa6m2emopFwpEhMgLg@mail.gmail.com>

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.