In a crossover trial comparing a new drug to a standard, \(\pi\) denotes the probability that the new one is judged better. It is desired to estimate \(\pi\) and test \(H_0: \pi = 0.5\) against \(H_a: \pi \neq 0.5\). In 20 independent observations, the new drug is better each time.
Find and sketch the likelihood function. Give the ML estimate of \(\pi\).
Conduct a Wald test and construct a 95% Wald confidence interval for \(\pi\). Are these sensible?
Conduct a score test and report the corresponding p-value. Construct a 95% score confidence interval. Interpret.
Conduct a likelihood-ratio test and construct a likelihood-based 95% confidence interval. Interpret.
Construct an exact binomial test and 95% confidence interval. Interpret.
Suppose that researchers wanted a sufficiently large sample to estimate with 95% confidence the probability of preferring the new drug within a margin of 0.05? If the true probability is 0.90, how large should the sample be?
n=20
L = function(pi_,x){
term = (pi_^x)*((1-pi_)^(1-x))
return(prod(term))
}
x=rep(1,n)
pi_ = seq(0,1,by=0.001)
L_values = sapply(pi_,L,x=x)
plot(pi_, L_values,type='l',
ylab = 'Likelihood',xlab = expression(pi),
main='Likelihood values for different values of pi')
Consider testing \(H0:\pi = \pi_0\) for a binomial proportion. \(n=20\), \(\pi_0=0.5,\hat \pi = 1\).
Wald test \[ \frac{\hat \pi - \pi_0}{\sqrt{\hat\pi(1-\hat\pi)}/n}\sim N(0,1) \] Inverting the Wald test gives the Wald interval \[ \hat \pi\pm Z_{1-\alpha/2}\sqrt{\hat \pi(1-\hat \pi)/n} \]
Construct an exact binomial test and 95% confidence interval. Interpret.
Let \(X_i\) be that random variable that maps success to 1 and failure to 0, for $i=1,2,,n. Then \(X_i\) has a Bernoulli distribution. Let \(Y=\sum_{i=1}^{n}X_i\) be the number of success after \(n=20\) trials, then \[ P(Y\geq c) =\sum_{y=c}^{20} {20 \choose c}\pi^y(1-\pi)^{20-y} \] Under the null
\[ P(Y\geq c) =\sum_{y=c}^{20} {n \choose c}\pi_0^y(1-\pi_0)^{20-y} \] What is the probability, under the null of getting evidence as extreme or more extreme than we obtained?
\[ P(Y\geq 20) =\sum_{y=20}^{20} {n \choose 20}\pi_0^y(1-\pi_0)^{20-y} = \pi_0^{20} \]
Let \(\pi\) denote the probability of failing for this homework. An experiment tests \(H_0:\pi = 0.5\) against \(H_a: π 6= 0.5\) using \(n = 5\) independent students. Show that the true null probability of rejecting \(H_0\) at the 0.05 significance level is zero for the exact binomial test and \(1/16\) using the large-sample score test. You can either choose to show this theoretically/exactly (you can of course