STAT 306 - Module 04
\[ \begin{align} \widehat\beta_1 &= r_{XY}\frac{S_Y}{S_X} = \frac{\sum_{i=1}^n(x_i-\bar{x})(Y_i-\bar{Y})}{\sum_{i=1}^n(x_i-\bar{x})^2} = \frac{\sum_{i=1}^nx_iY_i - n\bar{x}\bar{Y}}{\sum_{i=1}^nx_i^2-n\bar{x}^2} \;, \\ \widehat\beta_0 &= \bar{Y} - \widehat\beta_1\bar{x} \; \end{align} \]
In Module 03, we derived the sampling distributions of the least squares estimators (LSE) \(\widehat{\beta}_0\) and \(\widehat{\beta}_1\).
We found that:
\[ \begin{align} \widehat{\beta}_1 \sim N\left(\beta_1, \frac{\sigma^2}{\sum_{i=1}^n(x_i-\bar{x})^2}\right) & \qquad \widehat{\beta}_0 \sim N\left(\beta_0, \sigma^2\left(\frac{1}{n} + \frac{\bar{x}^2}{\sum_{i=1}^n(x_i-\bar{x})^2}\right)\right) \; \end{align} \]
When we want to write \((1-\alpha)\times 100\%\) confidence intervals for a parameter \(\theta\), which of the following is the generic form?
When we want to write \((1-\alpha)\times 100\%\) confidence intervals for a parameter \(\theta\), which of the following is the generic form?
How does the width of a 95% confidence interval change as the sample size \(n\) increases?
How does the width of a 95% confidence interval change as the sample size \(n\) increases?
A group of educational researchers wants to estimate the average number of hours per week that full-time university students in a large state spend on academic activities outside of class time.
They randomly sample 200 full-time students from universities across the state. The sample mean is calculated to be 18.5 hours.
Then, a 95% confidence interval for the true mean number of hours spent on academic activities by all full-time university students in the state is calculated to be \([17.64, 19.36]\) hours.
Is the following interpretation about this interval correct or incorrect?
There is a 95% probability that the true average number of hours spent on academic activities by all full-time university students in the state falls between 17.64 and 19.36 hours.
Is the following interpretation about this interval correct or incorrect?
There is a 95% probability that the true average number of hours spent on academic activities by all full-time university students in the state falls between 17.64 and 19.36 hours.
Is the following interpretation about this interval correct or incorrect?
If we were to repeat this sampling process many times, taking random samples of 200 students and calculating a 95% confidence interval for each sample, we would expect about 95% of those calculated intervals to contain the true average number of hours spent on academic activities by all full-time university students in the state.
Is the following interpretation about this interval correct or incorrect?
If we were to repeat this sampling process many times, taking random samples of 200 students and calculating a 95% confidence interval for each sample, we would expect about 95% of those calculated intervals to contain the true average number of hours spent on academic activities by all full-time university students in the state.
Is the following interpretation about this interval correct or incorrect?
We are 95% confident that the sample mean number of hours is between 17.64 and 19.36 hours.
Is the following interpretation about this interval correct or incorrect?
We are 95% confident that the sample mean number of hours is between 17.64 and 19.36 hours.
Is the following interpretation about this interval correct or incorrect?
95% of the full-time university students in the state spend between 17.64 and 19.36 hours per week on academic activities.
Is the following interpretation about this interval correct or incorrect?
95% of the full-time university students in the state spend between 17.64 and 19.36 hours per week on academic activities.
Is the following interpretation about this interval correct or incorrect?
We can be 95% confident that a randomly selected full-time university student from the state spends between 17.64 and 19.36 hours per week on academic activities.
Is the following interpretation about this interval correct or incorrect?
We can be 95% confident that a randomly selected full-time university student from the state spends between 17.64 and 19.36 hours per week on academic activities.
Is the following interpretation about this interval correct or incorrect?
Approximately 95% of the possible samples of size \(n\) we could select would give us a 95% confidence interval that captures the true average number of hours spent on academic activities by all full-time university students in the state.
Is the following interpretation about this interval correct or incorrect?
Approximately 95% of the possible samples of size \(n\) we could select would give us a 95% confidence interval that captures the true average number of hours spent on academic activities by all full-time university students in the state.
Suppose we want to test \(H_0: \mu = \mu_0\) vs \(H_A: \mu \neq \mu_0\). And our test statistic is \(T = 1\). Which panel below shows the correct p-value?
Suppose we want to test \(H_0: \mu = \mu_0\) vs \(H_A: \mu \neq \mu_0\). And our test statistic is \(T = 1\). Which panel below shows the correct p-value?
Correct answer: Panel (A)
Suppose we want to test \(H_0: \mu = \mu_0\) vs \(H_A: \mu < \mu_0\). And our test statistic is \(T = 1\). Which panel below shows the correct p-value?
Suppose we want to test \(H_0: \mu = \mu_0\) vs \(H_A: \mu < \mu_0\). And our test statistic is \(T = 1\). Which panel below shows the correct p-value?
Correct answer: Panel (C)
Suppose we want to test \(H_0: \mu = \mu_0\) vs \(H_A: \mu > \mu_0\). And our test statistic is \(T = 1\). Which panel below shows the correct p-value?
Suppose we want to test \(H_0: \mu = \mu_0\) vs \(H_A: \mu > \mu_0\). And our test statistic is \(T = 1\). Which panel below shows the correct p-value?
Correct answer: Panel (B)
Is the following statement true or false?
The null model is the sampling distribution of the test statistic when the null hypothesis is true.
Is the following statement true or false?
The null model is the sampling distribution of the test statistic when the null hypothesis is true.
Last lecture we saw that \(\widehat{\beta}_1 \sim N\left(\beta_1, \dfrac{\sigma^2}{\sum_{i=1}^n(x_i-\bar{x})^2}\right)\).
What is the distribution of \[\dfrac{\widehat{\beta}_1 - \beta_1}{\sqrt{\dfrac{\sigma^2}{\sum_{i=1}^n(x_i-\bar{x})^2}}} \;?\]Last lecture we saw that \(\widehat{\beta}_1 \sim N\left(\beta_1, \dfrac{\sigma^2}{\sum_{i=1}^n(x_i-\bar{x})^2}\right)\).
What is the distribution of \[\dfrac{\widehat{\beta}_1 - \beta_1}{\sqrt{\dfrac{\sigma^2}{\sum_{i=1}^n(x_i-\bar{x})^2}}} \;?\]penguins dataset.flipper_length_mm to explain body_mass_g.lm():In practice, the error variance \(\sigma^2\) is unknown and must be estimated.
An unbiased estimator for \(\sigma^2\) is given by the residual mean square (\(s^2\)): \[ \widehat{\sigma}^2 = s^2 = \frac{\sum_{i=1}^n e_i^2}{n-2} = \frac{RSS}{n-2} \;, \] where we divide by \(n-2\) because two parameters (\(\beta_0\) and \(\beta_1\)) have been estimated from the data.
We know that \(\widehat{\beta}_1 \sim N\left(\beta_1, \frac{\sigma^2}{\sum_{i=1}^n(x_i-\bar{x})^2}\right)\).
Standardizing gives: \[\frac{\widehat{\beta}_1 - \beta_1}{\sqrt{\frac{\sigma^2}{\sum_{i=1}^n(x_i-\bar{x})^2}}} \sim N(0,1) \;. \]
Next, since \(\sigma^2\) is unknown, we replace it with its estimator \(\widehat{\sigma}^2\) to obtain: \[\frac{\widehat{\beta}_1 - \beta_1}{\sqrt{\frac{\widehat{\sigma}^2}{\sum_{i=1}^n(x_i-\bar{x})^2}}} \sim t_{n-2} \;. \]
To see why the quantity above follows a \(t_{n-2}\) distribution, note that, \[ \begin{align} \frac{(n-2)\widehat{\text{Var}}(\widehat{\beta}_1)}{\text{Var}(\widehat{\beta}_1)} &= \frac{\frac{(n-2)\widehat{\sigma}^2}{\sum_{i=1}^n(x_i-\bar{x})^2}}{\frac{\sigma^2}{\sum_{i=1}^n(x_i-\bar{x})^2}} \\ &= \frac{RSS}{\sigma^2} \sim \chi_{n-2}^2 \;, \end{align} \]
Therefore: \[ \frac{\frac{\widehat{\beta}_1 - \beta_1}{\sqrt{\text{Var}(\widehat{\beta}_1)}}}{\sqrt{\frac{\frac{(n-2)\widehat{\text{Var}}(\widehat{\beta}_1)}{\text{Var}(\widehat{\beta}_1)}}{n-2}}} = \frac{\widehat{\beta}_1 - \beta_1}{\sqrt{\frac{\widehat{\sigma}^2}{\sum_{i=1}^n(x_i-\bar{x})^2}}} \sim t_{n-2} \;. \]
Independence?
For this result to be true, we need that the numerator, \(\frac{\widehat{\beta}_1 - \beta_1}{\sqrt{\text{Var}(\widehat{\beta}_1)}}\), and the denominator, \(\frac{(n-2)\widehat{\text{Var}}(\widehat{\beta}_1)}{\text{Var}(\widehat{\beta}_1)}\), are independent.
This reduces to showing that \(\widehat{\beta}_1\) and \(\frac{RSS}{\sigma^2}\) are independent. (See the practice exercises.)
Let \(T = \frac{\widehat{\beta}_1 - \beta_1}{\sqrt{\frac{\widehat{\sigma}^2}{\sum_{i=1}^n(x_i-\bar{x})^2}}} \sim t_{n-2}\).
Starting with this probability statement about \(T\) \[ P(-t^* \leq T \leq t^*) = 1-\alpha \;, \] where \(t^*\) is some appropriately-chosen critical value (a fixed quantile), manipulate this probability to obtain an equivalent probability statement of the form \[ P\left(L < \beta_1 < U\right) = 1 - \alpha \;. \]
Confidence intervals provide a range of plausible values for an unknown parameter based on the data we have observed.
For \(\beta_1\), we have that
\[ \begin{align} CI(\beta_1, 1-\alpha) &= \widehat{\beta}_1 \pm t^*_{n-2,1-\frac{\alpha}{2}}\times \widehat{\text{SE}}(\widehat{\beta}_1) \;\\ &= \widehat{\beta}_1 \pm t^*_{n-2,1-\frac{\alpha}{2}}\times \frac{\widehat{\sigma}}{\sqrt{\sum_{i=1}^n(x_i-\bar{x})^2}} \;. \end{align} \]
confint function:confint() agree: the 95% confidence interval for \(\beta_1\) is approximately \((47.1, 53.2)\text{ g/mm}\).Always provide an interpretation based on the context of the problem. For example, in this case:
We are 95% confident that a \(1\text{ mm}\) increase in flipper length is associated with an expected increase in body mass between \(47.1\text{ g}\) and \(53.2\text{ g}\).
Caution
Meaning of “95% Confident”
We can also use the pivotal quantity to test hypotheses about \(\beta_1\).
For example, to test \(H_0: \beta_1 = \beta_{1,0}\) vs. \(H_A: \beta_1 \neq \beta_{1,0}\) (or \(<\) or \(>\)), under \(H_0\) we can use the test statistic: \[ T = \frac{\widehat{\beta}_1 - \beta_{1,0}}{\sqrt{\frac{\widehat{\sigma}^2}{\sum_{i=1}^n(x_i-\bar{x})^2}}} \sim t_{n-2} \quad (\text{under } H_0) \;. \]
In testing \(H_0: \beta_1 = 0\) vs. \(H_A: \beta_1 \neq 0\), what does a p-value of \(0.002\) mean?
In testing \(H_0: \beta_1 = 0\) vs. \(H_A: \beta_1 \neq 0\), what does a p-value of \(0.002\) mean?
Similarly for \(\widehat{\beta}_0\), we can show that: \[ \frac{\widehat{\beta}_0 - \beta_0}{\sqrt{\frac{\widehat{\sigma}^2}{n} + \frac{\widehat{\sigma}^2\bar{x}^2}{\sum_{i=1}^n(x_i-\bar{x})^2}}} \sim t_{n-2} \;. \]
Then, the \((1-\alpha)\) confidence interval for \(\beta_0\) is: \[ \begin{align} CI(\beta_0, 1-\alpha) &= \widehat{\beta}_0 \pm t^*_{n-2,1-\frac{\alpha}{2}}\times \widehat{\mathrm{SE}}(\widehat{\beta}_0) \\ &= \widehat{\beta}_0 \pm t^*_{n-2,1-\frac{\alpha}{2}}\times \sqrt{\frac{\widehat{\sigma}^2}{n} + \frac{\widehat{\sigma}^2\bar{x}^2}{\sum_{i=1}^n(x_i-\bar{x})^2}} \;, \end{align} \]
And to test \(H_0: \beta_0 = \beta_{0,0}\) vs. \(H_A: \beta_0 \neq \beta_{0,0}\) (or \(<\) or \(>\)), we use the test statistic: \[ T = \frac{\widehat{\beta}_0 - \beta_{0,0}}{\sqrt{\frac{\widehat{\sigma}^2}{n} + \frac{\widehat{\sigma}^2\bar{x}^2}{\sum_{i=1}^n(x_i-\bar{x})^2}}} \sim t_{n-2} \quad (\text{under } H_0) \;. \]
mtcars dataset.mpg: fuel efficiency in miles per gallon (response)wt: vehicle weight in 1,000 lbs (explanatory variable)mpg as the response and wt as the explanatory variable. Save the result in a variable called model_cars.confint()summary().Tip
Use lm() with the formula mpg ~ wt and data = mtcars. Then pass your fitted model object model_cars as the first argument to confint(..., level = 0.95).
Note
© 2025 Rodolfo Lourenzutti – Material Licensed under CC By-SA 4.0