# Category : Miscellaneous Language Source Code

Archive : FORTRN77.ZIP

Filename : STSPER.FOR

C

C THIS SUBROUTINE COMPUTES THE SPEARMAN RANK CORRELATION

C COEFFICIENT FOR TWO SERIES OF DATA.

C

DIMENSION A(1), B(1)

EN = N

KP = 0

N1 = N - 1

R = 0.0

IF (N.LE.1) RETURN

5 CALL SORT2 (A,B,N)

K = 1

DO 60 I = 1,N1

J1 = K + 1

DO 30 J = J1,N

IF (A(K).NE.A(J)) GO TO 40

30 CONTINUE

40 Z = (FLOAT(K + J - 1)*0.5)

K1 = J - 1

DO 50 KK = K,K1

50 A(KK) = Z

IF (J.EQ.N) A(N) = EN

K = J

IF (J.GE.N) GO TO 31

60 CONTINUE

31 IF (KP.EQ.1) GO TO 80

DO 70 I = 1,N

T = A(I)

A(I) = B(I)

70 B(I) = I

KP = 1

GO TO 5

80 SUMA2 = 0.0

SUMB2 = 0.0

SUMAB = 0.0

DO 90 I = 1,N

SUMA2 = SUMA2 + A(I)*A(I)

SUMB2 = SUMB2 + B(I)*B(I)

90 SUMAB = SUMAB + A(I) *B(I)

S = EN*(EN + 1.0)

S = S*S*0.25

R = (EN*SUMA2 - S)*(EN*SUMB2 - S)

IF (R.EQ.0.0) RETURN

R = (EN*SUMAB - S)/SQRT(R)

RETURN

END

Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/