Lecture 23: Inference with the Linear Regression Model

Purpose of Inference in Linear Regression

  • Regression models are used to estimate the true regression line within a population based on sample data.

  • For example, if we consider the height of fathers and sons, the measured data is used to estimate the relationship for a larger population, such as all male University of Otago students and their fathers.

  • A fitted model is only an estimate; therefore, researchers must assess the precision of the estimated parameters.

  • Precision is quantified using standard errors of the regression parameters.

  • These standard errors are the foundation for constructing confidence intervals and conducting hypothesis tests.

The Role of Error Variance and Uncertainty

  • The the linear regression model is expressed as: y=β0+β1x+ϵy = \beta_0 + \beta_1x + \epsilon

  • The error term ϵ\epsilon is assumed to follow a normal distribution with a mean of 00 and a variance of σϵ2\sigma^2_{\epsilon}.

  • Impact of Error Variance:

    • Large error variance (holding all other factors constant) results in a larger spread of data points around the true regression line.

    • Increased spread leads to greater uncertainty regarding the fitted regression line.

    • Greater uncertainty means the estimates β^0\hat{\beta}_0 (intercept) and β^1\hat{\beta}_1 (slope) are less precise.

  • To quantify uncertainty, the error variance σϵ2\sigma^2_{\epsilon} must be estimated from the data.

Estimating Error Variance (sϵ2s^2_{\epsilon})

  • The actual errors (ϵ\epsilon) are unknown, but they are estimated using residuals (ϵ^\hat{\epsilon}).

  • A good estimate for σϵ2\sigma^2_{\epsilon} is the sample variance of the residuals ϵ^1,ϵ^2,...,ϵ^n\hat{\epsilon}_1, \hat{\epsilon}_2, . . . , \hat{\epsilon}_n.

  • Standard sample variance uses the formula 1n−1∑i=1n(ϵ^i−ϵ^ˉ)2\frac{1}{n-1} \sum_{i=1}^{n} (\hat{\epsilon}_i - \bar{\hat{\epsilon}})^2, but specific modifications are required for regression:

    • The sample mean of the residuals is always zero (ϵ^ˉ=0\bar{\hat{\epsilon}} = 0).

    • The correct divisor (degrees of freedom) for simple linear regression is n−2n - 2, rather than n−1n - 1.

  • The estimate of the error variance is denoted as sϵ2s^2_{\epsilon}, calculated as: sϵ2=1n−2∑i=1nϵ^i2=RSSn−2s^2_{\epsilon} = \frac{1}{n - 2} \sum_{i=1}^{n} \hat{\epsilon}^2_i = \frac{RSS}{n - 2}

  • RSSRSS stands for the Residual Sum of Squares, defined as: RSS=∑i=1nϵ^i2RSS = \sum_{i=1}^{n} \hat{\epsilon}^2_i

Standard Error of the Slope Estimate (β^1\hat{\beta}_1)

  • The parameter β1\beta_1 is often the primary focus in studies as it represents the change in the expected value of yy for a unit change of xx in the population.

  • The precision of the estimate β^1\hat{\beta}_1 is measured by its standard error, σβ^1\sigma_{\hat{\beta}_1}.

  • The standard error represents the standard deviation of the sampling distribution of β^1\hat{\beta}_1 (the variation of β^1\hat{\beta}_1 if multiple data sets of the same size were taken from the population).

  • The theoretical formula for the standard error is: σβ^1=σϵ∑i=1n(xi−xˉ)2\sigma_{\hat{\beta}_1} = \frac{\sigma_{\epsilon}}{\sqrt{\sum_{i=1}^{n} (x_i - \bar{x})^2}}

  • This formula indicates that the standard error is proportional to the error standard deviation σϵ\sigma_{\epsilon}. As σϵ2\sigma^2_{\epsilon} increases, the standard error of β^1\hat{\beta}_1 also increases.

  • Because we do not know the true σϵ\sigma_{\epsilon}, we use the estimated standard error in practice: sβ^1=sϵ∑i=1n(xi−xˉ)2s_{\hat{\beta}_1} = \frac{s_{\epsilon}}{\sqrt{\sum_{i=1}^{n} (x_i - \bar{x})^2}}

Confidence Intervals for the Regression Slope

  • Confidence intervals for parameters in linear regression follow the general form: estimate±multiplier×std.errorestimate \pm multiplier \times std. error

  • For the slope β1\beta_1, the components are:

    • Estimate: β^1\hat{\beta}_1

    • Standard Error: sβ^1s_{\hat{\beta}_1}

    • Multiplier: Derived from a tt-distribution with degrees of freedom ν=n−2\nu = n - 2. This divisor matches the denominator used in the calculation of sϵ2s^2_{\epsilon}.

  • For a 100(1−α)%100(1 - \alpha)\% confidence interval, the multiplier is t1−α/2,n−2t_{1-\alpha/2, n-2}.

  • Calculation form: β^1±t1−α/2,n−2×sβ^1\hat{\beta}_1 \pm t_{1-\alpha/2, n-2} \times s_{\hat{\beta}_1}

Case Study: Father and Son Heights

  • Data Summary and R Output Analysis:

    • The fitted model is m_height = lm(son ~ father, data = height).

    • Residual standard error: 6.136.13 on 277277 degrees of freedom.

    • Estimate for Intercept: 114.0533114.0533 with a Std. Error of 8.49798.4979.

    • Estimate for Father (Slope β^1\hat{\beta}_1): 0.36990.3699 with a Std. Error of 0.04780.0478.

    • Total observations n=279n = 279.

  • Calculating Confidence Interval 'By Hand':

    • Level of confidence: 95%95\%

    • Multiplier from R: qt(0.975, 277) = 1.96861.9686

    • Calculation: 0.3699±1.9686×0.04780.3699 \pm 1.9686 \times 0.0478

    • 0.3699±0.09410.3699 \pm 0.0941

    • CI: (0.2758,0.464)(0.2758, 0.464)

  • Interpretation: We are 95%95\% confident that for every 1 cm1\,cm increase in the height of the father, the expected height of the son increases by between 0.27580.2758 and 0.464 cm0.464\,cm.

  • Using the confint() function in R:

    • Result for father (95%): (0.2758,0.464)(0.2758, 0.464)

    • Result for father (99%): confint(m_height, level = 0.99) yields (0.2459,0.4939)(0.2459, 0.4939).

The Concept of Regression to the Mean

  • Origin: The term "regression" was introduced by Francis Galton in his 1886 paper, "Regression Towards Mediocrity in Hereditary Stature."

  • Observation: One might expect a 1 cm1\,cm increase in father's height to result in a 1 cm1\,cm increase in son's height on average. However, the data shows this is not the case (β^1<1\hat{\beta}_1 < 1).

  • The definition of Regression to the Mean:

    • The son of a short father tends to be short, but on average, he is taller than his father.

    • The son of a tall father tends to be tall, but on average, he is shorter than his father.

    • This implies that extreme traits in parents tend to regress toward the population mean in their offspring.

Hypothesis Testing for the Slope Parameter

  • Hypothesis testing assesses whether two variables are linearly related in the population.

  • Hypotheses:

    • Null Hypothesis (H0:β1=0H_0: \beta_1 = 0): The outcome variable is not linearly related to the predictor variable; the mean of yy (μy\mu_y) does not depend on xx.

    • Alternative Hypothesis (HA:β1≠0H_A: \beta_1 \neq 0): A linear relationship exists between xx and yy.

  • Test Statistic: The test statistic is calculated as: t=estimate−nullstd.error=β^1sβ^1t = \frac{estimate - null}{std. error} = \frac{\hat{\beta}_1}{s_{\hat{\beta}_1}}

  • This follows a tt-distribution with n−2n-2 degrees of freedom.

Application: PCB Accumulation in Trout

  • Background Details:

    • Researchers studied polychlorinated biphenyls (PCBs), pollutants that accumulate in the food chain.

    • Subjects: 2828 trout collected from Cayuga Lake, NY in 1970.

    • Methodology: Age was known because fish were marked and stocked annually. Fish were ground and mixed, and chromatography was used to find PCB residue in ppm (parts per million).

  • Scientific Question: Is there evidence that log PCB residue increases with age?

    • Null Hypothesis (H0:β1=0H_0: \beta_1 = 0

    • Alternative Hypothesis (HA:β1≠0H_A: \beta_1 \neq 0

  • R Model Output Analysis:

    • Log PCB fitted against age: m_pcb = lm(logpcb ~ age, data = pcb)

    • Residual standard error: 0.5670.567 on 2626 degrees of freedom.

    • Multiple R-squared: 0.7310.731.

    • Age parameter estimate: 0.25910.2591.

    • Standard error for age: 0.03080.0308.

    • tnd-value: 8.418.41.

    • p-value (Pr(>∣t∣)Pr(>|t|)): 6.8×10−096.8 \times 10^{-09}.

  • Interpretation Approaches:

    • Confirmatory Study: Compare p-value to α\alpha (0.050.05). Since 6.8×10−09<0.056.8 \times 10^{-09} < 0.05, we reject H0H_0. There is evidence of a relationship between log PCB and age.

    • Exploratory Study: Interpret the p-value as the degree of incompatibility between the data and the null hypothesis. Use α\alpha as a guide and avoid strict binary decisions.

  • Conclusion: The data are highly unusual compared to what would be expected if the null hypothesis were correct. There is strong evidence against H0H_0.