Help using Base SAS procedures

Gamma Dist stats PROC UNIVARIATE

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

Gamma Dist stats PROC UNIVARIATE

Hello - I want to output a host of Gamma distribution stats on a numeric variable grouped (or classed) by a couple of catagorical variables in an output table for easy consumption.

 

I think PROC UNIVARIATE is what I need. PROC UNIVARIATE can get me the range of stats I need in an output table, but where I get stuck is that as far as I can manage the stats are only for a normal distribution. i.e. I can't get a table output for Gamma distribution. I want stats about the distribution like quartiles, standard deviation, kurtosis, skewdness  etc etc. 

 

Would really appreciate your help.


Accepted Solutions
Solution
‎01-13-2016 03:25 AM
Grand Advisor
Posts: 9,463

Re: Gamma Dist stats PROC UNIVARIATE

I do not understand your question. All the quantiles are empirical quantiles . You want exact theory quantiles ? Check function QUANTILE() .

Or you could use histogram option OUTHISTOGRAM= OUTKERNEL=  to get these histogram information.

Or you just want find a BEST Gamma curve to  fit these data ? Check Rick's blog how to find the best Normal distribution parameter with a sample data. This can guide you to how to find a BEST Gamma distribution parameter to  fit these data .

 

http://blogs.sas.com/content/iml/2011/10/12/maximum-likelihood-estimation-in-sasiml.html

View solution in original post


All Replies
Grand Advisor
Posts: 9,463

Re: Gamma Dist stats PROC UNIVARIATE

[ Edited ]

I find an example how to fit Gamma distribution in Documentation .

ods select ParameterEstimates GoodnessOfFit FitQuantiles;
proc univariate data=Plates; var Gap; histogram / midpoints=0.2 to 1.8 by 0.2 gamma vaxis = axis1 name = 'MyHist'; inset n mean(5.3) std='Std Dev'(5.3) skewness(5.3) / pos = ne header = 'Summary Statistics'; axis1 label=(a=90 r=0); run;
Occasional Contributor
Posts: 14

Re: Gamma Dist stats PROC UNIVARIATE

Hi- thank you for responding. I've also seen that exact example. My problem with it is that I want a table output, but using the two table output options I know for PROC UNIVARIATE (TABLE and OUTTABLE) I can only get the normal distribution output go the table, not the Gamma distribution. Do you know starting from that code how to output a table with the gamma distribution? Also the full range of stats would be helpful. From what I can tell this code doesn't have the same as PROC UNIVARIATE produces for a normal distribution.
Solution
‎01-13-2016 03:25 AM
Grand Advisor
Posts: 9,463

Re: Gamma Dist stats PROC UNIVARIATE

I do not understand your question. All the quantiles are empirical quantiles . You want exact theory quantiles ? Check function QUANTILE() .

Or you could use histogram option OUTHISTOGRAM= OUTKERNEL=  to get these histogram information.

Or you just want find a BEST Gamma curve to  fit these data ? Check Rick's blog how to find the best Normal distribution parameter with a sample data. This can guide you to how to find a BEST Gamma distribution parameter to  fit these data .

 

http://blogs.sas.com/content/iml/2011/10/12/maximum-likelihood-estimation-in-sasiml.html

Grand Advisor
Posts: 9,463

Re: Gamma Dist stats PROC UNIVARIATE

From output I can see these . Is it what you need ?

 

Distribution of Plate Gaps
The UNIVARIATE Procedure
Fitted Gamma Distribution for Gap
Parameters for Gamma Distribution
Parameter Symbol Estimate
Threshold Theta 0
Scale Sigma 0.155198
Shape Alpha 4.082646
Mean 0.63362
Std Dev 0.313587
Goodness-of-Fit Tests for Gamma Distribution
Test ----Statistic----- ------p Value------
Kolmogorov-Smirnov D 0.09695325 Pr > D >0.250
Cramer-von Mises W-Sq 0.07398467 Pr > W-Sq >0.250
Anderson-Darling A-Sq 0.58106613 Pr > A-Sq 0.137

 

 

Quantiles for Gamma Distribution
------Quantile------
Percent Observed Estimated
1.0 0.23100 0.13326
5.0 0.24700 0.21951
10.0 0.29450 0.27938
25.0 0.37800 0.40404
50.0 0.53150 0.58271
75.0 0.74600 0.80804
90.0 1.10050 1.05392
95.0 1.54700 1.22160
99.0 1.74100 1.57939

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 359 views
  • 0 likes
  • 2 in conversation