Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Running a loop for Maximizing problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75476] Running a loop for Maximizing problem
  • From: "Shafiq Ahmad" <shafiq.ahmad at rmit.edu.au>
  • Date: Wed, 2 May 2007 03:52:50 -0400 (EDT)

Hi 

I've a non linear equation (OLE) and need to solve it to get the Maximum
Likelihood values.  To do so, I tried a loop that every time the value
of b1 and b2 changes ranging from 10 to 100 with step of 10 and  get the
Maximized value for OLE.   The idea behind is to find a contour or
surface with axis such as b1=X-axis, b2=Y-axis and OLE= Zaxis

Is any one can suggest any idea? Below are the codes I tried
============================

In[173]:=
n = 20
x1 = {1.04, 1.06, 1.09, 1.05, 1.07, 1.06, 1.05, 1.1, 1.09, 1.05, 0.99,
1.06, 1.05, 1.07, 1.11, 1.04, 1.03, 1.05, 1.06, 1.04}
x2 = {115.25, 115.91, 115.05, 116.21, 115.9, 115.55, 114.98, 115.25,
116.15, 115.92, 115.75, 114.9, 116.01, 115.83, 115.29, 115.63, 115.47,
115.58, 115.72, 115.4}

pars = {b1, b2}
valsset = Table[{b1, b2}, {b1, 10, 100, 10}, {b2, 10, 100, 10}]
valsset = Flatten[valsset, 1]
rules = (MapThread[Rule, {pars, #1}] & ) /@ valsset
L/.rules

In[176]:=
OLE = n*Log[p] + n*Log[p + 1] + n*Log[b1] + n*Log[b2] + (b1 -
1)*Sum[Log[x1[[j]]], {j, 1, n}] + (b2 - 1)*Sum[Log[x2[[j]]], {j, 1, n}]
- 
   (p + 2)*Sum[Log[1 + x1[[j]]^b1 + x2[[j]]^b2], {j, 1, n}]

In[177]:=
Eqn1 = D[OLE, b1] == 0
Eqn2 = D[OLE, b2] == 0
Eqn3 = D[OLE, p] == 0
FindRoot[{Eqn1, Eqn2, Eqn3}, {b1, 10}, {b2, 10}, {p, 1}]

============================


  • Prev by Date: averaging sublists of different lengths
  • Next by Date: Re: Simplification
  • Previous by thread: Re: averaging sublists of different lengths
  • Next by thread: Re: Running a loop for Maximizing problem