MathGroup Archive 2004

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

Search the Archive

Re: Maximum Problem


Here is an example for a normal distribution

Needs["Statistics`NormalDistribution`"];

randData = RandomArray[NormalDistribution[5, 2], {150}];

The log likelihood function is

llf = Simplify[
      Plus @@ (Log[PDF[NormalDistribution[m,s],#]]& /@ randData), {Element[{m,
            s}, Reals],s>0}];

You can use NSolve

Select[
    NSolve[{D[llf,m]==0,D[llf,s]==0}, {m,s}],
    (s /. #) >0&]//Flatten

{m -> 4.72103, s -> 1.94323}

Or FindRoot

FindRoot[{D[llf,m]==0,
    D[llf,s]==0}, {{m,Mean[randData]}, {s,StandardDeviation[randData]}}]

{m -> 4.72103, s -> 1.94323}


Bob Hanlon

In article <c0fsdd$c2t$1 at smc.vnet.net>, sabrinacasagrande at hotmail.com (sabbri)
wrote:

<< 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]??


  • Prev by Date: Re: dvips complaint regarding Mathematica 5.0 eps graphics
  • Next by Date: Re: Maximize function question
  • Previous by thread: Re: Solution[[1,1,2]] Brackets
  • Next by thread: Re: Maximum Problem