MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with NMaximize

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90067] Re: Problem with NMaximize
  • From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
  • Date: Fri, 27 Jun 2008 06:20:49 -0400 (EDT)
  • References: <g3vkvi$kio$1@smc.vnet.net> <4863CA88.5040100@gmail.com>

On Fri, Jun 27, 2008 at 1:13 AM, DrMajorBob <drmajorbob at att.net> wrote:
> For instance,
>
> likelihood1[t1_?NumberQ, t2_?NumberQ, t3_?NumberQ, t4_?NumberQ,
>   t5_?NumberQ, t6_?NumberQ, t7_?NumberQ, t8_?NumberQ, t9_?NumberQ,
>   t10_?NumberQ, t11_?NumberQ, t12_?NumberQ] =
>  0.00001712341312000713` t1 + 5.648647024829866`*^-6 t10 +
>   8.90597537441381`*^-6 t11 + 1.9727284288726167`*^-6 t12 +
>   4.102725237468317`*^-6 t2 + 3.7864902508468615`*^-6 t3 +
>   9.215772325326653`*^-7 t4 + 0.000057161484895917856` t5 +
>   0.000012892953334779516` t6 + 8.646320198720343`*^-6 t7 +
>   5.877910295858781`*^-6 t8 + 1.6837835562631724`*^-6 t9;
> Sort@Cases[%, a_ b_Real :> {b, a}, 1]
>
> {{9.21577*10^-7, t4}, {1.68378*10^-6, t9}, {1.97273*10^-6,
>  t12}, {3.78649*10^-6, t3}, {4.10273*10^-6, t2}, {5.64865*10^-6,
>  t10}, {5.87791*10^-6, t8}, {8.64632*10^-6, t7}, {8.90598*10^-6,
>  t11}, {0.000012893, t6}, {0.0000171234, t1}, {0.0000571615, t5}}
>
> NMaximize[{likelihood1[t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11,
>   t12], t1 > 0, t2 > 0, t3 > 0, t4 > 0, t5 > 0, t6 > 0, t7 > 0,
>  t8 > 0, t9 > 0, t10 > 0, t11 > 0, t12 > 0,
>  t1 + t10 + t11 + t12 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 ==
>   1}, {t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12}]
>
> {0.0000571615, {t1 -> -2.73483*10^-8, t10 -> 0., t11 -> 0., t12 -> 0.,
>   t2 -> 0., t3 -> 0., t4 -> 0., t5 -> 1., t6 -> 0., t7 -> 0.,
>  t8 -> 0., t9 -> 0.}}
>
> Notice the only non-zero t value, t5, is the one with the largest
> coefficient.
>
> And that figures, doesn't it?

<snip>

Drawing from Bobby's explanatons, I would add that you can find a
local maximum (close to the global maximum) for which the parameters
satisfy all the constraints, yet you can see that t5 is close to 1 and
at least an order of magnitude greater than any other parameters.

In[2]:= sol =
 FindMaximum[{likelihood1[t1, t2, t3, t4, t5, t6, t7, t8, t9, t10,
    t11, t12], t1 > 0, t2 > 0, t3 > 0, t4 > 0, t5 > 0, t6 > 0, t7 > 0,
    t8 > 0, t9 > 0, t10 > 0, t11 > 0, t12 > 0,
   t1 + t10 + t11 + t12 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 ==
    1}, {t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12}]

Out[2]= {0.000047307, {t1 -> 0.0233378, t2 -> 0.0167254,
  t3 -> 0.0166094, t4 -> 0.0156258, t5 -> 0.803145, t6 -> 0.020707,
  t7 -> 0.0185804, t8 -> 0.0174061, t9 -> 0.0158763, t10 -> 0.0173152,
   t11 -> 0.0186984, t12 -> 0.0159734}}

In[3]:= Positive@sol[[2, All, 2]]

Out[3]= {True, True, True, True, True, True, True, True, True, True, \
True, True}

In[4]:= Plus @@ sol[[2, All, 2]]

Out[4]= 1.

If we try the various method available for  NMaximize, we consistently
get the same results for the globa maximum and the parameters.

In[5]:= NMaximize[{likelihood1[t1, t2, t3, t4, t5, t6, t7, t8, t9,
     t10, t11, t12], t1 > 0, t2 > 0, t3 > 0, t4 > 0, t5 > 0, t6 > 0,
    t7 > 0, t8 > 0, t9 > 0, t10 > 0, t11 > 0, t12 > 0,
    t1 + t10 + t11 + t12 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 ==
     1}, {t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12},
   Method -> #] & /@ { "NelderMead", "DifferentialEvolution",
  "SimulatedAnnealing", "RandomSearch"}

During evaluation of In[5]:= NMaximize::cvmit: Failed to converge to \
the requested accuracy or precision within 100 iterations. >>

(* Note that increasing the WorkingPrecision does not help here. *)

Out[5]= {{0.0000571615, {t1 -> -2.62728*10^-8, t10 -> 0., t11 -> 0.,
   t12 -> 0., t2 -> 0., t3 -> 0., t4 -> 0., t5 -> 1., t6 -> 0.,
   t7 -> 0., t8 -> 0.,
   t9 -> 0.}}, {0.0000571615, {t1 -> -2.73483*10^-8, t10 -> 0.,
   t11 -> 0., t12 -> 0., t2 -> 0., t3 -> 0., t4 -> 0., t5 -> 1.,
   t6 -> 0., t7 -> 0., t8 -> 0.,
   t9 -> 0.}}, {0.0000571615, {t1 -> -2.73483*10^-8, t10 -> 0.,
   t11 -> 0., t12 -> 0., t2 -> 0., t3 -> 0., t4 -> 0., t5 -> 1.,
   t6 -> 0., t7 -> 0., t8 -> 0.,
   t9 -> 0.}}, {0.0000571615, {t1 -> -2.73492*10^-8, t10 -> 0.,
   t11 -> 0., t12 -> 0., t2 -> 0., t3 -> 0., t4 -> 0., t5 -> 1.,
   t6 -> 0., t7 -> 0., t8 -> 0., t9 -> 0.}}}

Finally, if we try Maximize, we do not get any different results from
above (t5 dwarfs any other parameters).

In[6]:= Maximize[{0.00001712341312000713` t1 +
   5.648647024829866`*^-6 t10 + 8.90597537441381`*^-6 t11 +
   1.9727284288726167`*^-6 t12 + 4.102725237468317`*^-6 t2 +
   3.7864902508468615`*^-6 t3 + 9.215772325326653`*^-7 t4 +
   0.000057161484895917856` t5 + 0.000012892953334779516` t6 +
   8.646320198720343`*^-6 t7 + 5.877910295858781`*^-6 t8 +
   1.6837835562631724`*^-6 t9, t1 > 0, t2 > 0, t3 > 0, t4 > 0, t5 > 0,
   t6 > 0, t7 > 0, t8 > 0, t9 > 0, t10 > 0, t11 > 0, t12 > 0,
  t1 + t10 + t11 + t12 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 ==
   1}, {t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12}]

Out[6]= {0.0000571615, {t1 -> 0., t10 -> 0., t11 -> 0., t12 -> 0.,
  t2 -> 0., t3 -> 0., t4 -> 0., t5 -> 1., t6 -> 0., t7 -> 0.,
  t8 -> 0., t9 -> 0.}}

Regards,
-- 
Jean-Marc


  • Prev by Date: Re: Problem with NMaximize
  • Next by Date: Re: Problem with NMaximize
  • Previous by thread: Re: Re: Problem with NMaximize
  • Next by thread: Re: Problem with NMaximize