# NOT RUN { require(stats) model1 <- glm(case ~ spontaneous+induced, data = infert, family = binomial()) summary(model1) ## adjusted for other potential confounders: summary(model2 <- glm(case ~ age+parity+education+spontaneous+induced, data = infert, family = binomial())) ## Really should be analysed by conditional logistic regression ## which is in the survival package # } # NOT RUN { if(require(survival)){ model3 <- clogit(case ~ spontaneous+induced+strata(stratum), data = infert) print(summary(model3)) detach() # survival (conflicts) } # }
Run the code above in your browser using DataCamp Workspace