I have a data where the slope changes at a certain point. How do you find that point of inflection for the two linear lines? I think PROC NLIN would work but I can't get it to run. Sample code is given below as I cannot share my data. The point of inflection is 50. DATA data1;
do i=1 to 1000;
x=rand("Integer", 1, 50);
Y=3 + 6*x + rannor(345);
drop i;
OUTPUT;
end;
RUN;
DATA data2;
do i=1 to 1000;
x=rand("Integer", 50, 100);
Y=2 + 8*x + rannor(345);
drop i;
OUTPUT;
end;
RUN;
data full; set data1 data2;run;
proc nlin data=full;
parms alpha1=.45 beta1=.05 alpha2=.45 beta2=.05;
x0=5*beta1/alpha1;
model y = (x <x0)*(alpha1+beta1*x) +
(x>=x0)*(alpha2+beta2*x);
FILE log;put / x0= ;
output out=b predicted=yp;
run;
... View more