; __________________________________________________________________ ; ; MODEL4.PRO ; The name of this program, should I forget it. ; __________________________________________________________________ ; X=[7.,-9.,6.,4.] & Y=[-1.,3.,8.,15] ; Arbitrary samples X and Y N=N_ELEMENTS(X) ; n MX=MEAN(X) & SX=STDEV(X) ; Mean and standard dev. of X MY=MEAN(Y) & SY=STDEV(Y) ; Mean and standard dev. of Y R1=TOTAL((X-MX)*(Y-MY))/((N-1.D0)*SX*SY) ; Linear corr. coeff. r ; -The same result could by obtained with the following IDl-command R2=CORRELATE(X,Y) ; Linear coff. coeff. r PRINT,'R1= ',R1,', R2=',R2 ; Just checking Q=1.D0-erf(ABS(R1)*SQRT(N/2.D0)) ; Probability P(r>r1) ; -There is also most probably an IDL-routine for this purpose, but... ; __________________________________________________________________ ; END ; __________________________________________________________________ ;