Dear,
I am trying to fit a beta-sigmoid function (cfr https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4244967/pdf/mcg029.pdf) as follows:
title 'beta-sigmoid';
proc nlin data=&lib..duration method=gauss;
parms wmax 500 tm 100 te 360; /* initial guess */
model LL= wmax*(1+((te-elapsedhours)/(te-tm)))*((elapsedhours/te)**(te/(te-tm))) ;
output out=ModelOut2 predicted=Pred lclm=Lower95 uclm=Upper95;
by potnumber;
run;
This model has the constraint that LL=wmax when t > te. t is here elapsedhours. Now I get a negative estimate for tm. How can I add this constraint?
Thanks,
Veronique
my code is:
title 'beta-sigmoid';
proc nlin data=&lib..duration method=gauss;
parms LLmax 500 tm 100 te 360; /* initial guess */
if elapsedHours > te then value = LLmax;
else if elapsedhours=0 then value=0;
else value = LLmax*(1+((te-elapsedhours)/(te-tm)))*((elapsedhours/te)**(te/(te-tm))) ;
model LL= value ;
output out=ModelOut4 predicted=Pred lclm=Lower95 uclm=Upper95;
by potnumber;
run;
I still find negative values for tm. I do not see an error in my formula but maybe I am overlooking it.
Try
if elapsedHours > te then value = wmax;
else value = wmax*(1+((te-elapsedhours)/(te-tm)))*((elapsedhours/te)**(te/(te-tm))) ;
model LL= value ;
I believe the constraint refers to the estimated value of te. I already chose the starting value of te such that it is larger than t (elapsedhours). I tried the suggestion but now it failed completely.
Please show the SAS code you tried and the resulting log.
Dear PG,
I added an extra constraint. My code is now:
NOTE: DER.LLmax not initialized or missing. It will be computed automatically.
NOTE: DER.tm not initialized or missing. It will be computed automatically.
NOTE: DER.te not initialized or missing. It will be computed automatically.
NOTE: PROC NLIN grid search time was 0: 0: 0.
NOTE: Convergence criterion met.
NOTE: The above message was for the following BY group:
potNumber=129
and the log:
NOTE: DER.LLmax not initialized or missing. It will be computed automatically.
NOTE: DER.tm not initialized or missing. It will be computed automatically.
NOTE: DER.te not initialized or missing. It will be computed automatically.
NOTE: PROC NLIN grid search time was 0: 0: 0.
NOTE: Convergence criterion met.
NOTE: The above message was for the following BY group:
potNumber=129
my code is:
title 'beta-sigmoid';
proc nlin data=&lib..duration method=gauss;
parms LLmax 500 tm 100 te 360; /* initial guess */
if elapsedHours > te then value = LLmax;
else if elapsedhours=0 then value=0;
else value = LLmax*(1+((te-elapsedhours)/(te-tm)))*((elapsedhours/te)**(te/(te-tm))) ;
model LL= value ;
output out=ModelOut4 predicted=Pred lclm=Lower95 uclm=Upper95;
by potnumber;
run;
I still find negative values for tm. I do not see an error in my formula but maybe I am overlooking it.
The problem was that I chose the wrong startvalue. This final code works and gives me the expected solution. Thanks PG!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.