Why Compare Two Slopes?
A slope describing the overall relationship between two variables can differ from the slope describing their relationship among cases with the same value of another predictor. The first is a marginal slope: it summarizes the relationship without adjusting for the other predictor. The second is an adjusted slope: it describes the relationship while holding that predictor fixed in a specified regression model.
This workshop follows both calculations on the same small, hypothetical dataset. The goal is not to decide which number is universally correct. Each answers a different question. Comparing them helps show how the distribution of a second predictor can affect the overall association, and why an adjusted association must be interpreted in the context of its model.
The Dataset and the Model
Suppose a training program records five workers’ training hours, baseline assessment scores, and units assembled per shift. The numbers below are invented only to illustrate the calculations. Let \(x\) be training hours, \(z\) the baseline score in points, and \(y\) the units assembled per shift.
| Worker | \(x\): training hours | \(z\): baseline points | \(y\): units per shift |
|---|---|---|---|
| A | -2 | -1 | 4 |
| B | -1 | -1 | 3 |
| C | 0 | 0 | 12 |
| D | 1 | 1 | 13 |
| E | 2 | 1 | 18 |
The negative values for \(x\) and \(z\) can be understood as centered measurements: for example, \(x=-2\) means two hours below the sample’s average training hours. Centering changes the zero point, not the differences between workers. Here \(\bar{x}=0\), \(\bar{z}=0\), and \(\bar{y}=10\).
For the adjusted calculation, use an additive two-predictor model. In this model, the expected outcome is a linear function of both predictors, with a common slope for \(x\) at every value of \(z\). The fitted coefficients are chosen by least squares: they minimize the sum of squared differences between observed and fitted outcomes.
Worked Example: Calculate the Marginal Slope
Worked Example: Calculate the Marginal Slope
First ignore baseline score \(z\) and calculate the least-squares slope for predicting units assembled per shift from training hours alone. The simple-regression slope is \(S_{xy}/S_{xx}\), where \(S_{xy}=\sum (x_i-\bar{x})(y_i-\bar{y})\) and \(S_{xx}=\sum (x_i-\bar{x})^2\).
Because \(\bar{x}=0\) and \(\bar{y}=10\), the centered products for \(S_{xy}\) are \((-2)(4-10)\), \((-1)(3-10)\), \(0(12-10)\), \(1(13-10)\), and \(2(18-10)\). Thus:
The marginal slope is \(38/10=3.8\) units per shift per training hour. The simple-regression intercept is \(\bar{y}-3.8\bar{x}=10\) units per shift. So the fitted marginal line is \(\hat{y}=10+3.8x\). In this dataset, workers one training hour apart are associated, on average along this line, with a difference of 3.8 assembled units per shift. This is an overall association that does not hold baseline score fixed.
Worked Example: Fit the Two-Predictor Regression
Worked Example: Fit the Two-Predictor Regression
Now fit the additive model using both \(x\) and \(z\). Since both predictors have sample mean zero, the least-squares intercept is \(\bar{y}=10\). The two slopes solve the centered normal equations:
Here \(S_{xz}=\sum x_i z_i=6\), \(S_{zz}=\sum z_i^2=4\), and \(S_{zy}=\sum z_i(y_i-\bar{y})=24\). The value \(S_{xy}=38\) was calculated above. Substituting gives:
The determinant of the coefficient matrix is \(10(4)-6(6)=4\), which is not zero. The slopes can therefore be solved separately:
The fitted equation is \(\hat{y}=10+2x+3z\). For a check, its fitted values for the five rows are 3, 5, 10, 15, and 17 units per shift. Subtracting these from the observed outcomes gives residuals \(1,-2,2,-2,1\). They sum to zero, and their products with \(x\) and \(z\) also sum to zero. These checks agree with the least-squares equations: the residuals have no remaining linear association with either predictor in this sample.
Worked Example: Compare and Interpret the Estimates
Worked Example: Compare and Interpret the Estimates
The marginal slope is 3.8, while the adjusted coefficient for training hours is 2. Their difference is \(3.8-2=1.8\) units per shift per hour. In the two-predictor model, the adjusted slope says that workers with the same baseline score but one training hour apart differ by 2 fitted units assembled per shift, on average. It is a comparison at a fixed value of \(z\), not a summary of all worker pairs in the dataset.
The difference between the slopes can be understood from the relationship between the predictors. In this dataset, \(S_{xz}=6\), so workers with higher training-hour values also tend to have higher baseline-score values. The adjusted model estimates a baseline-score slope of 3 units per shift per point. When \(z\) is omitted, some of the overall change associated with \(z\) contributes to the simple-regression slope for \(x\).
For these data, the relationship can be shown directly. Write each outcome as \(y_i=10+2x_i+3z_i+e_i\), where \(e_i\) is its residual from the two-predictor fit. Taking centered products with \(x_i\) and summing gives:
The residual products sum to zero here, and the marginal slope is therefore:
This shows exactly how the predictor association contributes to the difference in this example. It does not imply that adjustment must always make a slope larger or smaller. The direction and size of a change depend on the fitted relationships and on how the predictors vary together.
What the Comparison Does—and Does Not—Tell You
The marginal slope answers, “How does the outcome vary overall with training hours in this dataset?” The adjusted slope answers, “How does the outcome vary with training hours among comparisons at the same baseline score, according to this additive model?” The latter is conditional on the chosen model and the available overlap in predictor values. These are distinct descriptions, not rival calculations of one number.
A fitted adjusted association does not establish that increasing training hours would cause an increase in units assembled. Other differences between workers, how training was assigned, measurement quality, or features missing from the model could matter. Here the dataset is tiny and hypothetical, so the arithmetic illustrates interpretation rather than providing reliable evidence about a population. No uncertainty estimates or significance tests have been calculated.
Common Mistakes
- Calling the marginal slope “wrong” because it differs from the adjusted slope. It answers a different question: the overall relationship without holding baseline score fixed.
- Describing the adjusted slope without naming what is held fixed. State that the comparison is at the same baseline score and refer to the additive model.
- Interpreting an adjusted association as a causal effect. Adjustment changes the comparison described by the model; it does not, by itself, show what would happen if training were increased.
- Assuming any two-predictor fit provides a meaningful comparison. Check that the predictors can be separately estimated and that the additive linear model is a reasonable description for the question. A coefficient calculation alone cannot establish that the model is appropriate.
Check Your Understanding
Use the worked dataset and explanations to answer these questions.
- Which centered sums are used to calculate the marginal slope of units assembled per shift on training hours?
- What are the fitted adjusted slopes for training hours and baseline score in the two-predictor model?
- Interpret the adjusted training-hours slope in context, including what is held fixed and the relevant units.
- Why does the marginal slope differ from the adjusted training-hours slope in this dataset?
- Why would it be incorrect to conclude from the adjusted slope alone that training causes a change in units assembled?