Hello,
I need to minimize this function A = w' * cov * w, where cov is my variance matrix 5x5 and w is my list of parameters i need to chose in order to minimize A so w is a vector 1x5.
I have constraints where the sum of w = 1 and the parameters of w need to be between 0 and 1.
I tried several things but I am a bit lost on IML to do that, if somebody can help me, I have read the SAS IML User Guide with the routine function and some other topics but I didn't really understand completely how to suceed in order to solve my problem.
Thanks you by advance.
If w* is the value that minimizes w`*A*w, then w* also minimizes alpha * w`*A*w for all alpha > 0.
If you think back to calculus, you might remember the 1-D analogy: the value of x that minimizes 3(x-2)^2 also minimizes alpha 3(x-2)^2 for all alpha > 0.
Q(w) = w`*A*w is a quadratic function of w. You can use the NLPQUA subroutine to solve this problem, including putting constraints on the parameters. See the article "Quadratic optimization in SAS" for an example and discussion.
Thanks you !
So I tried this :
w = J(5,1,0.2);
con = {0 0 0 0 0 . . ,
1 1 1 1 1 . . ,
1 1 1 1 1 0 1};
opt = {0 2};
CALL NLPQUA(rc,wres,nccov,w,opt,con);
And it worked but I'm not sure If it gives me the right wres vector solution of the minimization of w'*A*w where A is nccov.
Instead it gives me the minimization of 0.5*w'*A*w I think, isn't it ?
Thanks you again by advance.
If w* is the value that minimizes w`*A*w, then w* also minimizes alpha * w`*A*w for all alpha > 0.
If you think back to calculus, you might remember the 1-D analogy: the value of x that minimizes 3(x-2)^2 also minimizes alpha 3(x-2)^2 for all alpha > 0.
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 25. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.