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

I am looking for SAS syntax or SAS macro with Code that will perform Goodness of Fits on discrete categorical data. 

Specifically one that shows how to do the math described by N. Cressie, T.R.C. Read, in their paper entitled  Multinomial goodness-of-fit tests, J. Roy. Statist. Soc. B 46 (1984) 440–464.

 

I do have code now for 4 of the 5 test statistics I need.

  1. proc freq gives the Pearson's Chi Square,
  2. Proc Univarite produces the Komogorov Smirnov test statistic,
  3. Proc Probit produces the Log Likelihood Ratio as does Proc GenMod,
  4. Proc Multtest  calculates the Freeman-Tukey test statistic,

but I have not been able to find the Power divergence test show in the image attached here.   I found some R code so maybe I can run it inside SAS enterprise guide?  But I do NOT have a SAS/IML or SAS Enterprise Miner license so I can not run the R code inside a node that way.  Please advise.


five statistical tests.JPG
1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Looks like @PGStatsalready gave you an answer in the Statistics Comunity: https://communities.sas.com/t5/SAS-Statistical-Procedures/Power-Divergence-Test-Statistic/m-p/240111

 

These computations (all five of them!) can be done with SQL or IML.

 

proc freq data=sashelp.heart;
where weight_status is not missing;
table sex*weight_status / out=cellcounts outexpect;
run;

proc iml;
use cellCounts;
read all var {count expected};
close cellCounts;
lambda = 2/3;
powerDivergence = 2/(lambda*(1+lambda))*sum(COUNT#(COUNT/EXPECTED)##lambda-1);
print lambda powerDivergence;

View solution in original post

1 REPLY 1
Rick_SAS
SAS Super FREQ

Looks like @PGStatsalready gave you an answer in the Statistics Comunity: https://communities.sas.com/t5/SAS-Statistical-Procedures/Power-Divergence-Test-Statistic/m-p/240111

 

These computations (all five of them!) can be done with SQL or IML.

 

proc freq data=sashelp.heart;
where weight_status is not missing;
table sex*weight_status / out=cellcounts outexpect;
run;

proc iml;
use cellCounts;
read all var {count expected};
close cellCounts;
lambda = 2/3;
powerDivergence = 2/(lambda*(1+lambda))*sum(COUNT#(COUNT/EXPECTED)##lambda-1);
print lambda powerDivergence;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 1754 views
  • 0 likes
  • 2 in conversation