Hey guys I am trying to adapt a SAS code to mathematica, but I am experiencing some problems in doing that. I tried to run a model, but wasn't sure how to insert some conditionals.
SAS code:
proc nlin method = newton;
parms a=1 b=10^6 d=2.8;
If x > a then do;
Model S=0;
end;
else
if x < b then do;
model S =1;
end;
else
model S = (x^(d - 3) - b^(d - 3))/(a^(d - 3) - b^(d - 3));
end;
run;
My first mathematica model, without using the conditionals (x > a;x < b)
data = {{0.1 , 1},{0.5 , 0.99245283},{1 , 0.981132075},{2 , 0.957629013},{3 , 0.94647978},{5 , 0.892872862},{8 , 0.825362586},{10 , 0.794884307},{15 , 0.737820069},{30 , 0.688456089},{50 , 0.710852149},{100 , 0.686350949},{300 , 0.630188679},{500 , 0.622243133},{1500 , 0.61197978}};
model = (x^(d - 3) - b^(d - 3))/(a^(d - 3) - b^(d - 3));
nlm = NonlinearModelFit[data,model, {{a, 1}, {b, 10^6}, {d, 2.8}}, x,Method -> "Newton"]