I'm trying to create a segmented regression which is quadratic in both segments, with the location of the breakpoint as one of the optimizing variables. I don't want to impose the condition that the overall regression be continuous, which seems to be complicating my attempts at implementation. Below is my current attempt in optmodel. The value for "break" that is returned is zero, so it seems like the break variable is somehow being ignored, even though the log acknowledges that there are seven variables in this optimization problem. When I substitute a specific numerical value for break, the optimization seems to work, so it seems like I am able to compute a segmented quadratic regression with a pre-specified breakpoint, but I can't seem to make the breakpoint one of the optimizing variables.
proc optmodel;
set <num> CCSM4_185;
set <num> Time;
num y{Time};
read data single into Time=[Time] y=CCSM4_185;
var intercept1;
var intercept2;
var alpha1;
var alpha2;
var beta1;
var beta2;
var break;
min Obj=sum{i in Time} (if i<break then
((y[i]-(intercept1+alpha1*i+alpha2*i*i))**2)
else
((y[i]-(intercept2+beta1*i+beta2*i*i))**2));
solve;
print intercept1 intercept2 alpha1 alpha2 beta1 beta2 break;