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
PGStats
Opal | Level 21

It can be computed with a SQL query from proc freq output. For example

 

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

%let lambda=(2/3);

proc sql;
select
    &lambda as lambda, 
    2/(&lambda*(1+&lambda))*sum(COUNT*((COUNT/EXPECTED)**&lambda-1)) as powerDivergence
from cellCounts;
quit;
PG

View solution in original post

1 REPLY 1
PGStats
Opal | Level 21

It can be computed with a SQL query from proc freq output. For example

 

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

%let lambda=(2/3);

proc sql;
select
    &lambda as lambda, 
    2/(&lambda*(1+&lambda))*sum(COUNT*((COUNT/EXPECTED)**&lambda-1)) as powerDivergence
from cellCounts;
quit;
PG

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1955 views
  • 2 likes
  • 2 in conversation