# Problem with Estimating the parameters value of gamma distribution

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!

• Hard to tell without knowing what your data looks like. – b.gates.you.know.what Oct 10 '12 at 13:00
• my data is something like this: data = Join[ConstantArray[0, 96978], ConstantArray [1, 9240], ConstantArray [2, 704], ConstantArray [3, 43], ConstantArray [4, 9]]. thanks! – yyasinta Oct 10 '12 at 13:01
• "my data is something like this" - please edit your question to include this. – J. M. will be back soon Oct 10 '12 at 13:04
• 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. – b.gates.you.know.what Oct 10 '12 at 13:10
• @user1525225 Then probably you should consider other distributions. – b.gates.you.know.what Oct 10 '12 at 13:53

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

PDF[GammaDistrbution[a,b], x]


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.

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