Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
2  
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
1  
"my data is something like this" - please edit your question to include this. –  J. M. Oct 10 '12 at 13:04
1  
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
1  
@user1525225 Then probably you should consider other distributions. –  b.gatessucks Oct 10 '12 at 13:53
show 5 more comments

1 Answer 1

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
add comment

Your Answer

 
discard

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.