[R] Regression on stratified count data
peter dalgaard
pdalgd at gmail.com
Wed Apr 24 08:30:32 CEST 2013
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.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list