19. Grad homework one: Binomial proportions and Snow#
Please read the short Lesson from the CDC titled Introduction to Epidemiology here https://archive.cdc.gov/#/details?url=https://www.cdc.gov/csels/dsepd/ss1978/lesson1/section2.html
In this article they discuss the pioneering work of John Snow. In particular, they showcase Snow’s collection of data related to deaths due to cholera stratified by two different water supply companies.
First, Snow collected households supplied by the The Southwark and Vauxhall and Lambeth companies. The Southwark and Vauxhall company supplied 167,654 residents and from July to August 844 of those individuals died due to cholera. The Lambeth company supplied 19,133 individuals and 18 died due to cholera.
Lets look at a common statistical approach to determine if the proportion of deaths due to cholera was different in these districts.
The Bernoulli Distribution or the “this or that” distribution.#
It is often the case that we collect data that can produces one of two categories. For example, (a) we may collect whether or not patients have experienced an adverse clinical event during the course of a clinical trial. (b) Another example is whether a sampled population has , or does not have, private medical insurance. (c) In this study, researchers explored the effectiveness of an infectious disease outbreak protocol by collecting whether hospitalized patients were, or were not, part of an outbreak. A natural way to model “this or that” data is with a Bernoulli distribution.
The Bernoulli distribution assigns probabilities to a random variable whose support contains the values 0 and 1. The Bernoulli distribution has a single parameter, often denoted \(\theta\), that controls how probabilities are assigned to these two values, 0 and 1.
To communicate that a random variable \(Z\) has a Bernoulli distribution with parameter \(\theta\), we write:
The parameter \(\theta\) can take any value in the interval between 0 and 1 inclusive, or \(\theta \in [0,1]\). The allowable values that a parameter can take is called the parameter space. For the Bernoulli, the paramter space for \(\theta\) is the interval \([0,1]\).
The support of \(Z\) is \(\text{supp}(Z) = \{0,1\}\), and the probability mass function for the random variable \(Z\) is:
We can use the probability mass function to compute the expectation:
And we can use the probability mass function to compute the variance:
Example 1: Lets look at what it means to define a Bernoulli distributed random variable. Suppose we =define \(Z \sim \text{Bernoulli(0.45)}\). This implies Then:
The Binomial distribution#
A random variable \(X\) distributed Binomial\((N,\theta)\) has as support \(supp(X) = \{0,1,2,3,4,5,\cdots,N\}\), and the probability mass function is
where \(\binom{N}{x}\) is called a binomial coefficient and is defined as \(\binom{N}{x} = \frac{N!}{x!(N-x)!}\). The binomial coefficient is often read “N choose x” and counts the number of ways one can choose \(x\) items from a set of \(N\) items where the order that the \(x\) items is chosen does not matter. For example, \(\binom{10}{4}\) counts the number of ways to choose 4 items from a set of 10 items where the order we selected each of the four items does not matter.
The expected value and variance of \(X\) are
Given N observations, the binomial distribution assigns probabilities to the number of observations that experience an outcome of interest where we assume that the probability any single observation experiences the event is \(\theta\).
We can use the Binomial distribution to: (1) estimate the proportion of an event within a population, (2) estimate our uncertainty in that estimate using a confidence interval, and (3) build a one sample proportions test to test whether this proportion is unexpectedly different than some other proportion.
Estimating \(p\)#
Given a number of collected observations of \(n\), a reasonable estimator for the proportion is \(\hat{p} = N(1)/n\) where \(N(1)\) represents the number of events of interest.
(1) - Please compute the estimated proportion of Cholera deaths for the Southwark and Vauxhall company and for the Lambeth Company
Confidence interval for \(p\)#
An estimator (like \(\hat{p} = N(1)/n )\) is an excellant point estimate, giving us a sense of the most likely parameter value from our collected observations. But, statistics is all about variability. One approach to characterize the variability in our estimate of the true proportion of cholera deaths (per company) is to form a confidence interval.
A \(1-\alpha\) confidence interval is a pair of statistics \([L(X), U(X)]\) such that the probability that the true parameter we are estimating would be found inside \(L(X)\) and \(U(X)\) equals \(1-\alpha\). In other words, \(P( p \in [L(X),U(X)] ) = 1-\alpha\).
Well how the heck do we compute a confidence interval for our above proportion? First we need the notion of a sample
Imagine that Snow collected his data like this
Household |
Death |
|---|---|
1 |
0 |
2 |
1 |
3 |
0 |
4 |
1 |
5 |
0 |
where the value one in the death column means there was a death due to cholera in the household and the value zero means no death due to cholera. We know then that the value one occurs with some probability \(p\) and so then the value zero occurs with probabilty \(1-p\). In other words, we could represent every single household with a random variable \(X_{i} \sim \text{Bernoulli}(p)\). A sample is a collection of random variables that are meant to represent the possible values you could collect from your dataset.
In Snow’s case, the sample for the is \((X_{1}, X_{2}, \cdots, X_{167,654})\) where \(X_{i} \sim \text{Bernoulli}(p)\) every household is assumed to have the same true \(p\) that a death due to cholera occurs.
Then our estimator for the proportion dead due to cholera can be more formally written as
Please note: The above capital “X”s are random variables with their own probability distribution. If each X has its own probability distribution then certainly the sum has a probabiltiy distribution and most certainly the sum divided by a constant has a probability distribution. We need to find a value \(L\) and a value \(U\) such that the probability that \(p\) is between \(L\) and \(U\) equals \(1-\alpha\). To make this concrete for your homework, lets search for a 95% confidence interval (\(\alpha\)=0.05).
Approach one: Binomial. Statistical fact to know
(2) Please write down the probability distribution for the number of deaths due to cholera for the Southwark and Vauxhall company.
(3) Given (2), please use any computational software, including the internet, to find the number of deaths, \(u\), such that the probability of u or less equals a probability of 0.975. Please also find the value \(l\) such that the probability of \(l\) or more deaths equals \(0.025\).
(4) Please divide \(u\) and \(l\) by the total number of households considered in Snow’s study for the Southwark and Vauxhall company. This interval is one way to compute a 95% confidence interval for the proportion \(\hat{p}\). Importantly, the variability doesnt come from \(p\), thats an exact value. Instead, the probability come from the \(\hat{p}\), an estimate of the true probability \(p\) that we obtain from a finite sample.
One sample proportion test#
Now that we have a good estimate of the proportion who died of cholera, and we also quantified the uncertaintiy in our estimate proportion dead, lets finally test this proportion against an alternative using the one sample proportion test.
The hypothesis statement for the two-sided, one sample binomial test is
for some value, \(p_{0}\), that the researcher selects to compare against. The idea of null hypothesis signficiance testing is to build a probability density for the null hypothesis over the possible samples that we could observe.
If we have a null hypothesis then we can compute the probability that we would observe the sample that we collected given the null hypothesis was true. In other words, the null hypothesis has to assign a probability to every possible sample that we could have collected. Then we figure out how unusual (or not) our collected sample was. The probability is on the SAMPLE (in this case the households that Snow sampled) not on the parameter.
With the distribution over possible samples given the null hypothesis is true, if the probability of observing our sample is tiny then we can conclude it probably isnt related to our null hypothesis. Or, at least its pretty unlikey.
Ok….but how to do you figure out the distribution over all the possible samples that you could’ve collected for our null hypothesis??
Luckily for us, from the \(N\) households that Snow sampled, they either had a cholera death (a value of one) or did not (a value of zero).
Let \(X\) represent the possible number of cholera deaths. Then the probability assigned to \(x\) deaths out of the total \(N\) households follows a Binomial distribution,
Even better, this means that the probability of observing a sample (a number of ones and zeros) is a Binomial distribution with \(p=p_{0}\) or
Then we can compute the probability that our observed number of cholera deaths (x=844) out of a total of (N= 167,654) households is unusal given a null probability of \(p_{0}\).
(5) Let \(p_{0}\) equal 0.1 then is our observed sample unusal or not?