< Return to Video

Sharpe Ratio Maximization with Excel Solver

  • 0:01 - 0:03
    Narrator: Hello everyone.
  • 0:03 - 0:12
    In a previous video we used this data set here to maximize the sharp ratio with respect to weights.
  • 0:13 - 0:17
    We used some matrix operations in Excel to do that.
  • 0:17 - 0:24
    In this video we are going to use the same data set and arrive at the same result
  • 0:24 - 0:29
    as the previous video by using the solver add-in in Excel.
  • 0:29 - 0:34
    First we are going to do it by assuming that short sales are allowed
  • 0:34 - 0:40
    which means that one or more portfolio weights can be negative.
  • 0:40 - 0:45
    Then we will resolve by assuming that no short sales are allowed,
  • 0:45 - 0:52
    which implies that all portfolio weights must be greater than or equal to zero
  • 0:52 - 0:55
    so let us have a look at the data set one more time.
  • 0:55 - 0:57
    We have information about these three companies,
  • 0:57 - 1:01
    Homestake Mining, Kaiser Aluminum, and Texas Instruments.
  • 1:01 - 1:04
    Their excess returns are provided in this column,
  • 1:04 - 1:08
    the variance of their returns are provided in this column,
  • 1:08 - 1:14
    and this column here, these three cells give us the covariances between the three assets.
  • 1:14 - 1:18
    We also have an additional column for weights here at this time
  • 1:18 - 1:21
    and I have prefilled some random values into these cells,
  • 1:21 - 1:28
    0 for Homestake MIning which we are going to call our asset 1,
  • 1:28 - 1:32
    0 for Kaiser Aluminum which we are going to call our asset 2,
  • 1:32 - 1:38
    and 1 for Texas Instruments which we are going to call asset 3.
  • 1:39 - 1:48
    In this cell I have taken the sum of the above three values to check that the sum of weights is equal to 1.
  • 1:50 - 1:56
    What we are going to do now is to prepare a bordered variance covariance matrix.
  • 1:56 - 2:01
    I'm not going to talk too much about the bordered variance covariance matrix in this video
  • 2:01 - 2:05
    because I've covered it in our previous one
  • 2:05 - 2:11
    so if you want a reference you can watch the previous video on portfolio variance
  • 2:11 - 2:16
    and see how a bordered variance covariance matrix is prepared
  • 2:16 - 2:20
    and the variance is calculated in Excel.
  • 2:21 - 2:25
    So what I'm going to start with now here is to write the top border here
  • 2:25 - 2:31
    in these three cells and the left border in these three cells.
  • 2:32 - 2:38
    For the top border in this cell I'm going to write my W1,
  • 2:38 - 2:43
    that is the weight on my first asset which is this cell here F3
  • 2:43 - 2:45
    so I'm going to write here F3.
  • 2:48 - 2:54
    Then here in this cell I'm writing F2 which is the second weight here.
  • 2:54 - 2:58
    Pardon me, not F2, it's going to be F4...
  • 3:00 - 3:02
    so this is done
  • 3:04 - 3:12
    and in this cell I'm going to write the third weight which occurs in this cell here F5.
  • 3:12 - 3:16
    I'm going to do the same thing on the left border.
  • 3:16 - 3:27
    Weight 1, then weight 2, and then weight 3.
  • 3:28 - 3:33
    Inside these borders we are going to write our variance covariance matrix
  • 3:33 - 3:36
    so let me fill it out quickly.
  • 3:36 - 3:41
    On the diagonal elements first I'm going to write the variances of returns of the assets,
  • 3:41 - 3:48
    .1 for the first one, .4 for the second one, and .7 for the third one.
  • 3:49 - 3:52
    The rest of the cells are the covariances.
  • 3:52 - 3:59
    This cell here is the covariance between 1 and 2, which is minus .1
  • 3:59 - 4:04
    then in this cell we have covariance between 1 and 3 which is 0.
  • 4:04 - 4:09
    Here in this cell we have covariance of 2 and 1 which is minus .1
  • 4:09 - 4:15
    and in this cell we have covariance between 2 and 3 which is .3.
  • 4:15 - 4:20
    The last row now covariance between 3 and 1 is 0.
  • 4:20 - 4:23
    Covariance between 3 and 2 is .3
  • 4:23 - 4:30
    so we have our bordered variance covariance matrix ready so let me make this one bold
  • 4:30 - 4:34
    so that you know that these are the borders.
  • 4:36 - 4:41
    Now what I'm going to do is to use the sum product function in here
  • 4:41 - 4:45
    to do the operation that we covered in a previous video.
  • 4:45 - 4:49
    This cell multiplied by this cell multiplied by this cell
  • 4:49 - 4:54
    plus this cell multiplied by this cell multiplied by this cell
  • 4:54 - 4:59
    and then this cell multiplied by this cell and multiplied by this cell.
  • 4:59 - 5:12
    So what I'm going to write here is cell number B9 times sum product of these two arrays.
  • 5:12 - 5:17
    This is my first array and this is my second array.
  • 5:17 - 5:22
    Close brackets hit enter and I see a value of zero here.
  • 5:22 - 5:27
    I have to do the same operation for this column too and for this column too
  • 5:27 - 5:32
    but in doing those operations I have to keep this reference the same.
  • 5:32 - 5:35
    So since I've already done it once here I can just drag the formula for
  • 5:35 - 5:38
    the other two cells but because I want to keep this reference
  • 5:38 - 5:44
    the same I can make a slight adjustment here.
  • 5:44 - 5:51
    With letter a on either side of that letter I can write a dollar sign
  • 5:51 - 5:57
    so that cell's A10 to A12 do not change.
  • 5:57 - 6:00
    The reference remains the same, this one,
  • 6:00 - 6:06
    and then I can drag and drop the formula in the other two cells as well.
  • 6:07 - 6:15
    I want to calculate my mean of the average portfolio return here so let us do that.
  • 6:16 - 6:22
    I can do that here by using again the sum product function.
  • 6:23 - 6:27
    The first array is going to be my weight vector
  • 6:27 - 6:33
    and the second array is going to be my excess return vector.
  • 6:34 - 6:41
    So this is my mean return or average return at the moment with these portfolio weights.
  • 6:41 - 6:44
    Now I need to compute the variance.
  • 6:44 - 6:52
    The variance, I've already set up the bordered covariance variance covariance matrix
  • 6:52 - 6:59
    and I can use now the sum of these three values here to find my variance
  • 6:59 - 7:10
    so I can just say sum and these three numbers here so this gives me my variance at the moment.
  • 7:10 - 7:19
    I can also calculate the standard deviation by taking the square root of this variance here
  • 7:20 - 7:25
    and I can calculate the sharp ratio also very easily by dividing the mean
  • 7:25 - 7:34
    excess return by the standard deviation of this portfolio so this is my sharp ratio at the moment
  • 7:35 - 7:39
    which may not be optimum because we don't have the optimum weights as yet.
  • 7:39 - 7:43
    These are just random weights that we entered.
  • 7:43 - 7:48
    What we are going to do now is to break, is to go to the data tab
  • 7:48 - 7:51
    and invoke the solver by clicking on it.
  • 7:53 - 7:57
    So now we have to provide the parameters to the solver.
  • 7:57 - 8:02
    Our target cell is going to be the sharp ratio
  • 8:02 - 8:09
    and we want to maximize it so here the correct option is already checked,
  • 8:09 - 8:12
    the maximization option.
  • 8:13 - 8:21
    And we want to maximize the sharp ratio by changing our weights so here Excel is asking
  • 8:21 - 8:23
    us by changing weight cells.
  • 8:24 - 8:29
    We know that we want to change our weights to maximize the sharp ratio
  • 8:29 - 8:35
    and the weights are here so we can select this portion here, these three cells.
  • 8:35 - 8:41
    We also have a constraint that the sum of weights must be equal to one
  • 8:41 - 8:45
    so we can add the constraint here, this is the constraint box
  • 8:45 - 8:56
    so we click add and then we want to tell excel that this cell F6 must always be equal to one
  • 8:56 - 9:01
    so we write here 1 and we click OK.
  • 9:02 - 9:08
    We are now to click the solve button and we should get our desired result.
  • 9:08 - 9:10
    Let us see.
  • 9:10 - 9:16
    Now we see it says solver found a solution and all constraints and optimality conditions
  • 9:16 - 9:21
    are satisfied, let's click OK and look at these weights.
  • 9:21 - 9:25
    52.9% money in the first asset.
  • 9:26 - 9:34
    This asset probably should be short sold and another 52.9% money in the third asset.
  • 9:34 - 9:42
    This is going to give us the maximum sharp ratio in this case for this portfolio of .3924
  • 9:42 - 9:50
    with a mean return of .1812 and a standard deviation of .4617.
  • 9:50 - 9:56
    These are the same results that we arrived at in the previous video.
  • 9:57 - 10:01
    Now let us change the scenario a little bit.
  • 10:01 - 10:06
    In this situation what we are saying is that, what we're observing is that
  • 10:06 - 10:12
    this weight here is a negative weight
  • 10:12 - 10:17
    which means that we have to short sell this asset.
  • 10:17 - 10:26
    But not all countries, not all nations, not all markets especially the markets which have not yet
  • 10:26 - 10:34
    developed so much, they don't allow short sales so if we don't have the provision for
  • 10:34 - 10:43
    short sales in a particular capital market then we still need to find the optimum portfolio weights.
  • 10:43 - 10:47
    We are going to have some additional constraints then.
  • 10:47 - 10:50
    Let us invoke the solver once again.
  • 10:51 - 10:56
    This is our previous data entered into the solver but we are going to have
  • 10:56 - 11:01
    to provide some additional parameters to solver.
  • 11:01 - 11:04
    What we want to tell the solver...
  • 11:04 - 11:11
    We want to tell solver that none of these portfolio weights should be below zero,
  • 11:11 - 11:15
    that is all of them should be either equal to or greater than zero
  • 11:15 - 11:19
    because no short selling is allowed.
  • 11:19 - 11:27
    So this cell here, F3 which is weight one should be greater than or equal to zero.
  • 11:27 - 11:31
    This is another constraint that we have now.
  • 11:32 - 11:38
    Likewise we can add the other two constraints for the other two weights.
  • 11:39 - 11:47
    Cell F4 which is weight two is also not allowed to go below zero so that also must be
  • 11:47 - 11:50
    equal to or greater than zero
  • 11:52 - 11:57
    and the same thing we are going to do with the third asset and its weight.
  • 11:57 - 12:03
    This item here should be greater than or equal to zero
  • 12:03 - 12:10
    so we have added no short selling constraints here and we click solve.
  • 12:11 - 12:15
    Again we see this message solver found a solution and all constraints
  • 12:15 - 12:18
    and optimality conditions are satisfied.
  • 12:18 - 12:23
    Click OK to get rid of this dialogue and let us see.
  • 12:23 - 12:31
    What it is telling us now is that 53.85% of our money should be invested in the first asset.
  • 12:31 - 12:38
    We should not invest anything in Kaiser Aluminum and 46.15% of the money
  • 12:38 - 12:42
    should be allocated to Texas Instruments.
  • 12:42 - 12:50
    And in this column we see that our result is correct because the sum of all weights is still one.
  • 12:50 - 12:53
    What affect does this have on the sharp ratio?
  • 12:53 - 12:58
    The sharp ratio has now changed to .3919.
  • 12:58 - 13:05
    You also see that the mean return has fallen a little bit from 181176 to .1654
  • 13:05 - 13:13
    and the standard deviation has risen a little bit to .42
  • 13:13 - 13:15
    or it might have fallen, I don't remember
  • 13:15 - 13:19
    actually the previous standard deviation that we got.
  • 13:19 - 13:24
    You can rewind the video and see what was the previous standard deviation
  • 13:24 - 13:26
    but I have, I do have a recollection of the mean value.
  • 13:26 - 13:31
    It was .18 so the mean has definitely fallen.
  • 13:33 - 13:36
    This is all I wanted to tell you in this video.
  • 13:36 - 13:42
    In the next one we are going to try to arrive at the same result using the solver add-in
  • 13:42 - 13:48
    but in that video we are going to use the Markowitz Scheme
  • 13:48 - 13:53
    for minimizing the risk subject to a given level of return.
  • 13:53 -
    See you next time.
Title:
Sharpe Ratio Maximization with Excel Solver
Description:

This video demonstrates the use of Excel Solver to arrive at portfolio weights that maximize the Sharpe Ratio

more » « less
Video Language:
English
Duration:
13:55

English subtitles

Incomplete

Revisions