Estimating Parameters of a Custom Distribution

The problem is I can not get estimation of parameters of any custom probability distribution (distributions are not built in Mathematica), here is an example:

First: I entered random numbers of custom distribution (I entered the PDF of Weibull distribution) and I want its parameters to be estimated then I have an infinite loop somewhere, and the program runs for hours on a relatively fast machine, without producing anything..the steps on Mathematica are:

custom[a_, b_] := ProbabilityDistribution[(a/b) ((x/b)^(a - 1)) E^-(x/b)^a, {x, 0, \[Infinity]}]
PDF[custom[a, b]]
W = RandomVariate[custom[2, 3], 50]
FindDistributionParameters[W, custom[a, b]]

Second: I entered the same steps but I replace final step with FindDistributionParameters[W, WeibullDistribution[a, b]]. I got the answer in one second

{a -> 1.99144, b -> 2.6355}

The problem is if the custom distribution is not built in Mathematica what will be happened to estimate its parameters???

• Welcome! Please take some time to format your question in the future (@rhermans helped you out here already). See: mathematica.stackexchange.com/editing-help. – Yves Klett Oct 6 '14 at 14:43
• On second thoughts: How does this question differ from your first one: How to estimate parameters of a custom distribution?? – Yves Klett Oct 6 '14 at 14:49
• Dear Yves Keltt the main idea not on mathimatical properties as it was commented before..the main idea on Mathematica coding language..i illustrate my point on this example. – Momo Oct 7 '14 at 6:51
• Dear Momo, I am not entirely sure about the difference between the questions. Hopefully the answer here can help you, otherwise please edit the original one to reflect the differences. – Yves Klett Oct 7 '14 at 9:24

Clear[custom];

When defining the custom distribution, include the parameter assumptions required for the custom distribution to be a valid distribution.

custom[a_, b_] = ProbabilityDistribution[
(a/b) ((x/b)^(a - 1)) E^-(x/b)^a, {x, 0, Infinity},
Assumptions -> a > 0 && b > 0];

DistributionParameterAssumptions[custom[a, b]]

a > 0 && b > 0

W = RandomVariate[custom[2, 3], 50];

FindDistributionParameters[W, custom[a, b]]

{a -> 2.11554, b -> 3.11318}

FindDistributionParameters[W, WeibullDistribution[a, b]]

{a -> 2.11554, b -> 3.11318}

As expected, the parameters are identical since

PDF[custom[a, b], x] == PDF[WeibullDistribution[a, b], x]

True

• it works goo Thanks alot – Momo Oct 8 '14 at 7:44