5 Change of Slope Models

1 Change of Slope Model

Change of Slope Model

The change of slope model/broken-stick regression is given by (1.1)yt=β0+β1t+β2ReLU(tc)+εt, with εti.i.dN(0,σ2), ReLU(tc)=max{tc,0}.[1]

For tc, the slope of the regression line is β1, while for t>c, is β1+β2. The parameters here are c,β0,β1,β2,σ.

If c were known, then (1.1) is a linear: y=Xcβ+c, here Xc=(11ReLU(1c) 1nReLU(1c)).

2 Parameter Estimation

2.1 MLE

We also use MLE: RSS(c)=minβ0,β1,β2t=1n(ytβ0β1tβ2ReLU(tc))2. After numerically solving this, the model becomes linear as mentioned just now, so β^=(β^0,β^1,β^2)T=(Xc^TXc^)1Xc^Ty. Then σ^=RSS(c^)n3.

2.2 Uncertainty Quantification

Now switch to Bayes. Suppose prior: β0,β1,β2,logσi.i.dUnif(C,C) for a large C. For c, it is also uniform and the range is 1,,n. However, c can't be 1 or n: when c=1, β0+β1t+β2ReLU(t1)=β0+β1t+β2(t1) is linear. Same for c=n. Therefore cUnif{2,,n1}.
Then π(c|data)(1RSS(c))n32|XcTXc|121{c=2,,n1}. Given c, the model is linear. By Homework 1 Problem 4, RSS(c)σ2|data,cχn32. Finally, β|data,c,σN3(β^c,σ2(XcTXc)1),β^c=(XcTXc)1XcTy.

2.3 Posterior Sampling for Uncertainty Quantification

Drawing posterior samples from unknown parameters is a useful way to visualize the uncertainty.

Algorithm (Posterior Sampling)

  1. Obtain samples c(1),,c(N) by sampling with replacement from {2,,n} with probability weights given by π(c|data) here.
  2. For each j=1,,N:
    1. Fix c=c(j).
    2. Calculate RSS(c),β^c by implementing linear regression with fixed c.
    3. Generate χ2χn32, then take σ(j)=RSS(c)χ2.
    4. Take β(j)N(β^c,(σ(j))2(XcTXc)1) to be a generated random vector.

So now we have (c(j),β0(j),β1(j),β2(j),σ(j)) for j=1,,N, then we can fit values tβ0(j)+β1(j)t+β2(j)ReLU(tc(j)),t=1,,n.

If we want to obtain posterior samples for yt for future t, then based on the algorithm, in step 2, add 2.5: generate yt(j)N(β0(j)+β1(j)t+β2(j)ReLU(tc(j),(σ(j))2).

3 More Change of Slope

If we want to introduce one more break point: yt=β0+β1t+β2ReLU(tc1)+β3ReLU(tc2)+εt, with εti.i.dN(0,σ2), we can also write it as y=Xcβ+ε,Xc=(11ReLU(1c1)ReLU(1c2)1nReLU(nc1)ReLU(nc2)). Then we can also have posterior π(c|data)(1RSS(c))n42|XcTXc|12. For more break points, we can consider yt=β0+β1t+j=1kβj+1ReLU(tcj)+εt.


  1. We can also denote this as ()+. ↩︎