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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 219 views
  • 1 like
  • 3 in conversation