0
$\begingroup$

I have a custom distribution and data as follows

 i={42, 180, 35, 392, 63, 230, 112, 281, 42, 28, 42, 120, 148, 16, 310, 28, 68, 336, 21.5, 50, 19, 30, 12, 120, 140, 170, 17, 115, 31, 21,  52, 164, 225, 225, 151, 60, 200, 46, 210, 14};
MO = ProbabilityDistribution[{"CDF",  1 - ((\[Alpha]*E^-x)/(1 - (1 - \[Alpha])*E^-x))}, {x,  0, \[Infinity]}, Assumptions -> {\[Alpha] > 0}]

i used maximum likelihood as follow

mlmo = FindDistributionParameters[i, MO, ParameterEstimator -> "MaximumLikelihood"]

and the output was as follows

{\[Alpha] -> 4.57761*10^7}

When I used loglikelihood as follow the results was as follows

LogLikelihood[MO, {42, 180, 35, 392, 63, 230, 112, 281, 42, 28, 42, 120, 148, 16, 310, 28, 68, 336, 21.5, 50, 19, 30, 12, 120, 140, 170, 17, 115, 31, 21, 52, 164, 225, 225, 151, 60, 200, 46, 210,  14}] /.  {\[Alpha] -> 4.57761*10^7}

The output was -3885.87. I used this code and wrote log likelihood manual to get parameter

bbb = Total[logpdf = (Log[PDF[MOE, i]])]
Dbal = D[bbb, \[Alpha]]
b = FindRoot[Dbal, {\[Alpha], 1}]

This the output

333

This is the loglikelihood

LogLikelihood[MOE, {42, 180, 35, 392, 63, 230, 112, 281, 42, 28, 42, 120, 148, 16,310, 28, 68, 336, 21.5, 50, 19, 30, 12, 120, 140, 170, 17, 115,  31, 21, 52, 164, 225, 225, 151, 60, 200, 46, 210, 14}] /. {\[Alpha] -> 2.2402116078266955`*^21}

The output is better: -3283.72 Now, what does the output mean? enter image description here

$\endgroup$
2
  • 2
    $\begingroup$ Is MOE the same as MO? I assume it is. Your i contains one inexact number, namely 21.5. Please replace it by the exact number 215/10. I assume you do that. I think the warnings appear because you evaluate E^x for large x such as Max[i]==392, which generates huge (!) numbers. It seems that you can avoid the warning using something like Block[{$MaxExtraPrecision=1000}, FindRoot[Dbal,{\[Alpha],1}, WorkingPrecision->1000, MaxIterations->1000]]//N. But, more generally, please check if you are on the right track, I do not know the background of this calculation. $\endgroup$
    – user293787
    Commented Aug 20, 2022 at 14:31
  • $\begingroup$ Thanks, more I wanted it really $\endgroup$
    – Ahmed
    Commented Aug 20, 2022 at 19:08

1 Answer 1

3
$\begingroup$

Edit: Added why the candidate distribution almost certainly didn't generate the observed data.

While there are numeric stability issues with estimating $\alpha$ given your data and candidate distribution, the main issue is that candidate distribution will not fit your data.

Consider the difference between the 99.5% and 0.5% quantiles (i.e., the width of the middle 99% of the data:

MO = ProbabilityDistribution[{"CDF", 1 - ((α*E^-x)/(1 - (1 - α)*E^-x))},
   {x, 0, ∞}, Assumptions -> {α > 0}];
width = Quantile[MO, 995/1000] - Quantile[MO, 5/1000]
(* -Log[(199 + α)/199] + Log[1 + 199 α] *)
(* 10.5866 *)

The limit of the width of the middle 99% of the data as $\alpha -> \infty$ is

Limit[width, α -> ∞] // N
(* 10.5866 *)

The range of your data is

Max[i] - Min[i]
(* 380 *)

380 is much, much larger than 10.5866 and it is extremely unlikely that the candidate distribution could possibly the source of the data.

Essentially your distribution is missing a scaling parameter. $x$ needs to be divided by a constant.

i = {42, 180, 35, 392, 63, 230, 112, 281, 42, 28, 42, 120, 148, 16, 
   310, 28, 68, 336, 21.5, 50, 19, 30, 12, 120, 140, 170, 17, 115, 31,
    21, 52, 164, 225, 225, 151, 60, 200, 46, 210, 14};
MO = ProbabilityDistribution[{"CDF", 1 - ((α*E^-(x/β))/(1 - (1 - α)*E^-(x/β)))}, 
  {x, 0, ∞}, Assumptions -> {α > 0, β > 0}]
mle = FindDistributionParameters[i, MO, ParameterEstimator -> "MaximumLikelihood"]
(* {α -> 1.3236, β -> 99.906} *)

Show[Histogram[i, {50}, "PDF"],
 Plot[PDF[MO /. mle, x], {x, 0, 400}]]

Histogram and fit

You might want to question whoever gave you that candidate distribution.

$\endgroup$

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.