Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to find maximum likelihood estimates of parameters for a fairly complicated multivariate distribution. The support of the distribution depends on its parameters so I need to include some constraints in NMaximize. The following is a simplified version of the problem.

Consider the following code which generates 1000 observations from a Max Stable distribution and estimates the parameters:

data = RandomReal[MaxStableDistribution[0, 1, 1], 10^3];
pars = FindDistributionParameters[data, MaxStableDistribution[μ, σ, ξ]]
(* {μ -> -0.0296428, σ -> 0.946788, ξ -> 0.945316} *)

Suppose now we want to find these estimates using NMaximize. Let's assume that $\gamma\ne 0$ so I just need to include the constraint $\frac{\gamma (x-\mu )}{\sigma }+1>0$ in the log likelihood function where the PDF is given by the following:


G[x_] = PDF[MaxStableDistribution[μ, σ, γ], x] // 
FullSimplify[#, γ != 0 && 1 + (γ (x - μ))/σ > 0] &

I have tried to include the constraint $\frac{\gamma (x-\mu )}{\sigma }+1>0$ in the definition of G by using Boole to no avail. I should add that even without that constraint Nmaximize does not return a result:

NMaximize[{Total[Log[G[data]]], σ > 0, γ != 0}, {μ, σ, γ}]

Any suggestions on how to do this would be gratefully appreciated.

share|improve this question

Here is a way that could give the same answer as FindDistributionParameters, however I further assume that γ>0. Please see the code below:

LG[x_] = Log[
          G[x]] /. {σ -> Exp[s], γ -> Exp[t]} //. {Log[
                 Times[x__, y_]] :> Log[x] + Log[y], Log[x_^y_] :> y Log[x]}

NMaximize[{Total[LG[data]], μ < Min[data] + Exp[s - t]}, {μ, s, t},
           Method -> "RandomSearch"]
share|improve this answer
Many thanks @Hsien-Ching Kao. That is a nice solution. I guess one could use the same idea and estimate $|\gamma|$ for the case $\gamma<0$ but I have not tried it yet. – Mikael Anderson Jun 22 '14 at 23:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.