[ncltalk] Correlation coefficient for different threshold
Ehsan Taghizadeh
ehsantaghizadeh at yahoo.com
Wed Jul 11 05:48:58 MDT 2018
Hi,I've used "escorc" to compute Pearson correlation coefficient for my data, from this link: escorc.


 
escorc
NCL builtin functions (statistics)



However I want to do some manipulate for input arrays, and I want best function to do that. For example in Example 1 at above link:
x = (/ 0.20, 1.88, 0.76, 0.42, 0.32, 0.56, 1.55, 1.21, 0.66, 0.96, 0.21 /)
y = (/ 0.18, 0.54, 0.49, 0.92, 0.22, 0.75, 0.66, 2.65, 0.51, 0.47, 0.09 /)
r = escorc(x,y) ; Pearson correlation
;Compute correlation confidence interval
n = dimsizes(x) ; n=11
df = n2
; Fischer ztransformation
z = 0.5*log((1+r)/(1r)) ; zstatistic
se = 1.0/sqrt(n3) ; standard error of zstatistic
; low and hi z values
zlow = z  1.96*se ; 95% (2.58 for 99%)
zhi = z + 1.96*se
; inverse ztransform; 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) t = r*sqrt((n2)/(1r^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
For example how could I compute "r,n, ..." where(x.gt.5).
I'll be thankful for any help.
SincerelyEhsan
 next part 
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncltalk/attachments/20180711/e682e787/attachment.html>
More information about the ncltalk
mailing list