week6 handout

Table of contents

  1. Week 6: Regression diagnosis and non-linear regression
  2. Residual analysis
  3. Influence
  4. Smoothing the relationship
  5. Logarithms
  6. Non-linear relations
  7. Problems

1. Week 6: Regression diagnosis and non-linear regression

1.1 Diagnosing the fitted line using residuals

The quality of a regression model is assessed by examining its residuals, which are the differences between the observed values and the values predicted by the fitted line. Analyzing these residuals helps identify patterns, assess the spread of errors, evaluate the shape of the relationship, and detect unusual observations 2.

  • Residuals: These are the errors of the model, calculated as the observed value minus the predicted value.
  • Purpose of Residual Analysis: To check if the assumptions of the linear regression model are met and to identify potential problems with the fit 2.

📝 Residuals are the differences between observed and predicted values. For instance, if a model predicts a value of 10 for a data point, but the observed value is 12, the residual is 12−10=212 - 10 = 2 2.

1.2 Identifying influential observations

Influential observations are data points that significantly affect the regression line. Identifying and understanding these points is crucial for building a robust model 2.

1.3 Exploring and modeling non-linear relationships

Linear regression assumes a straight-line relationship between variables. When this assumption is violated, non-linear relationships may exist, requiring different modeling approaches 2.

1.4 Recognizing the limits of regression

Regression models have limitations. It is important to understand these boundaries to avoid misinterpreting results or overextending the model's applicability 2.

2. Residual analysis

2.1 From fitting a line to checking the fit

After fitting a line to describe the relationship between two numerical variables, residual analysis examines the errors left by that line. The fitted line provides a prediction (y^i\hat{y}_i) for each observation, and the residual (eie_i) is the prediction error, calculated as ei=yi−y^ie_i = y_i - \hat{y}_i.

The least squares method chooses the line that minimizes the sum of squared errors (∑ei2\sum e_i^2). Residual analysis helps identify what the fitted line might be missing, such as patterns, varying spread, unusual shapes, or outliers 4.

  • Prediction error: The residual (eie_i) is the difference between the observed value (yiy_i) and the predicted value (y^i\hat{y}_i) from the fitted line.
  • Least squares: This method finds the line that minimizes the sum of the squared residuals.
  • Purpose of residuals: They reveal aspects of the data that the fitted line does not capture, guiding further analysis and model improvement.

2.2 Residual analysis for October

The fitted line for gas consumption based on families using heating is Gas^≈1.292+0.201×Families\hat{\text{Gas}} \approx 1.292 + 0.201 \times \text{Families}. For October, with 15.6 thousand families, the observed gas consumption was 5.50 million m³, and the fitted consumption was 4.43 million m³.

The residual for October is eOctober=5.50−4.43=+1.07e_{\text{October}} = 5.50 - 4.43 = +1.07 million m³, indicating the fitted line underpredicts consumption for that month 5.

2.3 Histogram of the residuals

A histogram of the monthly residuals provides a visual summary of the prediction errors. With a small number of observations, the histogram offers limited evidence about the distribution's shape.

Typically, most errors are close to zero, but specific months might show larger positive or negative errors. The histogram helps to see the distribution of these errors and identify any unusual values 6.

This histogram displays the distribution of nine monthly residuals for residual gas consumption.

2.4 Reading the residual plot

A residual plot displays the residuals on the vertical axis against the explanatory variable on the horizontal axis. Each point on the plot represents one observation (e.g., one month).

A residual of zero means the observed value equals the fitted value. Positive residuals indicate the line underpredicts, while negative residuals indicate the line overpredicts 7.

A residual plot showing residual gas consumption against families using heating, with October highlighted.

2.5 What to look for in residuals

Residual analysis involves examining several key features to assess the quality of a fitted model:

  • Pattern: Look for systematic trends in the residuals across the range of the explanatory variable. Random scatter around zero is ideal.
  • Spread: Assess if the variability of the residuals is consistent across all values of the explanatory variable. Unequal spread can indicate problems.
  • Shape: Evaluate the distribution of the residuals. Ideally, they should be roughly bell-shaped (normal), but deviations like skewness or heavy tails can signal issues.
  • Unusual observations: Identify any points that stand far apart from the rest, as these may be outliers or influential points that disproportionately affect the model 8.

2.6 Regression with appropriate diagnostics

When a regression model is appropriate, diagnostic plots typically show residuals scattered randomly around zero with a consistent spread. The observed y values should follow a linear trend with x, and the histogram of residuals should be roughly bell-shaped.

A Q-Q plot comparing residual quantiles to normal quantiles should show points closely following a straight line, indicating normality 9.

A scatter plot shows observed y values against x values, with a red line indicating a linear relationship.

2.7 Heavy tails: clearer in the Q-Q plot

While a residual plot might show a hard-to-see pattern, the histogram of residuals can indicate more extreme values than expected in a normal distribution. The Q-Q plot clearly shows that both tails are heavier than normal, meaning there are more extreme residuals than would be predicted by a normal distribution 10.

A Q-Q plot compares residual quantiles against normal quantiles, with points deviating from the red line at the tails.

2.8 A curved residual pattern

When a straight line does not adequately capture the relationship, residuals tend to be positive at the ends of the x-range and negative in the middle, indicating that the straight line does not adequately capture the underlying trend. This pattern suggests that a linear model is insufficient and a curved relationship might be more appropriate 11.

2.9 Curvature with skewed residuals

The residual plot might show errors that curve with x, and the histogram of residuals can indicate a skewed distribution. For instance, residuals might be right-skewed, meaning there are more positive errors or larger positive errors than negative ones.

This indicates that the model's errors are not symmetrically distributed 12.

A histogram illustrates the distribution of residuals, showing a right-skewed shape.

2.10 Increasing spread: symmetric heavy tails

If the residuals fan out as x increases, it indicates that the magnitude of the errors grows with the explanatory variable. This "fan" shape in the residual plot suggests that the assumption of constant variance (homoscedasticity) is violated.

The Q-Q plot might still show symmetric heavy tails, but it doesn't reveal where this increasing spread occurs 13.

2.11 A fan with a nearly straight Q-Q plot

A residual plot showing a "fan" shape, where the spread of residuals increases with the explanatory variable x, highlights this issue. This pattern signifies larger errors at larger values of x. Even if the Q-Q plot suggests an approximately normal distribution, the fan shape in the residual plot indicates that the assumption of constant variance is violated 14.

This image displays four charts related to data analysis, illustrating the concept of a "fan" in a Q-Q plot.

3. Influence

3.1 Individual observations and the slope

A regression line fitted to a dataset can be disproportionately affected by certain observations. This section explores which observations exert the most influence on the fitted slope and quantifies this impact 16.

3.2 Example: final and midterm exam results

This example uses midterm exam scores as the explanatory variable and final exam scores as the response variable to illustrate concepts of influence 17.

A scatter plot displays the relationship between midterm and final exam scores, with midterm scores on the x-axis and final scores on the y-axis.

📝 When case 19 is removed, the slope of the regression line changes from 1.127 to 1.193 23.

3.3 The center and changes in slope

The regression line always passes through the center of the data, defined by the mean of the explanatory variable (xˉ\bar{x}) and the mean of the response variable (yˉ\bar{y}). When comparing different candidate lines that share this center, the steepness of the slope becomes more critical for observations further away from xˉ\bar{x}.

A change in slope has a greater effect on the predicted y-values for observations with x-values far from the mean 18.

Scatter plot illustrating how different slopes affect the predicted final scores for the same center.

3.4 Leverage

Leverage quantifies how far an observation's x-value is from the mean of all x-values, relative to the overall spread of x-values. Observations with high leverage have x-values that are unusual compared to the rest of the data.

The y-value of an observation does not affect its leverage; only its x-position matters 19.

A scatter plot illustrates leverage by showing how an observation's x-value deviates from the mean x, relative to the spread of all x-values.

3.5 How one point changes the slope

The influence of a single point on the slope depends not only on its leverage (its x-position relative to xˉ\bar{x}) but also on its y-position relative to the fitted line. Even with the same leverage, a point far from the original fitted line will cause a larger change in the slope when included in the regression calculation 20.

Two scatter plots illustrating how the position of an added point affects the slope of a fitted line.

3.6 Assessing influence on the slope

To formally assess an observation's influence on the slope, one can refit the regression model after removing that specific observation. A larger absolute difference between the original slope and the refitted slope indicates greater influence.

Influence on the slope is a combination of an observation's residual (its vertical distance from the fitted line) and its leverage (its horizontal distance from the mean x) 21.

3.7 Comparing two observations

An outlier is an observation that deviates significantly from the general pattern of the data, either in its x-value (high leverage) or its y-value relative to the fitted line (large residual). A case with a large residual and low leverage might be an outlier in the y-direction, while a case with high leverage might be an outlier in the x-direction.

Both can warrant closer examination 22.

A scatter plot showing the relationship between MIDTERM and FINAL scores, with a fitted line and highlighted outliers.

3.8 Worked example: case 19

Case 19 exhibits a large negative residual, meaning it falls significantly below the regression line fitted to all data. When case 19 is removed, the slope of the regression line changes slightly from 1.127 to 1.193. This small change suggests that case 19 has limited influence on the slope because its x-value is close to the mean x, where many other observations help stabilize the line 23.

Scatter plot showing the relationship between MIDTERM and FINAL scores, with two regression lines representing all cases and cases excluding case 19.

📝 Removing case 18 causes the slope to change from 1.127 to 0.779, indicating a greater influence than case 19 24.

3.9 Worked example: case 18

Case 18 has high leverage, meaning its x-value is far from the mean x. Removing case 18 from the analysis causes a more substantial change in the slope, from 1.127 to 0.779. This indicates that case 18 has a greater influence on the slope than case 19, even though its residual might be smaller. Including case 18 pulls the regression line closer to its position 24.

3.10 Handling influential observations

An observation with high leverage can have a substantial influence on the regression slope, even if its residual is small. Assessing this influence involves examining how the slope changes when the observation is removed 25.

  • Measurement or recording errors: If an influential observation is due to an error, it should be corrected or excluded.
  • Valid but influential observations: If the observation is valid, consider collecting more data points near its x-value to reduce its isolated impact.
  • Reporting results: Do not exclude valid influential observations solely because they affect the results. It is best practice to report the analysis both with and without such observations 25.

4. Smoothing the relationship

4.1 Example: plant density and yield

This section introduces the concept of smoothing relationships between variables, particularly when a simple linear model is insufficient. It uses an example of plant density and yield, where an initial linear fit shows little association.

The focus shifts to examining the typical yield at each observed plant density 27.

This scatter plot shows the relationship between plant density and yield, with a trend line indicating little association.

4.2 Constructing a median trace

A median trace is a method to visualize nonlinear relationships by connecting the median values of the dependent variable (y) at each level of the independent variable (x). The process involves grouping observations by their x-values, calculating the median y for each group, and then plotting these medians against their corresponding x-values.

The original data points are typically retained alongside the median trace to show the spread of the data 28.

For instance, at a density of 20 plants per m², the observed yields are 130.1, 139.6, 149.9, and 165.3. The median yield for this group is calculated as the average of the two middle values: (139.6+149.9)/2=144.75(139.6 + 149.9) / 2 = 144.75. This median value is then plotted at the density of 20 plants per m² 28.

4.3 Reading the median trace

The median trace reveals patterns that a simple straight line might miss. In the plant density and yield example, the median yield increases with density up to 20 plants per m² and then begins to fall.

This curved pattern, highlighting a peak median yield at a specific density, is more accurately represented by the median trace than by a single, constant slope 29.

A scatter plot showing yield (g/m²) versus density (plants/m²) with a median trace connecting the median yields at each density.

This scatter plot shows the relationship between plant density and yield, with a median trace line indicating the trend.

4.4 Median trace with continuous x

When the independent variable (x) is continuous, such as speed, a median trace is constructed by grouping nearby values into intervals. The median of the dependent variable (y) is calculated for each interval and plotted at the midpoint of that interval.

Connecting these midpoints creates the median trace. The choice of interval width can influence the resulting trace, and it is important to keep the original observations visible to understand the data's variability 30.

For example, if speeds are grouped into intervals of width 10, the median consumption for the interval 70≤Speed<8070 \le \text{Speed} < 80 might be 17. This median value would be plotted at a speed of 75 30.

Comparison of a straight-line fit versus a median trace for gas consumption against speed.

4.5 Nonlinear patterns revealed by a median trace

A median trace is particularly useful for uncovering nonlinear relationships that a straight-line fit might obscure. While a straight line assumes a constant rate of change (a single slope), a median trace can show where the relationship changes direction.

For instance, the median yield in the plant density example rises and then falls, and median gas consumption against speed can rise, fall, and rise again. These complex patterns are captured by the median trace, which connects group medians, while individual observations still vary around this smoothed trend 31.

4.6 Other ways to smooth the relationship

Beyond the median trace, other methods can smooth relationships between variables. A mean trace connects the average values of the dependent variable at each level of the independent variable.

LOESS (Locally Estimated Scatterplot Smoothing) is another technique that fits local regressions to nearby observations, creating a smooth curve without relying on fixed intervals or a single line for the entire dataset. These methods offer different ways to visualize underlying trends in the data 32.

Three charts illustrate different methods for smoothing data relationships: median trace, mean trace, and LOESS.

MethodDescription
Median traceConnects the median dependent variable values at each level of the independent variable.
Mean traceConnects the mean dependent variable values at each level of the independent variable.
LOESSFits smooth curves using local regressions on nearby observations.

5. Logarithms

5.1 Properties of logarithms

The natural logarithm, denoted as ln(x) or loge(x), is defined for x > 0, where y = ln(x). The value of ln(0) is undefined.

To recover x, one can exponentiate both sides of the equation y = ln(x) to get e^y = x, where e is approximately 2.71828 34.

For positive numbers a and b, and any real number c, the following properties of logarithms hold:

  • Product rule: ln(a) + ln(b) = ln(ab).
  • Power rule: c ln(a) = ln(a^c) 34.

5.2 Approximation of proportional change using natural logarithms

The difference between two natural logarithms approximates the proportional change between their arguments. This approximation is most accurate for small changes 35.

For instance, consider the average car volume in Ronda de Dalt, Barcelona: Table showing average car volume in Ronda de Dalt (Barcelona) for the years 2015 and 2016.

The increase in car volume from 2015 to 2016 can be approximated using the natural logarithm: ln(141137)−ln(135617)≈0.04ln(141137) - ln(135617) ≈ 0.04. This suggests an approximate 4% increase in car volume from 2015 to 2016 35.

This property can also be stated as: a 1% change in x corresponds to approximately a 0.01 change in ln(x). For example, 21 is 5% larger than 20, and the difference in their natural logarithms is: ln(21)−ln(20)≈3.044522−2.995732≈0.04879ln(21) - ln(20) ≈ 3.044522 - 2.995732 ≈ 0.04879, which is close to 0.05 35.

6. Non-linear relations

6.1 Example: advertising expenditures and sales

The relationship between advertising expenditures and sales often exhibits a non-linear pattern. While a simple linear model might suggest a constant increase in sales for every unit increase in advertising, real-world data frequently shows diminishing returns.

This means that beyond a certain point, additional advertising spending yields smaller and smaller increases in sales.

The original scatterplot of sales versus advertising expenditures reveals a positive correlation, but the residuals from a fitted straight line show a curved pattern. This curvature indicates that a linear model does not fully capture the relationship.

This scatterplot shows the relationship between advertising expenditures and sales, with a line of best fit indicating a positive correlation.

The residuals, which represent the differences between the observed sales and the sales predicted by the linear model, display a systematic pattern. This pattern suggests that the linear model is systematically over- or under-predicting sales at different levels of advertising expenditure 37.

Comparison of original and transformed scatterplots showing the relationship between Sales and Advertising before and after taking natural logarithms.

6.2 Taking logs of both variables

To address non-linearity, transformations can be applied to the variables. Taking the natural logarithm of both advertising expenditures and sales can linearize certain non-linear relationships.

This transformation is only possible if all sales and advertising values are strictly positive.

After applying the natural logarithm transformation to both variables, the resulting scatterplot often shows a more linear relationship. This suggests that a log-log model might be more appropriate for describing the data 38.

📝 If the fitted line is ln⁡(Sales)=2.7268+0.1294ln⁡(Advertising)\ln(\text{Sales}) = 2.7268 + 0.1294 \ln(\text{Advertising}), a prediction for Advertising = 2 (i.e., EUR 2,000) would be calculated by first finding the predicted ln⁡(Sales)\ln(\text{Sales}): 2.7268+0.1294ln⁡(2)≈2.81652.7268 + 0.1294 \ln(2) \approx 2.8165. Exponentiating this value gives the back-transformed prediction: exp⁡(2.8165)≈16.72\exp(2.8165) \approx 16.72 thousand euros 40.

6.3 Log-log model

A log-log model fits a straight line to the natural logarithms of both the response variable (sales) and the explanatory variable (advertising). The equation for this model is ln⁡(Salesi)=a+bln⁡(Advertisingi)\ln(\text{Sales}_i) = a + b \ln(\text{Advertising}_i).

A transformed scatterplot shows the relationship between ln(Sales) and ln(Advertising), with a straight line fitted to the data.

The residuals from this transformed model are examined to assess the linearity. If the strong curved pattern observed in the original residuals is much less evident after taking logs, it indicates that the log-log model provides a better fit 39.

6.4 Prediction with the transformed variables

The fitted line in a log-log model predicts the natural logarithm of sales. To obtain a prediction in the original scale of sales, the predicted ln⁡(Sales)\ln(\text{Sales}) value must be exponentiated.

For example, if the fitted line is ln⁡(Sales)=2.7268+0.1294ln⁡(Advertising)\ln(\text{Sales}) = 2.7268 + 0.1294 \ln(\text{Advertising}), a prediction for Advertising = 2 (i.e., EUR 2,000) would be calculated by first finding the predicted ln⁡(Sales)\ln(\text{Sales}): 2.7268+0.1294ln⁡(2)≈2.81652.7268 + 0.1294 \ln(2) \approx 2.8165. Exponentiating this value gives the back-transformed prediction: exp⁡(2.8165)≈16.72\exp(2.8165) \approx 16.72 thousand euros 40.

6.5 The slope of a log-log model is an elasticity

In a log-log model, the slope coefficient (bb) represents the elasticity. Elasticity measures the percentage change in the fitted response variable relative to a percentage change in the explanatory variable.

For instance, if the slope is 0.13, a 1% increase in advertising expenditure corresponds to approximately a 0.13% increase in fitted sales. This is because a 1% increase in advertising changes ln⁡(Advertising)\ln(\text{Advertising}) by approximately 0.01, leading to a predicted increase in ln⁡(Sales)\ln(\text{Sales}) of approximately 0.13×0.01=0.00130.13 \times 0.01 = 0.0013, which corresponds to a 0.13% increase in sales.

It is important to note that this describes a fitted association and does not establish a causal effect 41.

6.6 Semi-log: take the log of the response

A semi-log model involves taking the natural logarithm of only the response variable, while the explanatory variable remains in its original scale. The model is represented as ln⁡(y)=a+bx\ln(y) = a + bx, which can be rewritten in the original scale as y=ea+bxy = e^{a+bx}.

This model is suitable when y>0y > 0.

This chart illustrates the relationship between x and y in a semi-log model, showing how changes in x affect y.

In this model, equal increases in the explanatory variable (xx) lead to equal percentage changes in the fitted response variable (yy), not equal absolute changes. For small values of bb, a one-unit increase in xx results in approximately a 100b%100b\% higher fitted yy.

For example, if b=0.05b=0.05, a unit increase in xx leads to a 5% increase in yy 42.

6.7 Reciprocal: take the reciprocal of the predictor

Another transformation involves taking the reciprocal of the explanatory variable. The model is expressed as y=a+b1xy = a + b \frac{1}{x}, where x≠0x \neq 0.

This chart illustrates the relationship between y and x for different values of b, based on the equation y = a + b/x.

In this model, a one-unit increase in 1x\frac{1}{x} changes the fitted yy by bb units. The effect of a change in xx on yy depends on the starting value of xx.

For instance, with a=1a=1 and b=2b=2, increasing xx from 1 to 2 decreases fitted yy by 1 unit. However, increasing xx from 2 to 3 decreases fitted yy by approximately 0.33 units, demonstrating that the impact of a unit change in xx diminishes as xx increases 43.

7. Problems

7.1 Extrapolation

Extrapolation occurs when a regression model is used to predict values outside the range of the observed data. While the mathematical formula can produce a result, this prediction may be unreasonable or inaccurate because the underlying relationship might change beyond the observed range 45.

📝 A regression line fitted to the heights of boys aged 1–2 years is Height^=45+20×Age\hat{\text{Height}} = 45 + 20 \times \text{Age}. Using this model to predict the height of a 20-year-old would yield 45+20×20=44545 + 20 \times 20 = 445 cm, which is an unrealistic height for a human 45.

7.2 Latent variables

A latent variable is an unobserved factor that influences the relationship between the variables included in a regression model. When a significant latent variable is omitted, the estimated relationship can be misleading, appearing stronger, weaker, or even reversed compared to the true relationship 46.

  • Impact of omitted latent variables:
  • A relationship may appear non-existent when one is actually present.
  • An observed positive association might become negative after accounting for the latent variable, or vice versa.
  • An apparent relationship might be entirely explained by the influence of the omitted variable 46.

7.3 False relation example

Synthetic data on R&D spending (x) and patents (y) can illustrate how a latent variable, such as firm size, can create a misleading overall association. When all firms are considered together, there is a positive correlation between R&D spending and patents.

However, when firms are grouped by size (large vs. small), the relationship within each group becomes much weaker. Larger firms tend to spend more on R&D and produce more patents, making R&D appear strongly related to patents overall, even though the relationship within size categories is less pronounced 47.

Scatter plot showing room price versus rooms booked, with a trend line for all observations and separate trend lines for low and high seasons.

7.4 Reversed relation example

In a hypothetical hotel dataset, room price and the number of rooms booked might show a positive correlation when all observations are pooled. This suggests that higher prices are associated with more bookings.

However, when data is separated by season (low vs. high), the relationship reverses: within each season, higher prices are associated with fewer bookings. The high season itself leads to both higher prices and more bookings, masking the inverse relationship that exists within each season 48.

7.5 Ice-cream sales and shark attacks example

A strong correlation between monthly ice-cream sales and the number of deaths from shark attacks can be spurious. A latent variable, such as warmer weather, can influence both variables independently.

Warmer weather leads to increased ice-cream sales and also to more people swimming in the sea, which in turn increases the risk of shark attacks. Without accounting for the effect of weather, ice-cream sales might appear to cause shark attacks 49.

This line graph shows the per capita consumption of margarine in the United States and the divorce rate in Maine from 2000 to 2009, illustrating a strong correlation between the two variables.

7.6 Education, pay, and experience example

When examining the relationship between education and monthly pay, ignoring work experience can be misleading. A scatter plot of monthly pay versus years of education might show a nearly flat relationship, suggesting little connection.

However, when the data is stratified by work experience, it becomes clear that within each experience group, monthly pay increases with education. This indicates that experience is a latent variable that raises pay and is also correlated with education levels, masking the true positive relationship between education and pay 50.

Scatter plot showing monthly pay versus years of education, with and without considering work experience.

7.7 Aggregation changes the comparison

Aggregation, or averaging data, can alter the observed relationships between variables. When data is aggregated, within-group variation is removed, and the relationship observed at the aggregate level may not reflect the relationship at the individual level 51.

7.8 Household versus regional-mean regressions

Consider a dataset of household income and consumption. A regression using individual household observations will describe the relationship between income and consumption for individual households.

In contrast, a regression using regional means of income and consumption will describe the relationship between the average income and average consumption of different regions 52 53 76.

Observation UnitnSlopeR²
Households120.72830.7637
Regional means41.01610.8461

In this example, the regression using regional means has a larger slope and R² than the regression using individual household data. This difference arises because averaging removes the within-region variation.

The relationship between regional averages does not necessarily describe individual households, and a higher R² for the aggregate model does not imply it is a better model for individual-level analysis 54.

This scatter plot visualizes the relationship between household income and household consumption, with a fitted line indicating the trend.

This scatter plot visualizes the relationship between regional mean income and regional mean consumption for four regions.

7.9 Association is not causation

A strong correlation between two variables does not imply that a change in one variable causes a change in the other. This is a fundamental principle in statistical analysis, often summarized as "correlation does not imply causation" 55.

  • Spurious correlations: Seemingly strong relationships can exist between variables due to coincidence or the influence of a common underlying factor, rather than a direct causal link 55.

📝 Per capita consumption of margarine in the United States has shown a very strong correlation (r=0.993) with the divorce rate in Maine between 2000 and 2009. This high correlation does not mean that eating more margarine causes divorces, or vice versa. Both variables might be influenced by other societal trends or factors over time 55.

7.10 Residual analysis and diagnostics

Residual analysis is crucial for diagnosing the quality and assumptions of a regression model. Residuals are the differences between the observed values and the values predicted by the regression line.

Examining residuals helps identify potential problems such as non-normality, heteroscedasticity (unequal variance), and curvature 60 61 62 63.

  • Residual plot: A plot of residuals against the explanatory variable can reveal patterns. A random scatter around zero suggests a good fit. A curved pattern indicates that a linear model may be inappropriate, while a fanning-out pattern suggests increasing variance (heteroscedasticity) 63.
  • Residual histogram: A histogram of residuals should ideally resemble a normal distribution. Significant deviations, such as heavy tails, suggest non-normality 62.
  • Normal Q-Q plot: This plot compares the quantiles of the observed residuals to the quantiles of a theoretical normal distribution. A roughly straight line indicates that the residuals are normally distributed. Deviations from the line, such as points falling below the line at the tails, suggest heavy tails or other departures from normality 70 71 72.

A Q-Q plot showing observed residual quantiles against theoretical normal quantiles.

7.11 Heavy tails

Heavy tails in residual distributions mean that extreme values occur more frequently than predicted by a normal distribution. This can be observed in a residual histogram or, more clearly, in a normal Q-Q plot where points at the tails deviate significantly from the straight line, often falling below it for negative residuals and above it for positive residuals 71.

7.12 Curvature and increasing spread

A curved pattern in the residual plot indicates that the relationship between the variables is non-linear and a linear model is insufficient. An increasing spread of residuals as the explanatory variable increases (a "fan" shape) indicates heteroscedasticity, meaning the variance of the errors is not constant across all levels of the explanatory variable 66 68.

7.13 Influential observations

Certain data points, known as influential observations, can disproportionately affect the regression line. Removing such points can significantly change the estimated coefficients and the overall fit of the model 73.

📝 Comparing the slope of a regression line with and without specific cases (e.g., Case 19 or Case 18) can reveal their influence on the estimated relationship between midterm and final exam scores 73.

7.14 Log-log models and elasticity

Log-log models are used when the relationship between variables is non-linear and can be linearized by taking the logarithm of both variables. In such models, the slope coefficient represents elasticity, which measures the percentage change in the dependent variable for a one percent change in the independent variable 75.

📝 In a model predicting Sales from Advertising, a log-log transformation might be applied. If the fitted model for ln⁡(Sales)\ln(\text{Sales}) versus ln⁡(Advertising)\ln(\text{Advertising}) has a slope of 0.8, it means that a 1% increase in Advertising is associated with a 0.8% increase in Sales 75.

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also