Homework for Lecture 04

Problems from text: 1.5

Additional problem: A sample of 100 women who suffer from dysmenorrhea participated in a study. A new analgesic is claimed to provide greater relief than a standard one. After using each analgesic in a crossover experiment, 40 of the participants reported greater relief with the standard analgesic and 60 reported greater relief with the new analgesic. Analyze these data.

Question 1.5

When the 2010 General Social Survey asked, “Please tell me whether or not you think it should be possible for a pregnant woman to obtain a legal abortion if she is married and does not want any more children,” 587 replied “yes” and 636 replied “no.” Let \(\pi\) denote the population proportion who would reply “yes.” Find the \(P-value\) for testing \(H_0:\pi=0.50\) using the score test, and construct a 95% confidence interval for \(\pi\). Interpret the results.

The sample population is \(587+636=1223\), which would make \(\hat{\pi}=\frac{587}{1223}=0.479967\approx 0.48\).
So, for score test \(z_s=\frac{\hat{\pi}-\pi_0}{\sqrt{\pi_0(1-\pi_0)/n}}\) is \(z=\frac{(0.48-0.5)}{\sqrt{0.5(0.5)/1223}}=-1.39889\approx -1.399\).
The \(P-value=0.0809\) for \(H_a:\pi \neq 0.5\).
Using a score confidence interval is \[\hat{\pi}(\frac{n}{n+z^2_{a/2}})+\frac{1}{2}(\frac{z^2_{a/2}}{n+z^2_{a/2}})\pm z_{a/2}\sqrt{\frac{1}{n+z^2_{a/2}}[\hat\pi(1-\hat\pi)(\frac{n}{n+z^2_{a/2}})+(\frac{1}{2})(\frac{1}{2})(\frac{z^2_{a/2}}{n+z^2_{a/2}})]}\] Using the Binom R package, the command for binom.wilson will provide the calculation for the confidence interval. Since this interval was first discussed by E.B. Wilson per Argesti in Categorical Data Analysis.

require(binom)
## Loading required package: binom
binom.wilson(587,1223,conf.level = 0.95)
##   method   x    n      mean     lower     upper
## 1 wilson 587 1223 0.4799673 0.4520739 0.5079861

The score confidence interval is \((0.45207,0.50798)\approx(0.452,0.508)\). Which by this method we cannot reject \(H_0:\pi=0.5\) in favor of \(H_a\), since \(H_0\) is in the confidence interval \((0.452,0.508)\).

Additional Problem

A sample of 100 women who suffer from dysmenorrhea participated in a study. A new analgesic is claimed to provide greater relief than a standard one. After using each analgesic in a crossover experiment, 40 of the participants reported greater relief with the standard analgesic and 60 reported greater relief with the new analgesic. Analyze these data.

The distribution is binomial \(P(y)=\binom{n}{y}\pi^y(1-\pi)^{n-y}\). The null hypothesis \(H_0:\pi=0.5\) and the alternative hypothesis \(H_a:\pi \neq 0.5\). In this hypothesis test we will use the score test do to the small sample size the Wald test may not be sufficient. In addition we will be testing at a 5% level.
So, \(\hat{\pi}=\frac{60}{100}=0.60\), and the score test statitic \(z_s=\frac{\hat{\pi}-\pi_0}{\sqrt{\pi_0(1-\pi_0)/n}}\) is \(z=\frac{(0.6-0.5)}{\sqrt{0.5(0.5)/100}}=2\). The \(P-value=\) 0.0227501 \(\approx 0.0228\). Using the score confidence interval \[\hat{\pi}(\frac{n}{n+z^2_{a/2}})+\frac{1}{2}(\frac{z^2_{a/2}}{n+z^2_{a/2}})\pm z_{a/2}\sqrt{\frac{1}{n+z^2_{a/2}}[\hat\pi(1-\hat\pi)(\frac{n}{n+z^2_{a/2}})+(\frac{1}{2})(\frac{1}{2})(\frac{z^2_{a/2}}{n+z^2_{a/2}})]}\] As before I will be using the binom.wilson method to calculate the confidence interval.

binom.wilson(60,100,conf.level = 0.95)
##   method  x   n mean     lower     upper
## 1 wilson 60 100  0.6 0.5020026 0.6905987

The score confidence interval is \((0.5020026,0.6905987)\approx(0.502,0.691)\). Which by this method we reject \(H_0:\pi=0.5\) at a 5% significance level in favor of \(H_a\). Since \(H_0\) is not in the confidence interval \((0.452,0.508)\). So, the new analgesic by this hypothesis test provided greater relief that the standard.