# Thread: maximizing a ratio of mean/standard error

1. ## maximizing a ratio of mean/standard error

I have a weighted sum:

weighted sum = w1*mu1 + (1-w1)*mu2

with

variance weighted sum = (w1^2)*var1 + ((1-w1)^2)*var2 + 2*w1*(1-w1)*cov

where

mu1 = mean 1; mu2 = mean 2; var1 = variance for mean 1; var2 = variance for mean 2; cov = covariance; w1 = weight.

My objective is to compute the value of w1 that provides the highest absolute abratio

(w1*mu1 + (1-w1)*mu2)/ sqrt((w1^2)*var1 + ((1-w1)^2)*var2 + 2*w1*(1-w1)*cov)

which is actually a Z statistic.

It is possible to take the derivative and to obtain an equation that finds the critical point assuming that w1 may assume any value. However, Is it possible to obtain an equation that maximizes the absolute ratio (weighted sum)/sqrt(variance_weighted_sum) limiting the possible values of w1 between 0 and 1 or between 0 and 2?

Actually, I would like an advice to know if this is feasible using derivatives, or if it is only possible via non-linear programming.

I will be very grateful for any help.

2. There may be a fancy way but its easier to do something like this:

You already have the global turning points from the derivative you mention. if there is no turning point within the range [0,1] or [0,2], then the maximal point must be at one of the boundaries. Compute the value at each boundary and pick the largest.

If there are turning points within the range then the maximum is either at the turning point or the boundaries, follow the same proceedure.

3. Thank you very much! Yes, definitely, it is a fast alternative. Nice tip!