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:
The error term is assumed to follow a normal distribution with a mean of and a variance of .
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 (intercept) and (slope) are less precise.
To quantify uncertainty, the error variance must be estimated from the data.
Estimating Error Variance ()
The actual errors () are unknown, but they are estimated using residuals ().
A good estimate for is the sample variance of the residuals .
Standard sample variance uses the formula , but specific modifications are required for regression:
The sample mean of the residuals is always zero ().
The correct divisor (degrees of freedom) for simple linear regression is , rather than .
The estimate of the error variance is denoted as , calculated as:
stands for the Residual Sum of Squares, defined as:
Standard Error of the Slope Estimate ()
The parameter is often the primary focus in studies as it represents the change in the expected value of for a unit change of in the population.
The precision of the estimate is measured by its standard error, .
The standard error represents the standard deviation of the sampling distribution of (the variation of if multiple data sets of the same size were taken from the population).
The theoretical formula for the standard error is:
This formula indicates that the standard error is proportional to the error standard deviation . As increases, the standard error of also increases.
Because we do not know the true , we use the estimated standard error in practice:
Confidence Intervals for the Regression Slope
Confidence intervals for parameters in linear regression follow the general form:
For the slope , the components are:
Estimate:
Standard Error:
Multiplier: Derived from a -distribution with degrees of freedom . This divisor matches the denominator used in the calculation of .
For a confidence interval, the multiplier is .
Calculation form:
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: on degrees of freedom.
Estimate for Intercept: with a Std. Error of .
Estimate for Father (Slope ): with a Std. Error of .
Total observations .
Calculating Confidence Interval 'By Hand':
Level of confidence:
Multiplier from R:
qt(0.975, 277)=Calculation:
CI:
Interpretation: We are confident that for every increase in the height of the father, the expected height of the son increases by between and .
Using the
confint()function in R:Result for father (95%):
Result for father (99%):
confint(m_height, level = 0.99)yields .
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 increase in father's height to result in a increase in son's height on average. However, the data shows this is not the case ().
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 (): The outcome variable is not linearly related to the predictor variable; the mean of () does not depend on .
Alternative Hypothesis (): A linear relationship exists between and .
Test Statistic: The test statistic is calculated as:
This follows a -distribution with degrees of freedom.
Application: PCB Accumulation in Trout
Background Details:
Researchers studied polychlorinated biphenyls (PCBs), pollutants that accumulate in the food chain.
Subjects: 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 (
Alternative Hypothesis (
R Model Output Analysis:
Log PCB fitted against age:
m_pcb = lm(logpcb ~ age, data = pcb)Residual standard error: on degrees of freedom.
Multiple R-squared: .
Age parameter estimate: .
Standard error for age: .
tnd-value: .
p-value (): .
Interpretation Approaches:
Confirmatory Study: Compare p-value to (). Since , we reject . 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 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 .