Why Use Two Line Segments?
A straight line can be too restrictive when the mean response changes at one rate below a particular predictor value and at another rate above it. For example, a hypothetical process might show a steady increase in an outcome up to a known operating threshold, then continue increasing more slowly. A model with two linear segments can represent that change in rate without requiring the whole relationship to follow one line.
The knot is the predictor value where the two segments meet. In this tutorial the knot is fixed: its value is specified in advance rather than estimated from the observed responses. The central modeling choice is whether the fitted mean is required to be continuous there. Continuity means the two lines give the same mean response at the knot; it does not require the two slopes to be equal.
The Model and Its Parameters
Let \(Y_i\) be the response for observation \(i\), and let \(x_i\) be its quantitative predictor value. A convenient way to write the mean function is
Here \(c\) is the fixed knot, \(\theta\) is the mean response at the knot, \(\beta_L\) is the slope to the left, and \(\beta_R\) is the slope to the right. Centering each segment at \(c\) makes the shared value visible: substituting \(x=c\) into either line gives \(\theta\). Thus this parameterization builds continuity into the model.
The slopes measure change in mean response per one-unit increase in \(x\), in the corresponding segment. If the response is measured in milligrams and \(x\) in hours, for example, a slope is measured in milligrams per hour. A positive slope indicates an increasing fitted mean as \(x\) increases within that segment; a negative slope indicates a decreasing fitted mean. If \(\beta_L\ne\beta_R\), the rate of change differs across the knot even though the fitted mean itself has no jump.
The model is linear in \(x\) within each segment, but the entire mean curve need not be one straight line. When the slopes differ, the curve changes direction at \(c\) in the sense that its slope changes there. No smooth transition in slope is required: the two pieces meet in height, but they can form a corner.
Worked Example: Reading a Continuous Model
Suppose a hypothetical laboratory process has outcome \(Y\) measured in concentration units and predictor \(x\) measured in minutes. A fixed threshold is \(c=10\) minutes, and the proposed mean function is
The shared mean at the knot is \(\theta=8\) concentration units. The left-segment slope is \(1.2\) concentration units per minute, and the right-segment slope is \(0.5\) concentration units per minute. The fitted mean increases on both sides, but it increases more slowly after 10 minutes.
For \(x=7\), use the left segment: \(8+1.2(7-10)=8-3.6=4.4\) concentration units. At \(x=10\), either expression gives \(8\) concentration units. For \(x=14\), use the right segment: \(8+0.5(14-10)=8+2=10\) concentration units. The two fitted values at the knot agree, so this mean curve is continuous there.
How to Check Whether Two Lines Meet
A continuous model can also be written using ordinary line equations with separate intercepts:
In this form, continuity is not automatic. The left line gives \(a_L+b_Lc\) at the knot. The value approached by the right line as \(x\) approaches \(c\) from above is \(a_R+b_Rc\). These values must be equal. Therefore the continuity condition is
This condition equates the fitted mean values at the boundary. It does not require \(b_L=b_R\). Requiring equal slopes would make the two line pieces have the same direction; together with continuity, that would reduce the curve to one straight line across both segments.
Why the Condition Is Necessary and Sufficient
To verify the condition, consider what each segment predicts at the boundary. The left segment's value at \(c\) is obtained by direct substitution. The right segment is defined for \(x>c\), but its linear formula has a well-defined limit as \(x\) approaches \(c\) from the right. Since a line is continuous, that limit is its value evaluated at \(c\). A continuous join requires the left value and this right-hand limit to be equal.
If the two expressions are equal, both sides approach the same mean value at the knot, so there is no jump. If they are unequal, the difference between them is the size and direction of the jump in the fitted mean. Thus equality is both necessary and sufficient for continuity.
In the centered parameterization, the same reasoning is especially direct. Substituting \(x=c\) into either segment gives \(\theta+\beta(c-c)=\theta\). The common \(\theta\) therefore enforces the equality without a separate restriction on the slopes.
Worked Example: Checking Two Intercept-Form Lines
A hypothetical maintenance system has predictor \(x\), measured in operating hours, and a response \(Y\), measured in cost units. At the prespecified knot \(c=6\) hours, suppose the two candidate mean equations are
Evaluate both lines at the knot:
Because both give 24 cost units, the lines meet continuously at \(x=6\). Their slopes are 2 and 3 cost units per operating hour, so the rate of increase changes at the knot even though the mean does not jump.
Now change the right-hand intercept to 8, leaving its slope unchanged. The right line would give \(8+3(6)=26\) cost units at the knot, while the left line still gives 24. The right-hand limit exceeds the left value by \(26-24=2\) cost units. This altered pair is not a continuous two-segment model.
Using the Shared-Value Parameterization
For defining a continuous model, the form centered at the knot is often easier to interpret than two unrestricted intercepts. The shared parameter \(\theta\) directly answers, “What fitted mean does the model assign at the knot?” The two slopes then describe the rates of change away from that common point. For a fixed knot, the model has three mean parameters: \(\theta\), \(\beta_L\), and \(\beta_R\).
This does not mean that each observed response must equal the fitted mean. A regression model separates the systematic mean pattern from observation-to-observation error. A standard error formulation is
For the usual linear-regression setting, the errors are assumed to have conditional mean zero, a common conditional variance \(\sigma^2\), and independence across observations. Normal errors are additionally assumed when exact small-sample normal-theory inference is required. These are assumptions about deviations from the mean function, not additional continuity requirements. In particular, observed responses on opposite sides of the knot can differ substantially; continuity applies to \(\mu(x)\), not to the individual observations.
Worked Example: Calculating Means on Both Sides of a Knot
Consider hypothetical measurements of a response \(Y\) in milligrams against time \(x\) in hours. The knot is fixed at \(c=20\) hours, and a proposed continuous mean model has \(\theta=50\) milligrams, \(\beta_L=-0.8\) milligrams per hour, and \(\beta_R=1.5\) milligrams per hour:
At \(x=15\) hours, the left segment gives \(50-0.8(15-20)=50-0.8(-5)=54\) milligrams. At the knot, both sides meet at \(\theta=50\) milligrams. At \(x=24\) hours, the right segment gives \(50+1.5(24-20)=50+6=56\) milligrams.
The mean declines by 0.8 milligrams per hour to the left of the knot and increases by 1.5 milligrams per hour to its right. These different slopes create a minimum at the knot for this particular set of parameters. The model specifies these mean values; individual measurements can vary around them under the error assumptions.
Assumptions and Practical Checks
A fixed-knot piecewise mean function is meaningful only when the predictor is quantitative and the location of the knot is specified in the predictor's units. Its interpretation also depends on having observations that support both segments. If all observed \(x_i\) values fall on one side, the data provide no direct information about the slope on the unobserved side. This does not change the algebraic continuity condition, but it limits what can be learned from the data.
Before interpreting a fitted model, check that the intended knot and the two segment definitions are clear, that each prediction uses the appropriate side's equation, and that the two fitted means agree at \(c\). If the response or predictor is rescaled, parameter units change accordingly, but the equality condition at the knot remains the same.
Common Mistake: Confusing a Corner with a Jump
A frequent error is to think that continuity requires the left and right slopes to be equal. It does not. The slopes can differ while the line pieces share one fitted mean at the knot; the result is continuous but has a corner. The opposite error is to check that the slopes are different and conclude that the model must have a jump. A jump depends on the two values at \(c\), not on whether the slopes match.
Another mistake is to require the observed responses to line up at the knot. Regression models describe a conditional mean, and individual outcomes include error. The correct check is to substitute \(c\) into both segment formulas and compare their fitted mean values. For intercept-form equations, use \(a_L+b_Lc\) and \(a_R+b_Rc\); for the shared-value form, verify that both pieces use the same \(\theta\).
Check Your Understanding
Answer each question by referring to the mean function, not to individual noisy observations.
- For a fixed knot \(c=4\), do the lines \(3+2x\) on the left and \(7+x\) on the right meet continuously? Show both values at the knot.
- In the shared-value parameterization, what does \(\theta\) represent, and what are the units of each slope?
- Can a continuous two-segment mean function have different slopes on its two sides? Explain what the graph looks like at the knot.
- Why does a difference between two observed responses near the knot not, by itself, show that the fitted mean has a jump?
- If the knot is fixed at \(c\), write the equality that two intercept-form line equations must satisfy for continuity.