13.07.2015 Views

Download pdf guide - VSN International

Download pdf guide - VSN International

Download pdf guide - VSN International

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

112 9 Programs and procedures11 LIST=yes " whether >1 setting can be given "12 PARAMETER 'Y','X','Corr','Prob'; \13 MODE=p; "default - expects an identifier list "\14 TYPE=2('variate','scalar'); \15 SET=2(yes,no); "X & Y must be set (but not Corr & Prob)"\16 INPUT=2(yes,no); "X & Y only for input (but not ...) "\17 DECLARED=2(yes,no); "X & Y must have been declared (but ...)"\18 PRESENT=2(yes,no); "X & Y must have values (but not ...) "\19 COMPATIBLE=*,'nvalues',*,* "X must have same no. values as Y"2021 SET [CASE=significant]22 ASSIGN [METHOD=preserve] corr,prob; POINTER=Corr,Prob2324 CALCULATE Corr = CORRELATION(Y; X)25 & Nobservations = NOBS(Y + X)26 & Abscorr = ABS(Corr)27 PRCORRELATION [NOBSERVATIONS=Nobservations] \28 Abscorr; CUPROBABILITY=Prob29 CALCULATE Prob = 0.5 * Prob3031 IF SUM(!t(correlation,nobservations) .IN. PRINT)32 CAPTION 'Correlation test'; STYLE=minor33 IF 'correlation' .IN. PRINT34 IF Prob .LE. 0.00135 PRINT [IPRINT=*] 'Correlation',Corr,'Probability < 0.1%';\36 FIELD=11,7,20; DECIMALS=3; JUSTIFICATION=left37 ELSIF Prob .LE. 0.0138 PRINT [IPRINT=*] 'Correlation',Corr,'Probability < 1%';\39 FIELD=11,7,20; DECIMALS=3; JUSTIFICATION=left40 ELSIF Prob .LE. 0.0541 PRINT [IPRINT=*] 'Correlation',Corr,'Probability < 5%';\4243 ELSEFIELD=11,7,20; DECIMALS=3; JUSTIFICATION=left44 PRINT [IPRINT=*] 'Correlation',Corr,'Not significant';\45 FIELD=11,7,20; DECIMALS=3; JUSTIFICATION=left46 ENDIF47 ENDIF48 IF 'nobservations' .IN. PRINT49 PRINT [IPRINT=*] 'Number of observations:',Nobservations;\50 DECIMALS=0; JUSTIFICATION=left51 ENDIF52 ENDIF5354 ENDPROCEDURE5556 CORTEST [PRINT=*] Y=Water; X=Employ; CORR=Cor; PROB=Pr57 PRINT Cor,PrCor Pr0.4132 0.0248058 CORTEST Y=Water; X=EmployCorrelation testCorrelation 0.413 Probability < 5%In line 31, SUM(!t(correlation,nobservations).IN.PRINT) will be non-zero(i.e. true) if PRINT contains either of the two tokens. So the this expression checkswhether any printed output is required. In line 32, we use the CAPTION directive todisplay a title for the analysis (see Section 4.8 for an explanation). In line 56, we verifythat setting PRINT=* suppresses the printed output, and that we can use the CORR andPROB parameters to save the correlation and probability. In line 58 we call the procedure

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!