Test of proportions on same group versus independent group What statistical test do I apply in following 2 situations:
Two drugs are tested on 2 groups of subjects.
Outcome variable is binary (improvement): No or Yes

Study 1: Subjects for 2 drug groups are different (parallel study design)
Study 2: Same set of subjects take 2 drugs one by one (crossover design)

Aim is to determine if one drug causes more improvements than other.
For continuous outcome variable one would have used unpaired or paired Student's t-test.
This seems to be a test of proportions. For study 1, I think Chi-square test can be used.
Which test do I apply for each study? Thanks for your help.
 A: There are multiple options. One way would be to use a Chi-square test for the first case and a McNemar test for the second case. Note that the Chi-square test hypotheses is based on the difference of frequencies between the groups. Another option would be to use a logistic regression model for the first case with an additional random effect on the subjects for the second case.
You may want to choose a logistic regression model (over a Chi-square test) because the  it is much more flexible, allowing for a lot more to be tested and included in the model, compared to a Chi-square test which is very... non-flexible. Having said that, if you are only interested in frequencies you might want to use a Chi-square as it might have higher power (to detect a significant effect). The Chi-square test is based on the $\chi^2$ distribution while the logistic regression model is based on the binomial distribution, this might be another factor in choosing a model/test.
Below are the results of a simulation for a simple example of two groups done in R, the second group is different from the first so we expect a significant result. The lines represent the average p-value for the studied effect for different sample sizes. Note that the Chi-square test has lower p-values than the regression model, so it is able to detect differences more frequently.
rez=c()
set.seed(69)
for (i in seq(10,100,2)) {
  tmp=replicate(500,{
    df=data.frame(
      "Group"=c(rep("A",i/2),rep("B",i/2)),
      "Improv"=c(sample(0:1,i/2,replace=T),
                 sample(0:1,i/2,prob=c(0.1,0.9),replace=T))
    )
    tryCatch({
      c(summary(glm(Improv~Group,data=df,family=binomial))$coef[2,"Pr(>|z|)"],
        chisq.test(df$Group,df$Improv)$p.value)
    },error=function(cond){
      c(NA,NA)
    })
  })
  rez=rbind(
    rez,
    c(rowMeans(tmp,na.rm=T),
      as.numeric(apply(tmp,1,quantile,c(0.025,0.975),na.rm=T)))
  )
}


