On Apr 24, 2013, at 06:15 , meng wrote: > Hi all: > For stratified count data,how to perform regression analysis? > > My data: > age case oc count > 1 1 1 21 > 1 1 2 26 > 1 2 1 17 > 1 2 2 59 > 2 1 1 18 > 2 1 2 88 > 2 2 1 7 > 2 2 2 95 > > age: > 1:<40y > 2:>40y > > case: > 1:patient > 2:health > > oc: > 1:use drug > 2:not use drug > > My purpose: > Anaysis whether case and oc are correlated, and age is a stratified variable. > > My solution: > 1,Mantel-Haenszel test by using function "mantelhaen.test" > 2,loglinear regression by using function > glm(count~case*oc,family=poisson).But I don't know how to handle variable > "age",which is the stratified variable.
The canonical way is to fit the model without 2nd order interaction: count~case*oc*age-case:oc:case . (It may take the back of an envelope or two to realize that this is equivalent to the common OR assumption of the MH test.) Alternatively, use logistic regression glm(case ~ oc + age, family=binomial, weight=count, data=dd) (NB: it is important that case is a factor here!) -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.