BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vstorme
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
vstorme
Obsidian | Level 7

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. 

View solution in original post

6 REPLIES 6
PGStats
Opal | Level 21

Try

 

  if elapsedHours > te then value = wmax;
   else value = wmax*(1+((te-elapsedhours)/(te-tm)))*((elapsedhours/te)**(te/(te-tm))) ;
   model LL= value ;
PG
vstorme
Obsidian | Level 7

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.

PGStats
Opal | Level 21

Please show the SAS code you tried and the resulting log.

PG
vstorme
Obsidian | Level 7

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

vstorme
Obsidian | Level 7

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. 

vstorme
Obsidian | Level 7

The problem was that I chose the wrong startvalue. This final code works and gives me the expected solution. Thanks PG!

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 6 replies
  • 1233 views
  • 0 likes
  • 2 in conversation