- 积分
- 15745
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-3-8
- 最后登录
- 1970-1-1
|
发表于 2016-3-18 14:29:06
|
显示全部楼层
谢谢您的回复,您指的是第一个例子后面的部分吗? 如下,这个是计算一维的,那我的计算的是一维和二维的,所以相关是一个二维的也可以这样做吗?谢谢你的帮助
;---Compute correlation confidence interval
n = dimsizes(x) ; n=11
df = n-2
; Fischer z-transformation
z = 0.5*log((1+r)/(1-r)) ; z-statistic
se = 1.0/sqrt(n-3) ; standard error of z-statistic
; low and hi z values
zlow = z - 1.96*se ; 95% (2.58 for 99%)
zhi = z + 1.96*se
; inverse z-transform; return to r space (-1 to +1)
rlow = (exp(2*zlow)-1)/(exp(2*zlow)+1)
rhi = (exp(2*zhi )-1)/(exp(2*zhi )+1)
print("r="+r) ; r=0.559956
print("z="+z+" se="+se) ; z=0.63277 se=0.353553
print("zlow="+zlow+" zhi="+zhi) ; zlow=-0.0601951 zhi=1.32573
print("rlow="+rlow+" rhi="+rhi) ; rlow=-0.0601225 rhi=0.868203
Since the r confidence interval includes 0.0, the calculated r is not significant.
An alternative for testing significance is:
t = r*log((n-2)/(1-r^2))
p = student_t(t, df)
psig = 0.05 ; test significance level
print("t="+t+" p="+p) ; t=2.02755 p=0.0732238
if (p.le.psig) then
print("r="+r+" is significant at the 95% level"))
else
print("r="+r+" is NOT significant at the 95% level"))
end if
|
|