I’m trying to stratify my glm model by age decades.
My main question is: Instead of doing this subsetting within glm could I just make a new column called BYDECADE
and run the the code as follows?
fit <- glm(COMPLICATION~BYDECADE,
data = data.clean,
family = binomial)
AGE BYDECADE
43 40
45 40
24 20
21 20
23 20
37 30
34 30
36 30
The following works but obviously I don’t capture the decade just everyone above 50
fit <- glm(COMPLICATION~AGE,
data = subset(data.clean, AGE > 50),
family = binomial)
but the following does not work for me and I’m not sure how to go about it.
fit <- glm(COMPLICATION~AGE,
data = subset(data.clean, AGE > 50 & AGE <= 60),
family = binomial)