2
$\begingroup$

i want to write this function

enter image description here

dist = ProbabilityDistribution[{(x/\[Lambda])^\[Alpha]}, {x, 0, \[Infinity]}, Assumptions -> {\[Lambda] > 0 && \[Lambda] > x, \[Alpha] > 0}]
data = {2.8, 1.8, 3.2, 5.0, 2.4, 4.8, 2.9, 2.9, 2.3, 3.2, 2.3, 2.0, 1.9, 3.3, 4.4, 6.7, 4.3, 1.9, 2.2, 3.3, 2.1, 4.0, 2.0, 3.1, 3.8,  3.1, 3.2, 3.4, 2.8, 2.1, 3.1}

mle = FindDistributionParameters[data, dist, ParameterEstimator -> {"MaximumLikelihood", Method -> "FindMaximum", MaxIterations -> 10000}]

but no result show it' show like pic below enter image description here

please anyone can help me

$\endgroup$
2
  • $\begingroup$ If $0\leq x \leq \infty$, how can the constant parameter $\lambda$ be greater than $x$? Also, the first expression in your ProbabilityDistribution doesn't look like a PDF. $\endgroup$
    – MarcoB
    Commented Jul 20, 2022 at 2:32
  • $\begingroup$ statisticshowto.com/power-function-distribution this distribution I want to write as a custom distribution please I want to write it no using power distribution function in mathmatica $\endgroup$
    – Ahmed
    Commented Jul 20, 2022 at 3:00

2 Answers 2

4
$\begingroup$

Here is an explanation why Mathematica and other software packages have trouble with this particular probability distribution.

dist = ProbabilityDistribution[(x/λ)^α, {x, 0, λ}, Assumptions -> {λ > x, α > 0}, 
   Method -> "Normalize"];

data = {2.8, 1.8, 3.2, 5.0, 2.4, 4.8, 2.9, 2.9, 2.3, 3.2, 2.3, 2.0, 
   1.9, 3.3, 4.4, 6.7, 4.3, 1.9, 2.2, 3.3, 2.1, 4.0, 2.0, 3.1, 3.8, 
   3.1, 3.2, 3.4, 2.8, 2.1, 3.1};

(* Determine log of the likelihood and do a bunch of simplifications *)
logL = Simplify[LogLikelihood[dist, data], Assumptions-> λ > Max[data]] //.
  Log[a_ b_] -> Log[a] + Log[b] /. Log[a_^b_] -> b Log[a] /.
  Log[Power[a_,-1]] -> -Log[a] // Expand

(* 33.497 α + 31 Log[1 + α] - 31 Log[λ] - 31 α Log[λ] *)

We see that because $\alpha>0$, $\lambda$ needs to be made as small as possible to maximize the log of the likelihood. The smallest value possible is the maximum of the data values.

But when maximum likelihood estimators are on the border of possible values for a parameter, that can cause difficulties.

So the maximum likelihood value for $\alpha$ can be found with the following:

FindMaximum[{logL /. λ -> Max[data], α > 0}, α]
(* {-58.4039, {α -> 0.217198}} *)
$\endgroup$
2
$\begingroup$
$Version

(* "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)" *)

Clear["Global`*"]

dist = ProbabilityDistribution[(x/λ)^α, {x, 0, λ}, 
   Assumptions -> {λ > 0, α > 0},
   Method -> "Normalize"];

dpa = DistributionParameterAssumptions[dist]

(* {λ > 0, α > 0} *)

PDF[dist, x]

enter image description here

Assuming[dpa, CDF[dist, x] // Simplify]

enter image description here

data = {2.8, 1.8, 3.2, 5.0, 2.4, 4.8, 2.9, 2.9, 2.3, 3.2, 2.3, 2.0, 1.9, 3.3, 
   4.4, 6.7, 4.3, 1.9, 2.2, 3.3, 2.1, 4.0, 2.0, 3.1, 3.8, 3.1, 3.2, 3.4, 2.8, 
   2.1, 3.1};

mle = FindDistributionParameters[data, dist, 
  ParameterEstimator -> {"MaximumLikelihood", 
    Method -> "FindMaximum", 
    MaxIterations -> 10000}]

(* {α -> 1.09548, λ -> 1.09548} *)

Or more simply,

mle = FindDistributionParameters[data, dist]

(* {α -> 1.09548, λ -> 1.09548} *)

EDIT: The parameter estimates are wrong. As indicated in the comments, different data sets result in identical estimates for the parameters. A bug report was submitted to Wolfram Tech Support (CASE:4954659)

$\endgroup$
4
  • 1
    $\begingroup$ i changed data but same parameters output data = {0.1, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 3.0, 6.0, 7.0, 11.0, 12.0, 18.0, 18.0, 18.0, 18.0, 18.0, 21.0, 32.0, 36.0, 40.0, 45.0, 45.0, 47.0, 50.0, 55.0, 60.0, 63.0, 63.0, 67.0, 67.0, 67.0, 67.0, 72.0, 75.0, 79.0, 82.0, 82.0, 83.0, 84.0, 84.0, 84.0, 85.0, 85.0, 85.0, 85.0, 85.0, 86.0, 86.0}; or data={275, 13, 147, 23, 181, 30, 65, 10, 300, 173, 106, 300, 300, 212, 300, \ 300, 300, 2, 261, 293, 88, 247, 28, 143, 300, 23, 300, 80, 245, 266} $\endgroup$
    – Ahmed
    Commented Jul 20, 2022 at 14:08
  • $\begingroup$ i want to write alpha power distribution as custom distribution not use the defined alpha power distribution in mathematica $\endgroup$
    – Ahmed
    Commented Jul 20, 2022 at 14:11
  • 3
    $\begingroup$ Yes, the estimated parameters using the custom distribution ( ProbabilityDistribution) are wrong. FindDistributionParameters is returning identical estimates for the different data sets. I will submit a bug report to Wolfram Tech Support. $\endgroup$
    – Bob Hanlon
    Commented Jul 20, 2022 at 15:27
  • 2
    $\begingroup$ This is a case where the maximum likelihood estimator of $\lambda$ is the maximum of the data values. Having the maximum likelihood estimator being on the border of possible values causes trouble for many software packages including Mathematica. $\endgroup$
    – JimB
    Commented Aug 7, 2022 at 4:50

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.