/* Kuiper V-statistic test modified for normality */ /* This program is a GAUSS version of Kuiper V-statistic test in 'gofnorm' */ /* (Fortran code by Paul Johnson) located in library 'fBasics' of R. */ new; cls; x=rndn(100,1); call KuiperModified(x); proc KuiperModified(x); local n,fx,z,d1,t,d2,V; if ismiss(x); errorlog "Warning: missing data found."; x=packr(x); endif; n=rows(x); x=sortc(x,1); x=(x-meanc(x))/stdc(x); fx=cdfn(x); z=(seqa(1,1,n)/n)-fx; z=sortc(z,1); d1=z[n]; t=fx-((seqa(1,1,n)-1)/n); t=sortc(t,1); d2=t[n]; V=d1+d2; V=V*(sqrt(n)+(0.82/sqrt(n))+0.05); print "V=" V; retp(V); endp;