BookmarkSubscribeRSS Feed
maivu
Calcite | Level 5

I have to write a SAS macro in terms of the Kolmogorov Smirnov statistic. I spent a lot of time to do it but haven't finished so who can help me please? The question is:

Write a SAS macro which has 3 parameters: m for the number of simulation iterations, n for the sample size, and @ for the upper tail probability. given values of the 3 parameters, it returns a simulation-based estimate of the (1-@) quantile of the sampling distribution of the Kolmogorov-Smirnov statistic for data from the standard normal distribution. 

%D(m=500, n=5, @=0.10);

%D(m=1000, n=10, @=0.05);

 

2 REPLIES 2
Reeza
Super User

Post what you've tried. And this is clearly homework. 

Rick_SAS
SAS Super FREQ

I suggest you begin with 

%let m=500;

%let n=5;

%let alpha=0.10;

then write a DATA step that generates m samples, each of size n.

Run PROC UNIVARIATE with BY-group processing on the Sample ID variable.

Then analyze the empirical frequency of the indicator variable ( KS > alpha ).

For hints and similar Monte Carlo estimates, see

"Using simulation to estimate the power of a statistical test"

which uses PROC TTEST (on two independent samples) instead of the KS (on one sample).

 

After everything is debugged and working, it is trivial to wrap the code into a macro.

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
  • 2 replies
  • 1187 views
  • 0 likes
  • 3 in conversation