Skip to content
Prev 275829 / 398513 Next

Contrasts with an interaction. How does one specify the dummy variables for the interaction

Is there a specific reason why you insist on using the contrast library? If
not:

# Create 2x2 contingency table.
counts=c(50,50,30,70)
row <-    gl(2,2,4)
column <- gl(2,1,4)
mydata <- data.frame(row,column,counts)
print(mydata)

#Create contrasts

row<-factor(row)
column<-factor(column)
contrasts(row)<-contr.treatment(levels(row))
contrasts(column)<-contr.treatment(levels(column))

# Works for Terps

fit.terp<-glm(counts ~ row + column + row*column,
family=poisson(link="log"))
summary(fit.terp)

HTH,

Daniel Malter
University of Maryland, College Park
John Sorkin wrote:
--
View this message in context: http://r.789695.n4.nabble.com/Contrasts-with-an-interaction-How-does-one-specify-the-dummy-variables-for-the-interaction-tp3948792p3949071.html
Sent from the R help mailing list archive at Nabble.com.