/* Shapiro-Francia test for normality */ /* This program is a GAUSS version of 'sf.test' */ /* by Juergen Gross in library 'nortest' of R. */ new; cls; x=rndn(100,1); call SFtest(x); proc SFtest(x); local n,a,y,cr,W,u,v,mu,sig,z,pval; if ismiss(x); errorlog "Warning: missing data found."; x=packr(x); endif; n=rows(x); x=sortc(x,1); a=3/8; y=cdfni((seqa(1,1,n)-a)/(n+(1-a)-a)); cr=corrx(x~y); W=cr[1,2]^2; u=ln(n); v=ln(u); mu=-1.2725+1.0521*(v-u); sig=1.0308-0.26758*(v+2/u); z=(ln(1-W)-mu)/sig; pval=1-cdfn(z); print "Shapiro-Francia W Test:"; print/rz "n =" n; print "stat=" W; print "pval=" pval; retp(W); endp;