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:
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: