# How to calculate risk of portfolio in last part [closed]

Investment decisions are not taken in insolation; investors have to consider market dynamics and firm level factors to choose among various available securities. Among different factors affecting the investment decisions; risk and return are the significant one. Considering only one of these two factors will not lead to a rational decision; investors have to consider both for an optimal portfolio. Along with these factors; risk appetite of an investor cannot be separated from investment decision. The decision of risk taker investor is definitely different from a risk-averse investor.

Suppose you are a new investor in the market and you have two options for investing your money. On the basis of risk return analysis and your risk appetite you are required to select the one that suits you the most. Following information is available for the two stocks:

Stock A              Stock B
Returns  Probability Returns Probability
29%      25%         30%      35%
28%      25%         29%      45%
30%      50%         28%      20% respectively


You are required to calculate:

Return

1. Expected return on stock A

2. Expected return on stock B

Risk

1. Coefficient of variation for Stock A

2. Coefficient of variation for Stock B

On the basis of calculation of return and risk of both stocks; select the one according to your risk appetite (Note: First declare yourself either as risk-averse investor or risk taker investor). Now construct a portfolio of these two securities with proportion of 40% of your total investment in Stock A and 60% in Stock B; keeping all other information same (about risk and return) calculate risk of portfolio if covariance between two stock is -0.45. Compare the risk of your selected stock and the portfolio; do you think portfolio have diversified the risk?

## closed as off-topic by skoestlmeier, byouness, Attack68♦, Alex C, HelinJan 24 at 7:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Basic financial questions are off-topic as they are assumed to be common knowledge for those studying or working in the field of quantitative finance." – skoestlmeier, byouness, Attack68, Alex C, Helin
If this question can be reworded to fit the rules in the help center, please edit the question.

• is this homework? – steveo'america Jan 23 at 19:41

Risk of the individual assets as defined in your question by CV (std. dev./mean) can be determined by calculating the squared difference of each of the returns from the weighted average mean return for each asset (Expected return). Multiply each of these squared differences by the corresponding probabilities. Take the square root of this total sum of probability weighted squared differences--this will get you the std. dev. of each asset. Now divide the std. dev. by the expected return to arrive at the CV.

Take the std. deviations calculated above and calculate the portfolio risk below.

Portfolio Risk of your 2 asset portfolio can be determined by applying the formula below:

$$\sigma^2_p=\sigma^2_aW^2_a+\sigma^2_bW^2_b+2W_aW_b\sigma_a\sigma_b(cor_{xy})$$

where W are the weights, sigma is the standard deviation, and cor is the correlation between the asset returns.

Note: $$cov_{ab}=\sigma_a\sigma_b(cor_{xy})$$; Also risk is often expressed as the standard deviation or $$\sigma_p$$

Say our portfolio consists of four securities representing different sectors of the economy.

We have used the data of Boeing, Bank of America, Amazon, and Microsoft. To build the portfolios, we first gather the daily performance data of all four securities.

Next, we split this data into train and test data. We use the train data to create the portfolios and arrive at the best possible weights for the four securities. Using these weights, we test the performance of the best portfolio on the test data.

In the next step, we compute the annualized returns of each security by using the latest and oldest close prices of stocks. We will use the annualized returns to compute the expected return of a portfolio.

Next, we create two data frames, representing the train and test data that will contain the daily percentage change of each stock. We will use these return values of the train data to calculate the covariance matrix for the four stocks.

Covariance is a measure of the joint variability of two random variables. If the greater values of one variable correspond with the greater values of the other variable, and the same holds for the lesser values, then the covariance is positive. In the opposite case, when the greater values of one variable to the lesser values of the other, (i.e., the variables tend to show opposite behavior), the covariance is negative. The sign of the covariance, therefore, shows the tendency in the linear relationship between the variables. We will learn how to compute the covariance matrix in the next unit.

After this, we create a function to estimate the annualized portfolio’s returns and standard deviation using a random set of weights for the four securities. We will use this function to create random portfolios and estimate their performance.

To create random portfolios, we will simulate random weights for the four securities. Here we need to make sure that the sum of weights is always equal to 1, so as to reflect the percentage allocations accurately.

After this, we calculate the expected portfolio returns and the expected standard deviation of a portfolio using the annualized portfolio performance function.

Lastly, by assuming a risk-free rate of 3% for the US treasuries and using the portfolio standard deviation calculated earlier, we compute the Sharpe ratio of a portfolio.

We save these three parameters along with the corresponding weights of the securities in a data frame. We repeat the above process multiple times with different set of random weights to generate different portfolios.

We can plot all these portfolio results on the efficient frontier graph to visualize our results. In the end, we identify two portfolios: one that gives us the maximum Sharpe ratio and the other that has the minimum risk and verify their performance on the test data.

To sum up, the benefits of MPT are best observed, when one creates a portfolio with assets that are negatively correlated, this increases the diversification and reduces the risk. In the next unit, we will learn how to calculate the variance-covariance matrix in detail.

You can get the expected risk of the portoflio you choose by using the selected weights as per you criterion and then checking its standard deviation on the test or validation data.

• Nice post but doesn't really answer the question. – LocalVolatility Jan 25 at 10:49