Exercise

# Imposing weight constraints

Investors are often constrained by the maximum values allowed for the portfolio weights. These constraints can actually be an advantage. The advantage of a maximum weight constraint is that the subsequent portfolio will be less concentrated in certain assets. There is a disadvantage to this, though. The disadvantage is that the same target return may no longer be possible or will be obtained at the expense of higher volatility.

Remember from the previous exercise that the function `portfolio.optim()`

allows you to set weight constraints within the
`reshigh`

argument. `reshigh`

requires a vector of maximum weights for each asset.

In this exercise, you will create three portfolios with different maximum weight constraints. For this exercise, it is important to know the output of the `portfolio.optim()`

function. This function creates a list containing four components: (i) `$pw`

: the portfolio weights, (ii) `$px`

: the returns of the overall portfolio, (iii) `$pm`

: the expected return portfolio, (iv) `$ps`

: the standard deviation of the portfolio returns.

Instructions

**100 XP**

- Create three vectors of maximum weights for each asset (column) in
`returns`

using the`rep()`

function. The first vector will contain maximum weights of 100%, the second 10%, and the third 5%. Call these`max_weights1`

,`max_weights2`

,`max_weights3`

, respectively. - Create an optimum portfolio with maximum weights of 100% called
`opt1`

. - Create an optimum portfolio with maximum weights of 10% called
`opt2`

. - Create an optimum portfolio with maximum weights of 5% called
`opt3`

. - Calculate how many assets have a weight that is greater than 1% for each portfolio. Access weights by using
`$pw`

after the portfolio name. - Print the volatilities (standard deviations
`$ps`

) of the three portfolios you created.