I have an original set of weights for a portfolio and need to generate new weights that don't deviate more than 2% from the original data. The new absolute weights (original weights + new increment) must sum to one and the absolute weights must also be larger than 0 (i.e it is a long only portfolio)
- I used runif(n=40, -0.02, 0.02) to generate my active weights
- I added the active weights to the original weights to get the new absolute weights
- I then calculated the sum of all the weights and divided every individual weight by the sum in order to get all the weights to sum to 1.
- I then take any new absolute weights that are smaller than zero and redistribute the excess "negative weight" between the positive weights
But the problem with this is that now my active weights get enlarged by getting my absolute weights to sum to 1 and then they are outside the [-0.02,0.02] active weight bounds.
Is there any way I can get my weights to sum to unity as well as making sure my active weights stay within the boundries and my portfolio only has absolute weights that are larger than zero.
Any suggestions will be appreciated!