- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I run a non-linear regression using proc model. Proc model as you know have two options of restrictions on parameters: bound and restrict.
I have almost same restriction that returns 100 times, for example :
x1*x2*a+x3*b*t = k(t), when t=0.25,0.5,0.75,....,25 and k is fixed(number) for each t. i.e each t has different k
x1, x2, x3 - parameters
It looks like :
x1*x2*a+x3*b*0.25 = 60
x1*x2*a+x3*b*0.5 = 75
x1*x2*a+x3*b*0.75 = 79
...
Is there any way to write these restrictions in proc model in one restrict? Maybe put t and k into a dataset, that i could take the values from there?
Thank you
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Alexey,
If you want to programmatically generate your list of restrictions then you can use the SAS macro language. Here's an example that shows how a RESTRICT statement could be generated from values stored in a data set.
Marc
data d;
do t = 2 to 12 by 2;
output;
end;
run;
data _null_;
length eqs $ 1024;
set d;
eqname = 'eq'||left(put(_n_,6.));
call symput(eqname, "lhs = " || t);
run;
%macro restricts;
restrict
%do i = 1 %to 6;
%unquote(&eq&i)
%if &i ne 6 %then,
%end;
;
%mend restricts;
proc tmodel; ... your model code ...
%restricts;
quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes. You can specify multiple restrictions by separating them with commas on the RESTRICT statement:
restrict x1*x2*a+x3*b*0.25 = 60,
x1*x2*a+x3*b*0.5 = 75,
x1*x2*a+x3*b*0.75 = 79;
Also, you may be interested in using PROC TMODEL to estimate your model. PROC TMODEL uses the same syntax as PROC MODEL, but it has an improved non-linear optimization engine that is well suited to problems with nonlinear restrictions.
Marc
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Alexey,
If you want to programmatically generate your list of restrictions then you can use the SAS macro language. Here's an example that shows how a RESTRICT statement could be generated from values stored in a data set.
Marc
data d;
do t = 2 to 12 by 2;
output;
end;
run;
data _null_;
length eqs $ 1024;
set d;
eqname = 'eq'||left(put(_n_,6.));
call symput(eqname, "lhs = " || t);
run;
%macro restricts;
restrict
%do i = 1 %to 6;
%unquote(&eq&i)
%if &i ne 6 %then,
%end;
;
%mend restricts;
proc tmodel; ... your model code ...
%restricts;
quit;