# RE: st: Re: Finding a vector minimizing the variance with Stata 8.2

 From "Kristin J. Kleinjans" To Subject RE: st: Re: Finding a vector minimizing the variance with Stata 8.2 Date Tue, 18 Jul 2006 14:05:43 +0200 (CEST)

```Thanks to everybody who answered - Al Feiveson's suggestion seems to fit
exactly to what I need.

Best regards,
Kristin

> Kristin - If you min w'Vw subject to w'e=1 where e is a vector of
> ones, the solution is w = VIe/(e'VIe) where "VI" stands for V-inverse.
> You can derive this by using a LaGrange multiplier - L
> min w'Vw - 2L(w`e) => Vw-Le = 0 => w = LVIw. But since e'w=1, L must
> be equal to 1/e'VIe.
>
> However this does not guarantee that the elements of w will be
> non-negative. If you require w>=0 then you have a quadratic
> programming problem. If the unconstrained solution has one or more
> negative
> elements, then it can be shown that the constrianed solution is
> equivalent to solving the unconstrained problem with some of the
> elements equal to zero. You could try all the combinations to see
> which gives you the minimum.
>
> Al Feiveson
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Kristin J.
> Kleinjans
> Sent: Monday, July 17, 2006 8:58 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: Re: Finding a vector minimizing the variance with
> Stata 8.2
>
> Hi Michael,
> that seems obvious - sorry, I should have explained what I am trying
> to do ...
>
> I am trying to find a linear combination of random variables a1-a4
> which minimizes the variance. So I am trying to find weights w=(w1 w2
> w3 w4) such that a=w1*a1+w2*a2+w3*a3+w4*a4  subject to  w1+w2+w3+w4=1
> has the lowest possible variance.
>
> (I am estimating a structural model with overidentifiying restrictions
> for the parameters I am interested in. I have 4 nonlinear combinations
> of estimates for the parameter of interest. I get those using the
> nlcom command.)
>
> Hope this explains my problem better!
> Thanks,
> Kristin
>
>
>
>>
>> M Blasnik
>>
>> ----- Original Message -----
>> From: "Kristin J. Kleinjans" <kkleinjans@econ.dk>
>> To: <statalist@hsphsun2.harvard.edu>
>> Sent: Monday, July 17, 2006 9:27 AM
>> Subject: st: Finding a vector minimizing the variance with Stata 8.2
>>
>>
>>> Dear Statalist,
>>> I need to find a vector w such that
>>> X=w'V w is minimized, where V is a variance-covariance matrix. I use
>>>  Stata 8.2 - does anybody know if there is a way to do this?
>>>
>>> Thank you,
>>> Kristin
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/support/faqs/res/findit.html
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```