CDF of gamma distribution

조회 수: 2 (최근 30일)
RNTL
RNTL 2012년 6월 24일
assuming X~Gamma(k,theta) where k and theta are shape and scale parameters, the CDF Fx(x) should be
Fx(x) = 1/Gamma(k)*gamma(k,x/theta) where Gamma is the gamma function and gamma is the lower incomplete gamma function
however, trying to use gammainc for the incomplete gamma function I get a monotonic decreasing result, instead of the expected increasing to 1 CDF. instead I am using gamcdf which seems reasonable, but I don't understand the nature of the difference.
help ? anyone?

채택된 답변

Wayne King
Wayne King 2012년 6월 24일
I'm not sure how you are calling it, but you should get the same result with gamcdf and gammainc, provided you scale the x vector by the value of your theta parameter prior to calling gammainc
x = 0:0.01:20;
k = 2; % shape parameter
theta = 3; % scale parameter
F = gamcdf(x,k,theta);
plot(x,F,'b');
hold on;
x1 = x./theta; %scale x axis by theta
Z = gammainc(x1,k);
plot(x,Z,'k')
max(abs(Z-F))
  댓글 수: 1
RNTL
RNTL 2012년 6월 24일
thanks! guess I mixed up the order of the parameters.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by