Statistical programming, matrix languages, and more

Estimation of nonnegative parameters II

Reply
Contributor
Posts: 24

Estimation of nonnegative parameters II

Dear SAS/IML,

 

I would like to add the constraints X1, X2, X3, X4 < 1 in the coding below. 

Please let me know how to add these constraints. 

Thank you very much in advance. 

 

Sincerely your,

 

J1

 

data have;
infile cards truncover expandtabs;
input C M G T;
cards;
4,774 630 1.073446328 1990
4,964 624 1.06741573 1991
5,265 668 1.06741573 1992
5,545 720 1.06442577 1993
5,851 813 1.058495822 1994
6,129 903 1.052631579 1995
6,445 964 1.046831956 1996
6,785 1,060 1.043956044 1997
7,175 1,120 1.035422343 1998
7,665 1,250 1.032608696 1999
8,237 1,480 1.027027027 2000
8,648 1,400 1.02425876 2001
9,035 1,430 1.018766756 2002
9,521 1,550 1.010638298 2003
10,129 1,800 1.00795756 2004
10,774 2,030 1 2005
11,394 2,240 0.994764398 2006
11,960 2,370 0.989583333 2007
12,382 2,560 0.984455959 2008
12,289 1,980 0.981912145 2009
12,724 2,360 0.974358974 2010
;
run;

proc iml;
use have;
read all var {C M G T};
close;

start func(x) global(C,M,G,T);
obj=sum( (1/x[1])# ( (C#(M##x[2])# ((380/G)##x[3]) )##x[1] ) #exp(-x[4]#T) );
return (obj);
c[1]=1-x[1];
c[2]=x[2];
c[3]=x[3];
c[4]=1-X[1]*(X[2]+X[3]);
c[5]=1-X[1]*(1+X[2]+X[3]);
return(c);
finish;

call randseed(123456789);
x = j(1,4,.);

opt = j(1, 11, .);
opt[1]=1;opt[2] = 3; opt[10] = 5;

ods select none;

do i=1 to 14;
call randgen(x,'uniform');x=x#10;
ods output ParameterEstimates=parm_est ConvergenceStatus=converg;
CALL NLPNMS(rc,xres,"func",x,opt, , , , , "C_UC2D");
end;
quit;
ods select all;
proc sort data=parm_est;by parameter;run;
data want;
set parm_est;
if mod(_n_,2)=0;
run;

proc means data=want mean stderr nway;
class parameter ;
var estimate;
run;

Ask a Question
Discussion stats
  • 0 replies
  • 273 views
  • 0 likes
  • 1 in conversation