Statistical programming, matrix languages, and more

Minimization of objective function with matrix

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Minimization of objective function with matrix

[ Edited ]

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.

 


Accepted Solutions
Highlighted
Solution
‎02-20-2018 04:46 PM
SAS Super FREQ
Posts: 4,243

Re: Minimization of objective function with matrix

 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. 

View solution in original post


All Replies
SAS Super FREQ
Posts: 4,243

Re: Minimization of objective function with matrix

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.

New Contributor
Posts: 4

Re: Minimization of objective function with matrix

[ Edited ]

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.

Highlighted
Solution
‎02-20-2018 04:46 PM
SAS Super FREQ
Posts: 4,243

Re: Minimization of objective function with matrix

 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. 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 216 views
  • 0 likes
  • 2 in conversation