Example: Approximate test
- We consider a study from Florida Poll 2006:
- In connection with problems financing public service a random sample of 1200 individuals were asked whether they preferred less service or tax increases.
- 52% preferred tax increases. Is this enough to say that the proportion is significantly different from fifty-fifty?
- Sample with \(n = 1200\) observations and estimated proportion \(\hat{\pi} = 0.52\).
- Null hypothesis \(H_0: \pi = 0.5\).
- Alternative hypothesis \(H_a: \pi\neq 0.5\).
- Standard error \(se_0 = \sqrt{\frac{\pi_0(1-\pi_0)}{n}} = \sqrt{\frac{0.5\times0.5}{1200}} = 0.0144\)
- Observed test statistic \(z_{obs} = \frac{\hat{\pi}-\pi_0}{se_0}=\frac{0.52-0.5}{0.0144}=1.39\)
- “upper tail probability for 1.39” in the standard normal distribution is 0.0823, i.e. we have a \(p\)-value of 2\(\cdot\) 0.0823\(\approx\) 16%.
- Conclusion: There is not sufficient evidence to reject \(H_0\), i.e. we do not reject that the preference in the population is fifty-fifty.
- Note, the above calculations can also be performed automatically in R by (a little different results due to rounding errors in the manual calculation):
count <- 1200 * 0.52 # number of individuals preferring tax increase
prop.test(x = count, n = 1200, correct = F)
##
## 1-sample proportions test without continuity correction
##
## data: count out of 1200
## X-squared = 1.92, df = 1, p-value = 0.1659
## alternative hypothesis: true p is not equal to 0.5
## 95 percent confidence interval:
## 0.4917142 0.5481581
## sample estimates:
## p
## 0.52
Binomial test in R
- We return to the Chile data, where we again look at the variable
sex
.
- Let us test whether the proportion of females is different from 50 %, i.e., we look at \(H_0:\ \pi=0.5\) and \(H_a:\ \pi \neq 0.5\), where \(\pi\) is the unknown population proportion of females.
Chile <- read.delim("https://asta.math.aau.dk/datasets?file=Chile.txt")
binom.test( ~ sex, data = Chile, p = 0.5, conf.level = 0.95)
##
##
##
## data: Chile$sex [with success = F]
## number of successes = 1379, number of trials = 2700, p-value =
## 0.2727
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
## 0.4916971 0.5297610
## sample estimates:
## probability of success
## 0.5107407
- The \(p\)-value for the binomial exact test is \(27\%\), so there is no significant difference between the proportion of males and females.
- The approximate test has a \(p\)-value of \(26\%\), which can be calculated by the command
prop.test( ~ sex, data = Chile, p = 0.5, conf.level = 0.95, correct = FALSE)
(note the additional argument correct = FALSE
).