BookmarkSubscribeRSS Feed
linlin87
Quartz | Level 8

Hi SAS communit

 

I have a code like this but I try to force the function to go through 0,0, how do I do this? 

Help would be brilliant for me thank you so much!

 

proc nlin data=data plots=fit outest=par_outest;
ods output parameterestimates=par_est;
parameters a=1 b=2 c=0.5 d=1;
model y = b+(a-b)/(1+exp((x-c)/d));
run;
2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hi @linlin87,

 

If you set x=y=0 in your model equation, you obtain a relationship between the parameters: a=-b*exp(-c/d), so you can eliminate parameter a (or one of the other parameters if you prefer), use

parameters b=2 c=0.5 d=1;
model y = b*(1-(1+exp(-c/d))/(1+exp((x-c)/d)));

and finally compute a point estimate of a from the estimates of b, c and d using the above relationship (and, with some more work, an approximate standard error and approximate confidence limits for a from the approximate standard errors of b, c and d, if needed).

Rick_SAS
SAS Super FREQ

See the article, "Regression with inequality constraints on parameters." 

It shows several examples, starting with simple restrictions and ending with the section "More general linear constraints," which applies to your problem.

 

First, set x=0 and y=0 in your model and solve for a as a function of the other parameters. I obtain

a = b*(1-t), where t = 1 + exp(-c/d), which simplifies to
a = -b*exp(-c/d).

You then use that expression in your PROC NLIN code:

proc nlin data=data plots=fit outest=par_outest;
ods output parameterestimates=par_est;
parameters b=2 c=0.5 d=1;
/* constrain the problem to pass through the origin (x,y)=(0,0) */
a = -b*exp(-c/d);
model y = b+(a-b)/(1+exp((x-c)/d));
estimate 'a' -b*exp(-c/d);              /* estimate original parameter */
run;

 

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 656 views
  • 2 likes
  • 3 in conversation