M. Drew LaMar
September 16, 2020
Definition:
Type I error is rejecting a true null hypothesis. The probability of a Type I error is given by \[ \mathrm{Pr[Reject} \ H_{0} \ | \ H_{0} \ \mathrm{is \ true}] = \alpha \]
Definition:
Type II error is failing to reject a false null hypothesis. The probability of a Type II error is given by \[ \mathrm{Pr[Do \ not \ reject} \ H_{0} \ | \ H_{0} \ \mathrm{is \ false}] = \beta \]
Definition: The
power of a statistical test (denoted \( 1-\beta \)) is given by \[ \begin{align*} \mathrm{Pr[Reject} \ H_{0} \ | \ H_{0} \ \mathrm{is \ false}] & = 1-\beta \\ & = 1 - \mathrm{Pr[Type \ II \ error]} \end{align*} \]
Power of a statistical test is a function of
- Significance level \( \alpha \)
- Variability of data
- Sample size
- Effect size
So far, the population parameter of interest was a mean/average.
For means and averages, the random variable of interest was numerical.
In this chapter, the population parameter of interest is a proportion.
For proportions, the random variable of interest is categorical.
More specifically, we are interested in the proportion of times in the population that a particular level of a categorical variable occurs.
Population: All $1 US bills
Variable: Measurable cocaine? (Levels: Yes/No)
Parameter: Proportion of bills with measurable cocaine.
Sample: 50 $1 bills [BTW, in actual study, 46 had measurable cocaine]
Population: All humans who could have been downwind of site of 11 previous aboveground nuclear bomb tests in 1955.
Variable: Developed cancer by 1980s? (Levels: Yes/No)
Parameter: Probability of developing cancer by 1980s.
Sample: 220 actors in film The Conqueror (including John Wayne) who were downwind of … [91 developed cancer by 1980s]
Note: 14% of age group within this time frame should have been stricken with cancer.
Suppose I have a population of size \( N \) and a categorical variable \( Y \) (e.g. \( Y \) could be genotype with levels {aa, Aa, AA}).
For proportions, we really need a categorical variable with only two levels, which would be
For example, with the genotype case, we could be interested in the proportion of heterozygotes in a population, so we would have
Given the categorical variable with levels “Success” and “Failure”, the proportion of successes in the population would be denoted by
\[ p = \frac{\mathrm{Number \ of \ successes \ in \ population}}{\mathrm{Total \ population \ size}} = \frac{X}{N} \]
If we have a sample of size \( n \), then we would have a sample estimate of this proportion \( p \) given by
\[ \hat{p} = \frac{\mathrm{Number \ of \ successes \ in \ sample}}{\mathrm{Total \ sample \ size}} = \frac{\hat{X}}{n} \]
What is the standard error for a proportion (i.e. what is the measure of precision for the sample proportion)?
Definition: The
standard error of a proportion is the standard deviation of the sampling distribution for a proportion and is given by \[ \sigma_{\hat{p}} = \sqrt{\frac{p(1-p)}{n}} \]
Definition: An estimate of the standard error for the proportion is given by \[ \mathrm{SE}_{\hat{p}} = \sqrt{\frac{\hat{p}(1-\hat{p})}{n}} \]
In a study in Scotland (as reported by Devlin 2009), researchers left a total of 240 wallets around Edinburgh, as though the wallets were lost. Each contained contact information including an address. Of the wallets, 101 were returned by the people who found them.
Discuss: What might the population of interest be in this study?
Answer: Possibly the Edinburgh population only (otherwise, possible bias). Could also be all previously (or futurely) dropped wallets.
In a study in Scotland (as reported by Devlin 2009), researchers left a total of 240 wallets around Edinburgh, as though the wallets were lost. Each contained contact information including an address. Of the wallets, 101 were returned by the people who found them.
Discuss: What might be a possible weakness with this study, if they were interested in inferring about “honesty” of the population?
Answer: Possible that one person could have found multiple wallets, which is an independence issue.
In a study in Scotland (as reported by Devlin 2009), researchers left a total of 240 wallets around Edinburgh, as though the wallets were lost. Each contained contact information including an address. Of the wallets, 101 were returned by the people who found them.
Discuss: What is the categorical variable of interest (include levels)?
Answer: Wallet fate (Levels: returned/not returned)
In a study in Scotland (as reported by Devlin 2009), researchers left a total of 240 wallets around Edinburgh, as though the wallets were lost. Each contained contact information including an address. Of the wallets, 101 were returned by the people who found them.
Calculate: Estimate the proportion of returned wallets.
Answer: \( \ \hat{p} = 101/240 \approx 0.42 \)
Calculate: Compute \( \mathrm{SE}_{\hat{p}} \).
Answer: \( \ \mathrm{SE}_{\hat{p}} = \sqrt{\frac{0.42\times(1-0.42)}{240}} \approx 0.032 \)
Is that good?
Two main methods.
Method #1: In the
Wald method , the 95% confidence interval is given by
\[ \hat{p} - 1.96\ \mathrm{SE}_{\hat{p}} < p < \hat{p} + 1.96\ \mathrm{SE}_{\hat{p}} \]
Caution: The Wald method is only accurate when (1) \( n \) is large and (2) population parameter \( p \) is not close to 0 or 1. If these conditions are not met, then the Wald confidence interval will bracket the true population parameter
less than 95% of the time.
Due to this, you should use the Agresti-Coull method.
Method #2: In the
Agresti-Coull method, the 95% confidence interval is given by
\[ \scriptsize p^{\prime} - 1.96\sqrt{\frac{p^{\prime}(1-p^{\prime})}{n+4}} < p < p^{\prime} + 1.96\sqrt{\frac{p^{\prime}(1-p^{\prime})}{n+4}} \] where \[ \scriptsize p^{\prime} = \frac{X+2}{n+4}. \]
Let's use R. Load in the lost wallet data.
walletData <- read.csv("http://whitlockschluter.zoology.ubc.ca/wp-content/data/chapter07/chap07q03LostWallets.csv")
str(walletData)
'data.frame': 240 obs. of 1 variable:
$ return: chr "returned" "returned" "returned" "returned" ...
Only one variable, so let's remove the data frame from the picture:
walletData <- as.factor(walletData$return)
(walletTable <- summary(walletData))
not returned returned
139 101
Okay, well, I guess we already knew this. ¯\(ツ)/¯
Let's compute the standard error for the proportion.
(n <- sum(walletTable)) # Number of trials
[1] 240
(phat <- walletTable["returned"]/n) # Estimate
returned
0.4208333
(phat <- unname(phat)) # Remove confusing name
[1] 0.4208333
Let's compute the standard error for the proportion.
(SE_phat <- sqrt(phat*(1-phat)/n))
[1] 0.03186774
Now 95% confidence interval using Wald method.
lower <- phat - 1.96 * SE_phat
upper <- phat + 1.96 * SE_phat
(wald_CI <- c(lower = lower, upper = upper))
lower upper
0.3583726 0.4832941
Finally, 95% confidence interval using Agresti-Coull (and Wald to compare).
library(binom) # Need binom package
binom.confint(walletTable["returned"], n, method = "ac")
method x n mean lower upper
1 agresti-coull 101 240 0.4208333 0.3600899 0.4840711
wald_CI
lower upper
0.3583726 0.4832941
The
sampling distribution for the sample estimate of the proportion is a“scaled” binomial distribution .
\[ \hat{p} = \frac{\mathrm{Number \ of \ successes \ in \ sample}}{\mathrm{Total \ sample \ size}} = \frac{\hat{X}}{n} \]