2
$\begingroup$

can anyone please help me with this problem? I am trying to estimate parameters of gamma distribution (fitted into a set of data). Following are my command and the output produced by mathematica:

In[41]:= EstimatedDistribution[data, GammaDistribution[alpha, beta], ParameterEstimator -> "MethodOfMoments"]

and it gives me:

During evaluation of In[41]:= EstimatedDistribution::ntsprt: One or more data points are not in support of the distribution GammaDistribution[alpha,beta]. >>

I do not understand the message above and what is the cause of it? Is it because of my command or my data? *note: if i am using binomial, NB, poisson and geometric, I can get the results.

my data:

data = Join[ConstantArray[0, 96978], ConstantArray [1, 9240], ConstantArray [2, 704], ConstantArray [3, 43], ConstantArray [4, 9]].

Thank you!

$\endgroup$
  • 2
    $\begingroup$ Hard to tell without knowing what your data looks like. $\endgroup$ – b.gates.you.know.what Oct 10 '12 at 13:00
  • $\begingroup$ my data is something like this: data = Join[ConstantArray[0, 96978], ConstantArray [1, 9240], ConstantArray [2, 704], ConstantArray [3, 43], ConstantArray [4, 9]]. thanks! $\endgroup$ – yyasinta Oct 10 '12 at 13:01
  • 1
    $\begingroup$ "my data is something like this" - please edit your question to include this. $\endgroup$ – J. M. will be back soon Oct 10 '12 at 13:04
  • 1
    $\begingroup$ I think the problem is the first set, the one containing 0; the distribution has support x>0. Try changing 0 to some small number. $\endgroup$ – b.gates.you.know.what Oct 10 '12 at 13:10
  • 1
    $\begingroup$ @user1525225 Then probably you should consider other distributions. $\endgroup$ – b.gates.you.know.what Oct 10 '12 at 13:53
2
$\begingroup$

If you get the Probability Distribution Function of the Gamma Distribution:

PDF[GammaDistrbution[a,b], x]

enter image description here

you see that x must be larger than 0, so no zeros in your data!

Edit: I would like to point out that your data is clearly discrete data, and so take a look at the Discrete Distributions (like PoissonDistribution). If you were to continue along the path of trying to fit this data to a Gamma Distribution with all of those zeros, then you would probably need to a) define a censored distribution:

censoredDistribution=CensoredDistribution[ {1,Infinity}, GammaDistribution[a,b] ];

and b) censor your data to remove the zeros:

censoredData=Select[ data, ( # >= 1 ) & ];

But I think this may be a waste of time, as well, as the computation may prove prohibitive and equally unjustifiable.

$\endgroup$
  • $\begingroup$ @b.gatessucks Sorry, I did not see your comments. $\endgroup$ – Eric Brown Oct 10 '12 at 15:01

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.