Re: Maximum Problem
- To: mathgroup at smc.vnet.net
- Subject: [mg46276] Re: Maximum Problem
- From: "Curt Fischer" <crf3 at po.cwru.edu>
- Date: Fri, 13 Feb 2004 02:28:45 -0500 (EST)
- References: <c0fsdd$c2t$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"sabbri" <sabrinacasagrande at hotmail.com> wrote in message news:c0fsdd$c2t$1 at smc.vnet.net... > I have to maximize a function (the Likelihood function) in order to > obtain the estimators of two parameter (say B e S). So I think I need > to derive the function,(first respect to B, then respect to S) and > equalize the 2 derivatives to zero. In other words I give the command: > DSolve[{D[L[x,y],B]==0,D[L[x,y],S]==0},B,s] > but Mathematica doesn't run. Where do I make mistakes? Perhaps I need > to define the function L[x,y,B,S]?? I assume that by "derive" you mean "take the derivative of". In that case, yes, you need to define the functional dependence of your likelihood function on the parameters you want to fit. Also, you are taking the derivative and setting it equal to zero. You want to solve the resulting algebraic equation for the parameters. The equation does not involve the derivative of unknown functions, so you should use Solve (or perhaps FindRoot), not DSolve. In[47]:= ymodel[x_,m_,b_]:=m x + b In[48]:= ydata[x_]:=(10+Random[]) x +11 In[49]:= sse[m_,b_]:=Sum[(ymodel[x,m,b]-ydata[x])^2,{x,0,10}] In[53]:= Solve[{D[sse[m,b],b]\[Equal]0,D[sse[m,b],m]\[Equal]0},{m,b}] Out[53]= {{m -> 10.2223, b -> 13.0053}}