We will review that and see what to do if we have more than one variable.
Types of Inference
We covered two inference methods:
Confidence Intervals
The only information we have is a sample.
We obtain the bootstrap distribution from the sample.
We ask which values of the population parameter are consistent with the bootstrap distribution.
Hypothesis Testing
We have a sample and a null model
We obtain the null distribution from the model.
We ask if the sample is consistent with the null distribution.
Obtaining Distributions …
Ways to obtain the bootstrap distribution:
Resampling
Sample from the data with replacement.
Calculate the sample statistic.
Repeat many times
Using a mathematical model
Central Limit Theorem
Obtaining Distributions
Ways to obtain the null distribution:
Simulation
Simulate the sampling process under the assumption of the null model.
Calculate the sample statistic.
Repeat many times
Using a mathematical model
Central Limit Theorem
Assumptions
All the methods assume a simple random sample…
… or at least independent observations
(It is possible to do simulations without that, but it’s harder)
The CLT based methods also assume that the sample is large enough
Single Proportion
Simulation: coin flips
do(1000000)*rflip(n, prob =p_0)->null_dist
Bootstrapping:
do(1000000)*tally(~variable, data =resample(dataset))->boots_dist
CLT:
Sampling distribution for \(\hat{p}\): \[\operatorname{N}\left(p, \sqrt{\frac{p(1-p)}{n}}\right)\]
Sample size assumption: \(np \ge 10\) and \(nq \ge 10\).
For null distribution: \(p = p_0\), \(q = q_0\).
For bootstrap distribution: \(p = \hat{p}\), \(q = \hat{q}\).
Example (CI)
A sample of size 30 is selected from a population of all residents of a town, and is tested for flu virus. Of the tested residents, 14 test positive. Construct a 96% confidence interval estimating the probability that a randomly selected town resident will test positive for the virus.
Example (Hypothesis Test)
A school district claims that 51% of their students are proficient in reading at their grade level. A random sample of 150 students from the district is tested, and 71 of them test as proficient at their grade level. You want to test the district’s claim using a hypothesis test, at 6% significance level.