[Math] How to normalize a percent to a value while still deriving results from the percent

linear algebra

My math skills are rusty(at best) and I was wondering if I could pick people's here brains on trying to figure out how to approach what I'm doing. My problem is a bit domain specific so I found a proxy problem that matches perfectly and hopefully is simpler to explain(just excuse any inaccuraties related to investing).

Say you have all the prices of all the stocks in the stock market, the percent change and your trying to research a specific return target(in percent). I then try to see how much percent of each stock returns equal the target percent. It works okay because each item is bound by 100(%) but because its alot of data I'm trying to see if there's a way to do it based on a value and not percent(say no stock can equal more than 50% of my basket of stocks then I cut processing down by half). I'm not sure how to convert the percent to value and get the same results.

Here's a example:
stock market contains stocks with these returns: 10%,15%,30%, dollar values of 10,5,2(respectively), and we want to find all the ways to get 1% return.

10 * .10 = 1
10 * .07 + 15 * .02 = 1
10 * .04 + 15 * .04 = 1
10 * .01 + 15 * .06 = 1
10 * .07 + 30 * .01 = 1
10 * .04 + 15 * .02 + 30 * .01 = 1
10 * .01 + 15 * .04 + 30 * .01 = 1
10 * .04 + 30 * .02 = 1
10 * .01 + 15 * .02 + 30 * .02 = 1
10 * .01 + 30 * .03 = 1

This is a bad example because the highest percent of the value is .10 but it can go up to 100%. We would then take the percent of the returns(second column) and multiple it against the value of the stocks and figure out the weight of each stock in our basket. In our actual problem it seems to give the results we want but processing time is crazy when maybe we want no stock to exceed 10% but we have no way of knowing how much 10% of our basket will be without converting the above method into an actual basket.

Here's how the conversation part works(sorry copying from excel, might look ugly).

    percent weight  value weight    weight overall
a   10.00%          1           100.00%
b           
c           
total               1           100.00%

    percent weight  value weight    weight overall
a   1.00%           0.1         41.67%
b   2.00%           0.1         41.67%
c   2.00%           0.04        16.67%
total               0.24        100.00%

Just to recap, steps are:

  1. figure out how much percent of returns are needed to meet target percent
  2. convert percent of percent returns to actual values by multiplying against actual values
  3. using actual values figure out weight and discard ones that exceed our specific threshold

Is it possible to somehow normalize the initial return & target percent so I can derive the same result but from the value itself without having to go through the 100 possibles per item(100%) when we may really only care about a 20% threshold per value of item? Doing it the current way does not seem possible since what its saying its 'you need x% of this stocks return' and then we have to convert to see how much that equals to in a basket. As I mentioned above, we are checking AFTER which to me is a waste of cpu power, I want to see if we can know before hand and not pursue results that we don't need.

I hope I explained it correctly but if there's any confusion please let me know.
Thanks!

p.s. for the last two days I've been in python/excel trying to figure this out, my idea was to take the percents and multiply them against a base value(say 100) and try to convert it to the value but I'm having trouble because the above calculation are derived from percents of returns and target. I haven't had any success. There's a few problems with converting, how can I get the same results if I do not know the total in advance(when converting, I'm multiplying my new generated percent against the values then weighting the sum to get the individual weights)?

Best Answer

I see this more as a combinatorial problem. First you have to look at all the ways you can take subsets from the percent list. Then you need to find out if for that combination will have a linear combination that gives you the required percentage. That depends on what percentage you specific for the right hand side of the equation. Then for each one that has a solution say for example the fixed percentages are a and b that are weighted to get c. Let x and y be weights that give a solution. Then ax+by=c (1). All that you require is that the weights x and y satisfy x>0 and y>0 and satisfy (1). Then to get another solution using just a and b you need az+bw=c (2) with z>0 and w>0. Let z=x+d and w=y+v. We can express (2) as a(x+d) + b (y+v) =c. Algebraically this says ax+ad+by+bv=c and substiuting the right hand side of (1) into this equation we get c+ad+bv=c or ad+bv=0 or ad/b=-v (3). So any z>0 w>0 that satisfies (3) works. But z>0 just means x>-d and w>0 means y>-v=ad/b (4). This can be achieved in infinitely many ways. For example take a=20% and b=10% and c=40%. Then x=1 and y=2 is a solution. Also substituting 2 for a/b in 4 gives y=2>-2d and x=1>-d. So all that is required is that 1>-d or d>-1. So all real values of d larger than -1 will work with the choice of d implying that v=-2d<2. The way you seem to envison the solution is a finite list of possibilities based on your illistration. But that is not the case. To enumerate all the possibilities you need to find 1 solution for each subset of percentages from the percentage list and then use the constraints for each as I have specified above in the example of a=20%, b=10% and c=40%. I see no way to simplify this process.

Related Question