Skip to content

Instantly share code, notes, and snippets.

@Bollegala
Created February 17, 2017 23:29
Show Gist options
  • Save Bollegala/01fa1520d4c1594c12d39905a463469f to your computer and use it in GitHub Desktop.
Save Bollegala/01fa1520d4c1594c12d39905a463469f to your computer and use it in GitHub Desktop.
Fisher confidence intervals for Spearman correlation
import math
import sys
r = float(sys.argv[1])
num = int(sys.argv[2])
stderr = 1.0 / math.sqrt(num - 3)
delta = 1.96 * stderr
lower = math.tanh(math.atanh(r) - delta)
upper = math.tanh(math.atanh(r) + delta)
print "lower %.6f upper %.6f" % (lower, upper)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment