#Analysis of Gregoriou et al data #Gregoriou, O, Vitoratos, N, Papadias, C, Konidaris, S, Gargaropoulos, A, Rizos, D. #Pregnancy rates in gonadotrophin stimulated cycles with timed intercourse or intrauterine insemination #for the treatment of male subfertility, Eur J Obstet Gynecol Reprod Biol 1996; 64: 213-216. #Load lme4 library library(lme4) #Remember to define filepath as required #Read data #NB 'period' is the period in which treatment was given greg <- read.table("C:\\Documents and Settings\\Stephen\\Web\\InfCros\\Greg.txt", header=T) greg #Print data #Proceed to fit various models fit1 <- lmer(response~(1|patient),family=binomial,data=greg)#null model fit2 <- lmer(response~treat+(1|patient),family=binomial,data=greg)#treatment only fit3 <- lmer(response~period+(1|patient),family=binomial,data=greg)#period only fit4 <- lmer(response~treat+period+(1|patient),family=binomial,data=greg)#full model summary(fit2)#Summary of model with treatment only summary(fit4)#Summary of model with treatment and period #carry out analysis of deviance to check effect of adding treatment to model with period anova(fit3,fit4)