Initial commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
SUBROUTINE pearsn(x,y,n,r,prob,z)
|
||||
INTEGER n
|
||||
REAL prob,r,z,x(n),y(n),TINY
|
||||
PARAMETER (TINY=1.e-20)
|
||||
CU USES betai
|
||||
INTEGER j
|
||||
REAL ax,ay,df,sxx,sxy,syy,t,xt,yt,betai
|
||||
ax=0.
|
||||
ay=0.
|
||||
do 11 j=1,n
|
||||
ax=ax+x(j)
|
||||
ay=ay+y(j)
|
||||
11 continue
|
||||
ax=ax/n
|
||||
ay=ay/n
|
||||
sxx=0.
|
||||
syy=0.
|
||||
sxy=0.
|
||||
do 12 j=1,n
|
||||
xt=x(j)-ax
|
||||
yt=y(j)-ay
|
||||
sxx=sxx+xt**2
|
||||
syy=syy+yt**2
|
||||
sxy=sxy+xt*yt
|
||||
12 continue
|
||||
r=sxy/(sqrt(sxx*syy)+TINY)
|
||||
z=0.5*log(((1.+r)+TINY)/((1.-r)+TINY))
|
||||
df=n-2
|
||||
t=r*sqrt(df/(((1.-r)+TINY)*((1.+r)+TINY)))
|
||||
prob=betai(0.5*df,0.5,df/(df+t**2))
|
||||
C prob=erfcc(abs(z*sqrt(n-1.))/1.4142136)
|
||||
return
|
||||
END
|
||||
Reference in New Issue
Block a user