# How to find the maximum likelihood of this scenario occurring?

I have the equation: $0= 2.01106 - 0.00274(34.647+24.24a)-0.02059(45.647+21.122b)+1.37984(2.05-0.206c)-0.01176(10.588+11.963d)+0.00394(118.29-21.097e)-0.03552(92.17+2.855f)$

I have the above equation. The letter's $a$, $b$, $c$, $d$, $e$, and f correspond to z-scores. I would like to solve this equation for the lowest sum of $a+b+c+d+e+f$.

The range of $a$ = -1.42 to 2.69, $b$ = -2.16 to 2.57, $c$ = -2.18 to 2.67, $d$ = -0.88 to 3.29, $e$ = -1.03 to 0.87, $f$ = -4.26 to 2.74.

These variables represent Z-scores. Each z-score can be used to calculate a probability of a Z-score at the level or greater occurring. For example, a Z-score of -1.1, has a p-value of an event occurring at that Z-score or higher of 0.8643. I want to multiply all of the p-values associated with Z-scores that satisfy this equation and then find the set of z-scores that has the maximum value for P(a)*P(b)*P(c)*P(d)*P(e)*P(f). How can this be done?

Your mention above "I would like to solve this equation for the lowest sum of a+b+c+d+e+f" pertained to your previous question at How to minimize the six z-scores in this linear equation and then calculate a probability? , but is not the correct objective function for the problem you are stating in this question.

Let $\Phi(x)$ denote the cumulative Normal distribution function.

Then your objective is to maximize $$(1-\Phi(a)) (1-\Phi(b)) (1-\Phi(c)) (1-\Phi(d)) (1-\Phi(e)) (1-\Phi(f))$$ Using the fact that $1-\Phi(x) = \Phi(-x)$ and taking the logarithm (which does not affect the optimal values of a,b,c,d,e,f), we arrive at the objective function $$log(\Phi(-a))+log(\Phi(-b))+log(\Phi(-c))+log(\Phi(-d))+log(\Phi(-e))+log(\Phi(-f))$$ which is to be maximized subject to the linear equality constraint on a,b,c,d,e,f and the lower and upper bound constraints on a,b,c,d,e,f.

For convenience, I chose to use CVX http://cvxr.com/cvx/, which uses an approximation log_normcdf(x) (so not exact) to $log(\Phi(x)$. Using other optimization software could eliminate this inaccuracy. CVX provides the globally optimal solution (subject to the use of approximation via log_normcdf(x)).

cvx_begin
variables a b c d e f
maximize(log_normcdf(-a)+log_normcdf(-b)+log_normcdf(-c)+log_normcdf(-d)+log_normcdf(-e)+log_normcdf(-f))
% constraints follow
-1.42 <= a <= 2.69
-2.16 <= b <= 2.57
-2.18 <= c <= 2.67
-0.88 <= d <= 3.29
-1.03 <= e <= 0.87
-4.26 <= f <= 2.74
0 == 2.01106 - 0.00274*(34.647+24.24*a)-0.02059*(45.647+21.122*b)+1.37984*(2.05-0.206*c)-0.01176*(10.588+11.963*d)+0.00394*(118.29-21.097*e)-0.03552*(92.17+2.855*f)
cvx_end


The optimal [a,b,c,d,e,f] = [ -0.8615, 1.8084, 1.0194, -0.2159, -0.7163, -0.5573]. The approximation in log_normcdf(x) has manifested itself in a discrepancy in the CVX objective function of -6.5780 (actual value) vs. -6.4742 (as calculated using the approximation during the optimization).

Exponentiating back to the original objective function (i.e., before taking log), provides the objective value 1.3906e-03.

By contrast, if we use the values of a,b,c,d,e,f instead optimized to minimize a+b+c+d+e+f subject to the constraints, the objective value per the objective function which optimally produced 1.3906e-03, produces the value 1.3599e-04, which is of course a markedly inferior solution, as should not be a surprise given that it was based on optimizing a different objective.

I leave it as an exercise to the OP to redo the optimization using "exact" values of $\Phi(x)$ or $log(\Phi(x))$.

EDIT: I have now performed the optimization using the "exact" value of the Normal cdf (but could not use CVX to do this). I obtained a slight improvement in the optimal objective value from 1.3906e-03 using the log_normcdf approximation in CVX, to 1.4036e-03 based on using the exact value of the Normal cdf. Corresponding optimal [a,b,c,d,e,f] = [ -0.8676, 1.8278, 0.9082, -0.1279, -0.6724, -0.4829], which is essentially a refinement of the solution I obtained with CVX based on the log_normcdf approximation.

• Looks great! The "a" lower threshold should be negative, but that's probably what you're fixing – Evan Aug 8 '16 at 21:29
• Yes, indeed I had originally done the optimization having lost the minus sign on the lower bound of a when copying and pasting.. That has now been corrected, and reflected in the answer. – Mark L. Stone Aug 8 '16 at 21:41