Programming the statistical procedures from SAS

Fit Log-gamma distribution

Reply
Occasional Contributor
Posts: 6

Fit Log-gamma distribution

Which procedure to use to fit Log-Gamma distribution?

SAS Super FREQ
Posts: 3,319

Re: Fit Log-gamma distribution

If you are talking about fitting a parametric model to univariate data, you can

1) use PROC IML to fit the maximum likelihood estimates for the log-gamma model: http://blogs.sas.com/content/iml/2011/10/12/maximum-likelihood-estimation-in-sasiml.html

2) exponentiate and use PROC UNIVARIATE to fit a gamma distribution on the transformed data

Occasional Contributor
Posts: 6

Re: Fit Log-gamma distribution

Thanks for reply!

Since I want to simulate random numbers from log-gamma. Is it okay if I take the Log of obsv, fit gamma using Proc Univariate and exponentiate the simulated random numbers to get log-gamma rand. no.s?

SAS Super FREQ
Posts: 3,319

Re: Fit Log-gamma distribution

Yes. The result to keep in mind is that if X is log-gamma distributed, then Y = log(X) has a gamma distribution.  So yes, you can use PROC UNIVARIATE to fit  the parameters for Y.  Then you can use those parameters to simulate gamma data, and exponentiate those random variates to simulate the original data.

Occasional Contributor
Posts: 6

Re: Fit Log-gamma distribution

Cool...thanks a lot!!!!!!

SAS Employee
Posts: 187

Re: Fit Log-gamma distribution

If you are asking how to fit a log-linear model to a gamma-distributed response variable, you can do that in PROC GLIMMIX or PROC GENMOD.  For example, if Y is a gamma-distributed response, the following statements fit the model (with X1 and X2 as predictors) log(mean) = intercept + b1*x1 + b2*x2 :

proc genmod;

model y = x1 x2 / dist=gamma link=log;

run;

Ask a Question
Discussion stats
  • 5 replies
  • 449 views
  • 1 like
  • 3 in conversation