BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Silvertreetops
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

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

4 REPLIES 4
Ksharp
Super User

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;
Silvertreetops
Obsidian | Level 7
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.
Ksharp
Super User

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

Ksharp
Super User

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

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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