Assignment 4
You will be asked to hand this assignment in at the beginning of class on Tuesday Feb. 10th.
As I expected, many sets of relative sample sizes are optimal. That is, they all yield the same power, and it will be the highest possible power for this effect, given any total sample size.
What on earth do I mean by "nice" relative sample sizes? Well, started by trying a set of relative sample sizes that are unequal, but still proportional. My final answer was not quite proportional.
There are several good ways to test the equality of two or more proportions. I want you to use logistic regression with dummy variables, fit a full and a reduced model, and test the difference between them with a large-sample likelihood ratio test. Here are the data. Surgical methods are labelled 1, 2 and 3. Success=1 means the operation was a success.
For this question, I got a p-value of 0.005664708. By the way, applying the anova function to just the full model gives you the right chi-square value. It's labelled "Deviance," because -2 times the log likelihood is a sum of terms, each of which is called a "deviance residual." The whole sum is called the "Deviance" of the model. The difference in deviance between the full and reduced models is exactly -2 times the log of the likelihood ratio, which has an approximate chisquare distribution under H0.
If you want, you can fit a reduced model, and do anova (reducedmodel,fullmodel). I got a reduced model with
glm(success~1,family=binomial) # Just the intercept
Please feel free to use any of my S code from lecture. Just copy and paste. Here is a copy.