min Q1 median Q3 max mean sd n missing
17.1 24.245 27.9 33.46 69 29.09956 7.552866 135 0
Class 17
Do Americans tend to be overweight?
Body mass index (BMI) is an approximate scale used to assess weight status that adjusts for height.
When weight is measured in kg and height in meters, \[\text{BMI} = \frac{\text{weight}}{\text{height}{^2}}\]
When weight is measured in lbs and height in inches, \[\text{BMI} = \left(\frac{\text{weight}}{\text{height}{^2}}\right)(703)\]
| Category | BMI range |
|---|---|
| Underweight | \(<18.50\) |
| Normal (healthy weight) | 18.5-24.99 |
| Overweight | \(\geq 25\) |
| Obese | \(\geq30\) |
The National Health and Nutrition Examination Survey (NHANES) is another survey conducted by the CDC.
Purpose: to assess the health and nutritional status of adults and children in the United States
The NHANES dataset in the NHANES package contains responses from 10,000 participants.
The nhanes.samp.adult dataset in the oibiostat package contains responses from a random sample from participants who were age 21 or older.
We will treat nhanes.samp.adult as our sample and think of the adult participants in the NHANES dataset as the population.


I. Calculate a confidence interval for the population mean BMI.
min Q1 median Q3 max mean sd n missing
17.1 24.245 27.9 33.46 69 29.09956 7.552866 135 0
\[SE = \frac{s}{\sqrt{n}}\]
\(\bar{x} = 29.0995556\)
\(SE = 0.6500472\)
Critical \(t\):
qt(.05, df = 134)[1] -1.656305
Interval: \(\left(\bar{x} + t^*\cdot SE, \infty\right)\)
Confidence interval suggests that population average BMI is well outside the range defined as normal, 18.5 - 24.99.
We need \(\alpha = 1 - L\) and \(n\) for degrees of freedom. \(df = n - 1\)
Left or lower CI: the area to the left of \(t^\star\) is \(\alpha\).
With \(\alpha = 0.05\) (\(95\)% CI) and \(n = 25\):
qt(0.05, df = 24)[1] -1.710882
Right or upper CI: the area to the left of \(t^\star\) is \(1 - \alpha\).
With \(\alpha = 0.05\) (\(95\)% CI) and \(n = 25\):
qt(0.95, df = 24)[1] 1.710882
Two-sided CI: the area to the left of \(t^\star\) is \(1 - \alpha/2\).
With \(\alpha = 0.05\) (\(95\)% CI) and \(n = 25\):
qt(0.975, df = 24)[1] 2.063899
Make the \(t^\star\) negative for left (lower) interval.
We have a mathematical model for the population.
Using this model, we calculate the probability of observing the sample statistic that was actually observed.
If this probability is extremely low, we conclude that there is something wrong with the model.
The Infant Cognition Study
Model: the infants choose randomly (\(\operatorname{Binom}(16, 1/2)\)).
Observation: 14 out of 15 infants chose the helper.
\(\operatorname{P}(\text{Observation}\mid\text{Model}) \approx 0.002\)
The ALL example
Model: \(\operatorname{Pois}(2.25)\)
Observation: 8 cases of ALL over 5 years period.
\(\operatorname{P}(\text{Observation}\mid\text{Model}) \approx 0.002\)
Steps in hypothesis testing. Details coming in subsequent slides.
Formulate null and alternative hypotheses
Specify a significance level, \(\alpha\)
Calculate a test statistic
Calculate a \(p\)-value
State a conclusion in the context of the original problem
The null hypothesis (\(H_0\)) represents our mathematical model that we are trying to falsify.
The alternative hypothesis (\(H_A\)) claims a ‘real’ difference between the distribution of the observed data and the null-hypothesized distribution.
That is, the discrepancy between \(\overline{x}\) and \(\mu\) is large enough that it seems unlikely to occur from sampling variability.
Several possible choices for \(H_0\) and \(H_A\) for our BMI question. Let’s choose
\(H_0: \mu_{\text{bmi}} = 24.99 = \mu_0\)
\(H_A: \mu_{\text{bmi}} > 24.99\)
Deciding what will “extremely small” mean.
The significance level \(\alpha\) can be thought of as the value that quantifies how rare or unlikely an event must be in order to represent sufficient evidence against \(H_0\).
Typically, \(\alpha\) is chosen to be \(0.05\), \(0.01\), or some other small value.
In the context of decision errors, \(\alpha\) is the probability of making a Type I error.
Type I error refers to incorrectly rejecting the null hypothesis.
Choose \(\alpha = 0.05\).
The test statistic measures the discrepancy between the observed data and what would be expected if the null hypothesis were true.
When testing hypotheses about a mean, the test statistic is
\[T = \frac{\overline{X} - \mu_0}{s/\sqrt{n}},\]
where the test statistic \(T\) follows a \(t\) distribution with \(n-1\) degrees of freedom.
\[t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}\]
Assuming our model is correct, the \(T\)-statistic has T distribution with \(n-1\) degrees of freedom.
In that case, what is the probability that T = 6.3219343?
What is the probability that we would observe a result equal to or more extreme than the observed sample value, if the null hypothesis is true?
For a right-sided alternative, \(\mu > \mu_0\), the \(p\)-value is the total area in the right tail of the t distribution that are beyond the value of the observed statistic.
The \(p\)-value measures how well does the null model explain the data.
The smaller the \(p\)-value, the stronger the evidence against the null model.
If the \(p\)-value is as small or smaller than \(\alpha\), we reject the null model as not being useful. We say that the result is statistically significant at level \(\alpha\). That means we falsified our mathematical model.
If the \(p\)-value is larger than \(\alpha\), we do not reject the null model. The result is not statistically significant at level \(\alpha\). In other words, the evidence does not contradict the null hypothesis.
The \(p\) value is the conditional probability of a simple random sample of size \(n\) having the \(t\)-statistic equal to or more extreme than the sample we have, given the null model is correct.
Small \(p\)-value could mean:
We have a really strange sample (unlikely if sample is simple random, but quite possible if it is not!)
There is something wrong with the model:
If the \(p\)-value is smaller than the significance level \(\alpha\), we reject the null hypothesis \(H_0\).
If the \(p\)-value is larger than \(\alpha\), we do not reject \(H_0\).
A subtle but important point: not rejecting \(H_0\) is not the same as proving that \(H_0\) is true. We simply do not have sufficient evidence that \(H_0\) is not true!
What it means is that the null model is reasonable enough, and we can keep using it.
Remember: all models are wrong!
\(H_A: \mu > 24.99\), so more extreme means larger (right tailed test).
1 - pt(6.32, df = 134)[1] 1.797873e-09
The \(p\)-value is about \(0.000,\!000,\!001,\!78\), way smaller than \(\alpha\).
Suppose the \(t\)-statistic \(t = \pm 3.2\) and sample size \(n = 6\):
Left-tailed test: the area to the left of \(t\) with \(n-1\) degrees of freedom:
With \(t = -3.2\) and \(n = 6\):
pt(-3.2, df = 5)[1] 0.01199759
Right-tailed test: the area to the right of \(t\) with \(n-1\) degrees of freedom:
With \(t = 3.2\) and \(n = 6\):
1 - pt(3.2, df = 5)[1] 0.01199759
Two-tailed test: twice the area to the right of \(t\) if \(t > 0\) or left of \(t\) if \(t < 0\), with \(n-1\) degrees of freedom:
With \(t = 3.2\) and \(n = 6\):
2*(1 - pt(3.2, df = 5))[1] 0.02399518
With \(t = 3.2\) or \(t = -3.2\) and \(n = 6\):
State the conclusion in the context of the original problem, using the language and units of that problem.
This is the part most often omitted, but it is the most important!
At 5% significance level, we have sufficient evidence to reject the null hypothesis that the mean BMI of the US population is 24.99.
According to our evidence, the real mean BMI of the US population is significantly higher (\(\alpha = 0.05\)) than 24.99.
| \(H_0\) “true” | \(H_0\) false | |
|---|---|---|
| reject \(H_0\) | type I error | desired |
| don’t reject \(H_0\) | desired | type II error |
Theoretical probability of type I error is the significance level \(\alpha.\)
More about errors and significance levels next time.
Researchers collected measurements of 64 zebra mussels (Dreissena polymorpha) from a lake in northern Michigan. The mean length of mussels in their sample was 37.5 mm, with standard deviation 7.2 mm. Use this data to find a 95% confidence interval estimating the mean length of the zebra mussels in the lake.
The length of zebra mussels in certain lake in northern Michigan was previously modeled using a normal distribution with mean 39.2 mm. In an attempt to control the zebra mussel infestation, native crayfish was introduced into the lake. Two years later, researchers collected measurements of 64 zebra mussels from the lake. The mean length of their sample was 31.8 mm, with standard deviation 6.1 mm. Use this data to test the original model at 5% significance level.