12 - Inference for Linear Regression
Hypothesis Testing

Alex John Quijano

12/01/2021

Previously on Statistics…

Inference on Single Mean

Today, we will discuss the following:

Sandwich Store Linear Model (1/2)

Revenue as a linear model of advertising dollars for a population of sandwich stores, in thousands of dollars.

Revenue as a linear model of advertising dollars for a population of sandwich stores, in thousands of dollars.

Sandwich Store Linear Model (2/2)

The population model is: \[y_{revenue} = \beta_0 + \beta_1 x_{advertising} + e\] where \(y\) is the response, \(x\) is the predictor, \(\beta_0\) is the intercept, \(\beta_1\) is the slope, and \(e\) is the error term.

The least squares regression model uses the data to find a sample linear fit: \[\hat{y}_{revenue} = b_0 + b_1 x_{advertising}.\] where \(b_0 = 11.23\), \(b_1 = 4.8\).

Variability of the Statistic (1/5)

A random sample of 20 stores from the entire population. A linear trend between advertising and revenue continues to be observed.

A random sample of 20 stores from the entire population. A linear trend between advertising and revenue continues to be observed.

Variability of the Statistic (2/5)

A second sample of size 20 also shows a positive trend!

A different random sample of 20 stores from the entire population. Again, a linear trend between advertising and revenue is observed.

A different random sample of 20 stores from the entire population. Again, a linear trend between advertising and revenue is observed.

Variability of the Statistic (3/5)

The linear models from the two different random samples are quite similar, but they are not the same line.

The linear models from the two different random samples are quite similar, but they are not the same line.

Variability of the Statistic (4/5)

If repeated samples of size 20 are taken from the entire population, each linear model will be slightly different. The red line provides the linear fit to the entire population.

If repeated samples of size 20 are taken from the entire population, each linear model will be slightly different. The red line provides the linear fit to the entire population.

Variability of the Statistic (5/5)

Variability of slope estimates taken from many different samples of stores, each of size 20.

Variability of slope estimates taken from many different samples of stores, each of size 20.

Baby Weights

Consider data births gathered originally from the US Department of Health and Human Services. The births14 data can be found in the openintro R package. We will work with a random sample of 100 observations from these data.

We want to predict the baby weight based on number of weeks. The population linear model is \[y_{weight} = \beta_0 + \beta_1 x_{weeks} + e\]

The relevant hypotheses for the linear model setting can be written in terms of the population slope parameter. Here the population refers to a larger population of births in the US.

Technical Conditions

Least Squares Approximation

The least squares estimates of the intercept and slope are given in the estimate column. The observed slope is 0.335.
term estimate std.error
(Intercept) -5.72 1.61
weeks 0.34 0.04

The least squares regression model uses the data to find a sample linear fit: \[\hat{y}_{weight} = -5.72 + 0.34 x_{weeks}.\]

R code:

lm(weight ~ weeks, data = births14_100)

where the data frame births14_100 is a subset of the original births14 data.

Hypothesis Testing - Randomization Method (1/2)

Two different permutations of the weight variable with slightly different least squares regression lines.

Hypothesis Testing - Randomization Method (2/2)

Histogram of slopes given different permutations of the weight variable. The vertical red line is at the observed value of the slope, 0.335.

Hypothesis Testing - Theoretical Method

The least squares estimates of the intercept and slope are given in the estimate column. The observed slope is 0.335.
term estimate std.error statistic p.value
(Intercept) -5.716 1.6137 -3.54 6e-04
weeks 0.335 0.0416 8.07 <0.0001

\[T = \frac{b_1 - \text{null value}}{SE} = \frac{0.335 - 0}{0.0416} = 8.0529\]

10.10-Minute Activity

Consider the following least squares output.

term estimate std.error statistic p.value
(Intercept) -29.90 7.79 -3.84 0.0012
perc_pov 2.56 0.39 6.56 <0.0001

Here, we model the murders per mile based on the poverty level.

  1. Write the linear equation for the population model and the estimated linear model.

  2. What are the hypotheses for evaluating whether the slope of the model predicting annual murder rate from poverty percentage is different than 0?

  3. State the conclusion of the hypothesis test from part (2) in context of the data. What does this say about whether poverty percentage is a useful predictor of annual murder rate?