Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
Hard to tell without knowing what your data looks like. – b.gatessucks 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. 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.gatessucks Oct 10 '12 at 13:10
@user1525225 Then probably you should consider other distributions. – b.gatessucks Oct 10 '12 at 13:53
up vote 2 down vote accepted

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.

share|improve this answer
@b.gatessucks Sorry, I did not see your comments. – Eric Brown Oct 10 '12 at 15:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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