On determining Alpha and Beta from a gamma distribution upon simulating a sample

#1
Hey guys, hope someone will be able to help me.

What I want to do: determine the empirical values for alpha and beta from a simulated sample from a gamma(alpha,beta) distribution.

Say it looks something like this:

proc iml;
alpha=10;
beta=5;
sumofvaluepower1 = 0;
sumofvaluepower2 = 0;

do q = 1 to 20;
gammavalue = rangam(1,alpha)*beta;
sumofvaluepower1 = sumofvaluepower1 + gammavalue;
sumofvaluepower2 = sumofvaluepower2 + gammavalue**2;
end;
empexpectedvalue = sumofvaluepower1 / 20;
empvariance = (sumofvaluepower2 / 20) - empexpectedvalue**2;
/*here i need a way, to calculate from the expected value of the sample, and the variance, the empirical values for alpha and beta (which should be close to my original, fixed alpha and beta). intuitively I feel that this should not be a difficult feat but I am being stupid in not being able to figure this out!*/

quit;


Anyone any advice?
 

Dason

Ambassador to the humans
#2
So you want to use a method of moments estimator to estimate alpha and beta?

What do you know about the expected value and variance for the gamma in terms of alpha and beta? If you set up those two equations can you simultaneously solve for alpha and beta in terms of the expected value and variance?