RE: random generation of constrained portfolio allocation weights

Posted by Ferdinando Ametrano-3 on
URL: http://quantlib.414.s1.nabble.com/random-generation-of-constrained-portfolio-allocation-weights-tp3309p3320.html

Hi Matt,

>Using your [0-40] example:
>1. Random first number 20-40.  Has to be at least 20 otherwise no viable
>solution.
>2.  Next random number to give a sum of at least 60, so the last number
>may be valid (it has to be <= 40).  That is, if the first number is 35,
>then the second number must be [25-40] to make a viable triple.
>3.  Obviously, the third number is 100 - sum of the first two.

thank you for your suggestion, it pointed out my error. While I realized
that I had to correct the input constraints so to make minima and maxima
each other "compatible" before start drawing the weights, I was missing to
update the constraints dynamically conditional to the previous weights, as
you do in step 2.

Now the algorithm seems to work and I've created the example spreadsheet
AAconstrained.xls which implements it for 4 assets (MC dimension 3). This
spreadsheet along with the following other examples can be downloaded from
http://quantlib.org/RandomWeights.zip

Anyway I still have some doubts.

If you look at AAconstrained.xls you will see that row statistics applied
to the random weights are reasonable: the observed minimum and maximum are
correct, and the average is in the middle as one might expect.

Then if you apply the same algorithm to unconstrained random weights things
look worse. Take a look at AAunconstrained.xls: the average for the four
assets is not equal, but decreasing with the asset number. This looks very
suspicious to me.

I get a confirmation about my doubts if I go back to my "vanilla" algorithm
for unconstrained weights (MC dimension 4): draw a 4-element sequence and
normalize it.
Take a look at AAunconstrained2.xls: the statistics for the "vanilla"
algorithm seems more reasonable. The average for each asset is always 25%
(as I might expect for a 4 assets problem), the minima reach down to zero,
while the maxima reach up toward 100% as I increase the number of draws.

Why your constrained algorithm seems to perform poorly in the unconstrained
case? I know I'm probably missing some key point here, and would love to be
enlightened.

ciao -- Nando

PS just in case one wonders: in the spreadsheets I'm using (2^10)-1=4095
draws from a Sobol sequence of dimension 3 or 4