counts<-c(50,315,24,4012,9,40,6,459,41,147,14,1594,4,11,1,124)
age<-  factor(rep(c("Y","O"),c(8,8)))
smoke<-factor(rep(c("N","S","N","S"),rep(4,4)))
term<-factor(rep(c("P","F","P","F","P","F","P","F"),rep(2,8)))
status<-factor(rep(c("D","A"),8))

smoke.fit<-glm(counts~age+smoke+term+status,family=poisson)
summary(smoke.fit)

smoke.steps<-step(smoke.fit,scope=~(age+smoke+term+status)^4)


smoke.fit2<-glm(counts~age+smoke+term+status+age:smoke+age:term +age:status+smoke:status+term:status,family=poisson)
smoke.fit3<-glm(counts~age+smoke+term+status+age:smoke+age:status+smoke:status+term:status,family=poisson)
smoke.fit4
anova(smoke.fit2,smoke.fit3,test="Chi")

cbind(age,smoke,term,status,counts)
