Skip to content

Instantly share code, notes, and snippets.

@shandou
Last active May 30, 2018 06:23
Show Gist options
  • Save shandou/037b06955d84830d36f01eb908c5413f to your computer and use it in GitHub Desktop.
Save shandou/037b06955d84830d36f01eb908c5413f to your computer and use it in GitHub Desktop.
pearson_r_CI2
import numpy as np
r = - 0.654 # Pearson's r from sampled data
z_prime = 0.5 * np.log((1 + r) / (1 - r))
n = 34 # Sample size
se = 1 / np.sqrt(n - 3) # Sample standard error
CI_lower = z_prime - z_critical * se
CI_upper = z_prime + z_critical * se
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment