Nice piece of code. I am intrigued about what the step function is doing in this instance- can anyone shed any light on it?
Similarly, how would one develop the code above to allow for a quadratic relationship in either/both slopes?
thanks in advance,
Jack