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

I am trying to fit a set of observed values into Gamma distribution, using UNIVARIATE:

proc univariate data=calls;
	var iat;
	histogram  / gamma;
run;

but getting no goodness-of-fit tests, just the note in the subject. Other outputs (basic measures, fitted gamma parameters, quantiles) are produced.

 

But when I try th example code from here:

http://support.sas.com/documentation...

 

data Plates;
   label Gap = 'Plate Gap in cm';
   input Gap @@;
   datalines;
0.746  0.357  0.376  0.327  0.485 1.741  0.241  0.777  0.768  0.409
0.252  0.512  0.534  1.656  0.742 0.378  0.714  1.121  0.597  0.231
0.541  0.805  0.682  0.418  0.506 0.501  0.247  0.922  0.880  0.344
0.519  1.302  0.275  0.601  0.388 0.450  0.845  0.319  0.486  0.529
1.547  0.690  0.676  0.314  0.736 0.643  0.483  0.352  0.636  1.080
;
run;

ods select ParameterEstimates GoodnessOfFit FitQuantiles MyHist;
proc univariate data=Plates;
   var Gap;
   histogram / midpoints=0.2 to 1.8 by 0.2
               lognormal
               weibull
               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;

it works - all three GOF metrics (KS, Cramer, Anderson-Darling) are produced.

 

So, is it something in my data that does not allow to compute these metrics?

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Yes, most likely your data is causing the issue. The table "Availability of EDF Tests" in the UNIVARIATE documentation shows the situations for which the EDF tests are available. In your example, theta=0 (known) and the shape and scale parameters are unknown. The table shows that EDF tests are only available when the estimate for the shape parameter is greater than 1.

 

I am going to guess that your shape estimate (alpha) is less than 1.

View solution in original post

2 REPLIES 2
Ksharp
Super User

Maybe your variable iat have some negative value which could not be gamma distribution.

 

or try PROC GENMOD .

 

data Plates;
   label Gap = 'Plate Gap in cm';
   input Gap @@;
   datalines;
0.746  0.357  0.376  0.327  0.485 1.741  0.241  0.777  0.768  0.409
0.252  0.512  0.534  1.656  0.742 0.378  0.714  1.121  0.597  0.231
0.541  0.805  0.682  0.418  0.506 0.501  0.247  0.922  0.880  0.344
0.519  1.302  0.275  0.601  0.388 0.450  0.845  0.319  0.486  0.529
1.547  0.690  0.676  0.314  0.736 0.643  0.483  0.352  0.636  1.080
;
run;

proc genmod data=Plates;
   model Gap= /dist=gamma;
run;
Rick_SAS
SAS Super FREQ

Yes, most likely your data is causing the issue. The table "Availability of EDF Tests" in the UNIVARIATE documentation shows the situations for which the EDF tests are available. In your example, theta=0 (known) and the shape and scale parameters are unknown. The table shows that EDF tests are only available when the estimate for the shape parameter is greater than 1.

 

I am going to guess that your shape estimate (alpha) is less than 1.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1519 views
  • 0 likes
  • 3 in conversation