BookmarkSubscribeRSS Feed
ewolin
Calcite | Level 5

What exact algorithm is used to calculate the asymptotic K-S p-value given the d-statistic and n (or n1 and n2 for two-sided tests) in NPAR1WAY?  The documentation I found shows the theoretical equations, which involve an infinite sum, but my understanding is that in practice approximations are always used (at minimum the infinite sum must be truncated).

Also, is the function that does the calculation available to be called in by users in a data step (as is the case in R and other stat packages)? 

3 REPLIES 3
PGStats
Opal | Level 21

Did you come across some incorrect p-values with proc NPAR1WAY?

PG
ewolin
Calcite | Level 5

Within the scope of what NPAR1WAY addresses, no problems, but NPAR1WAY does NOT work on weighted data. 

I had to fool it by using FREQ as the weight and recalculating the p-value from _d_, n1 and n2 using a function I wrote myself.  To my surprise, for unweighted data my calculation and the one by NPAR1WAY agree to 8 significant digits!  I suspect I implemented the very same algorithm for the calculation that NPAR1WAY uses, which is why I'm wondering...

marksc
Calcite | Level 5

Could you post your function? I have the same issue you had, and cannot find anything for SAS to allow getting appropriate p-values for weighted data if you, say, multiply the weights by a constant so that the truncation of frequencies in the FREQ does not affect things much. Also, what are n1 and n2 in your function? The sum of the weights in a given class? The number of observations in a given class? Thank you for your help.

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