Here's my solution to the "segmented regression" problem that I posed yesterday. Thanks for the comments and suggestions!
You'll recall that what we wanted to do was to end up with a fitted least squares "line" looking like this:
You'll recall that what we wanted to do was to end up with a fitted least squares "line" looking like this:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiK6ejufcss-gf2R6yGwau8qymeA6VmRc6xynQ-YhoCd0t9VWBDulXTuHYRw5KdZNBra8gqaEdqoqRijqIKibaro-XviThh10QWUlWCmyfrPN5Xy2StWAh9g5dc6C7HRLg5S9vE3SAn_Izi/s400/graph.gif)
In particular, the "kink" in the line is at a pre-determined point - in this example when x = 30.
Here's how we can achieve this: