1
$\begingroup$

If I input:

data = RandomVariate[ProbabilityDistribution[x/8, {x, 0, 4}], 10];
{EstimatedDistribution[data, ProbabilityDistribution[x/8, {x, 0, θ}],
  ParameterEstimator -> "MaximumLikelihood"], data}

Mathematica returns:

{ProbabilityDistribution[\[FormalX]/
  8, {\[FormalX], 0, 4.99291}], {3.8921, 2.93817, 2.07761, 1.12473, 
  3.96292, 1.20091, 2.86696, 1.52381, 2.43073, 3.13515}}

I think the mle for a sample from this distribution is the maximum of the sample. What is Mathematica computing here? In other words, why is Mathematica returning 4.99291?

From a comment:

I just now restarted Mathematica and I am getting the same bad results. I am using version 9.

$\endgroup$
5
  • 1
    $\begingroup$ I cannot reproduce the problem. On the data shown, which lack significant digits, I get ProbabilityDistribution[\[FormalX]/8, {\[FormalX], 0, 3.96292}]. $\endgroup$
    – Michael E2
    Commented Feb 16, 2019 at 18:26
  • $\begingroup$ In v11.3 Options[EstimatedDistribution, ParameterEstimator] evaluates to {ParameterEstimator -> "MaximumLikelihood"}, If also the case for your version, it is unnecessary to specify that option. Also, for 200 trials, And @@ Table[ data = RandomVariate[ProbabilityDistribution[x/8, {x, 0, 4}], 10]; EstimatedDistribution[data, ProbabilityDistribution[x/8, {x, 0, \[Theta]}]][[-1, -1]] == Max@data, {200}] evaluated to True. Problem must be version specific. $\endgroup$
    – Bob Hanlon
    Commented Feb 16, 2019 at 19:37
  • 3
    $\begingroup$ I think the question is confused. If the pdf is $f = x/8$, then the domain of support must be $(0,4)$ in order for the pdf to be well-defined. There is NO unknown parameter to this distribution. What do you propose to find the MLE of? There is nothing to estimate. $\endgroup$
    – wolfies
    Commented Feb 17, 2019 at 2:56
  • $\begingroup$ @wolfies. Yes thank you. You are right. The question is bad. I am trying to estimate $\theta$ in a random sample with pdf $2x/\theta^2$ with $0<x<\theta$. The mle is the max of the sample. Mathematica takes : dist = ProbabilityDistribution[ 2 x/[Theta]^2, {x, 0, [Theta]}]; EstimatedDistribution[{1, 2, 3, 4, 5}, dist] and returns ProbabilityDistribution[0.0987654 [FormalX], {[FormalX], 0, 4.5}] with a note saying this might not be a max. $\endgroup$ Commented Feb 17, 2019 at 17:18
  • 1
    $\begingroup$ The 0.987654 is, of course, 2/4.5^2. I suspect that what you'd like Mathematica to give is a symbolic answer: Max[data]. But I don't know if that's possible. Even if one doesn't know that the answer is Max[data], one does know that theta >= Max[data] so the following will work: FindMaximum[{LogLikelihood[dist, data], Theta >= Max[data]}, Theta]. $\endgroup$
    – JimB
    Commented Feb 17, 2019 at 20:12

2 Answers 2

1
$\begingroup$

The log-likelihood of the OP's (non-normalized) distribution is piecewise constant, so any value for θ that occurs in a certain interval is "correct," at least from the point of view of maximizing the expression returned by LogLikelihood[]. As @wolfies points out, the distribution is not valid, so while Mathematica is willing to compute with it, it's unclear what the meaning of the result is from a probability/statistics point of view.

While V11.3 and V9 return different answers, both are equally correct. One might quibble that in V11.3, EstimatedDistribution has been reprogrammed to return the boundary value 3.96292 in the piecewise log-likelihood function, which is technically not in the open interval over which the function attains its maximum. In V9, my guess is that the initial estimate for θ is greater than 3.96292, where the Jacobian is zero and the search stops.

data = {3.8921`, 2.93817`, 2.07761`, 1.12473`, 3.96292`, 1.20091`, 
   2.86696`, 1.52381`, 2.43073`, 3.13515`};
dist = ProbabilityDistribution[\[FormalX]/8, {\[FormalX], 0, θ}];

LogLikelihood[dist, data] 

Mathematica graphics

Remark. Perhaps one should be using the normalized distribution:

ProbabilityDistribution[\[FormalX]/8, {\[FormalX], 0, θ}, Method -> "Normalize"]

This does depend on a parameter θ, which could be estimated.

$\endgroup$
2
$\begingroup$

Your data has only 10 samples of random values. This can result in discrepancy between the the PDF and estimation.

You will have almost 4 for 1000 samples:

data = 
 RandomVariate[ProbabilityDistribution[x/8, {x, 0, 4}], 1000];
{EstimatedDistribution[data, ProbabilityDistribution[x/8, {x, 0, θ}], 
  ParameterEstimator -> "MaximumLikelihood"]}
(* {ProbabilityDistribution[\[FormalX]/
  8, {\[FormalX], 0, 3.99886}]} *)
$\endgroup$
3
  • $\begingroup$ I copied your code above and Mathematica returned: {ProbabilityDistribution[[FormalX]/8, {[FormalX], 0, 5.02721}]} I ran it several times and it was always around 5. $\endgroup$ Commented Feb 16, 2019 at 18:50
  • $\begingroup$ @GeoffreyCritzer You all really ought to make your results reproducible. Look up SeedRandom[]. Geoffrey, which version are you using? Have you tried restarting Mathematica? $\endgroup$
    – Michael E2
    Commented Feb 16, 2019 at 19:13
  • 1
    $\begingroup$ @ MichealE2. I just now restarted Mathematica and I am getting the same bad results. I am using version 9. $\endgroup$ Commented Feb 16, 2019 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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