1
$\begingroup$

I use EasyFit to find the probability distribution of my data. It turns out the data follows BetaDistribution with 0.54022,0.70601 shape parameters and 1.33,6.83 continuous boundary parametersBeta Dist from EasyFit

I am trying to do the same distribution in Mathematica but since there is no continous boundry parameter in Mathematica BetaDistribution, I am unable to replicate the shape of the Beta Distribution. How can I get something similar to what I got in EasyFit? thanks in advance. Here is my Mathematica code:

Manipulate[
 Plot[PDF[BetaDistribution[α, β], x], {x, 1, 8}, 
  ColorFunction -> ColorData["Rainbow"], 
  Filling -> Axis], {{α, 0.54022, "α"}, 0.1, 1, 
  Appearance -> "Labeled"}, {{β, 0.70601, "β"}, 0.1, 1, 
  Appearance -> "Labeled"}]

enter image description here

$\endgroup$
2
$\begingroup$

Here's a one direct approach:

Construct a distribution that has the desired functional form:

tb = TransformedDistribution[xmin + u (xmax - xmin), 
  u \[Distributed] BetaDistribution[alpha, beta]]

Generate a random sample from that distribution with known parameters:

n = 100
data = RandomVariate[tb /. {xmin -> 1.33, xmax -> 6.83, alpha -> 0.54, beta -> 0.71}, n];

Construct the density function and create the log likelihood:

f[x_, xmin_, xmax_, alpha_, beta_] := (((x - xmin)/(xmax - xmin))^(alpha - 1) *
   (1 - (x - xmin)/(xmax - xmin))^(beta - 1))/((xmax - xmin) Beta[alpha, beta])

logL = Total[Table[Log[f[data[[i]], xmin, xmax, alpha, beta]], {i,Length[data]}]];

Find the maximum likelihood estimates for the parameters:

NMaximize[{logL, {alpha > 0, beta > 0, xmin < 0.9999 Min[data], 
   xmax > 1.0001 Max[data]}}, {alpha, beta, xmin, xmax}, MaxIterations -> 1000]
 (* {-147.3, {alpha -> 0.475528, beta -> 0.652326, xmin -> 1.33405, xmax -> 6.81881}} *)

There's probably a better way than multiplying by 0.9999 and 1.0001 to keep the xmin and xmax parameters in line. But without doing something like that, NMaximize complains.

$\endgroup$
3
  • $\begingroup$ That's a clever method. Thanks. $\endgroup$ Dec 5 '15 at 14:45
  • 1
    $\begingroup$ I would suggest transforming your data to be bounded on (0,1), and then use a standard Beta distribution to fit the latter. You can always transform back to the generalised Beta again afterwards. $\endgroup$
    – wolfies
    Dec 10 '15 at 15:54
  • $\begingroup$ If xmin and xmax (the names of the parameters rather than the sample statistics) were known, then that makes the most sense. But in this case xmin and xmax are also parameters to be estimated. (At least, that's what I assumed but maybe that's an incorrect assumption.) But maybe the maximum likelihood estimators for those parameters are the sample minimum and sample maximum? $\endgroup$
    – JimB
    Dec 10 '15 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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