Tag Archives: Risk
Implement Portfolio Variance Calculation in R
Posted by Shawn Zhang
on May 31, 2012
No comments
It is critical to calculate total variance of portfolio given inputs of variance of assets within the portfolio . There is a little hardship in dealing with the correlation of the assets . Interaction for each pair of assets should be calculated separately. (See second term in below )
if we construct a function with input two vector, (weight vector and volatility vector) it is quite easy to implement first term with R by above:
sum(w^2 * s^2)
for the second term , we need a correlation Read more [...]