Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Compute portfolio variance


From   André Gyllenram <[email protected]>
To   <[email protected]>
Subject   st: Compute portfolio variance
Date   Mon, 10 Sep 2012 10:56:21 +0200

Hello,

I want to compute the portfolio variance for each individual in every time-period. 

Portfolio variance = (weight(1)^2*variance(1) + weight(2)^2*variance(2) + 2*weight(1)*weight(2)*covariance(1,2)

My data-material is in this format:





individual  date                 STOCK    varISIN1    varISIN2   ...   varISIN199    corrSTOCK1STOCK2  corrSTOCK1STOCK3   ...   corrSTOCK99STOCK198
1          20000101              stock1   .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948
1          20000101              stock2   .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948
1          20000102              stock3   .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948
1          20000102              stock77  .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948
1          20000103              stock1   .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948
2          20000101              stock100 .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948
2          20000101              stock3   .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948
2          20000101              stock2   .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948
2          20000102              stock66  .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948
2          20000103              stock3   .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948
2          20000103              stock22  .3333333    450.3333         30.33333     .7073684          -.5765567                .1696948




The problem is that every individual do not own every stock. I also have a very large number of individuals so I cannot compute the portfolio variance for every individual and date manually. 


Does anyone have an idea how to do this?

Kind regards
André Gyllenram
 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index