Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- how to produce the estimated quantile of the sampl...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-31-2017 11:26 PM

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);

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to maivu

02-01-2017 01:32 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to maivu

02-01-2017 02:12 PM

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.