proc iml;
x = {1,1,1,2,2,2,3,3,3};
y = {0.5,0.6,0.5,1,1.2,1,1.5,1.5,1.6};
Start reg(x,y);
Start SSE(alpha) global(x,y);
m = nrow(y);
res = j(1,m,0);
res = ((y - (alpha[1] + x*alpha[2:ncol(alpha)]))##2)`;
return(res);
finish SSE;
alpha = {0.5 30};
m1 = nrow(y);
optn = m1||2;
con = {0 0,
. 1};
call NLPLM(rc,xres,"SSE",alpha,optn,con);
print rc;
print xres;
return(xres);
finish reg;
xres = reg(x,y);
m1 = nrow(y);
xd = (j(m1,1,1) || x);
sol = solve(xd`*xd,xd`*y); /*checking*/
print sol;
quit;
Hi, I wanted to create a Non negative least squares inside proc iml as above. I want to wrap the nlplm call inside a modue becuase the values of x and y changes in my program (ie, i do reg on diferent partitions of orginal data). I get error for this program because x and y are not defined in the module SSE needed for nlplm. How do i go about this? Thank you.
... View more