code: def compute_ci(r=None, nx=None, ny=None, confidence=0.95):
      """Compute Parametric confidence intervals around correlation coefficient.
      See : https://online.stat.psu.edu/stat505/lesson/6/6.3
  
      This is done by applying Fisher's r to z transform
      z = .5[ln((1+r)/(1-r))] = arctanh(r)
  
      The Standard error is 1/sqrt(N-3) where N is sample size
  
      The critical value for normal distribution for a corresponding confidence
      level is calculated from stats.norm.ppf((1 - alpha)/2) for two tailed test
  
      The lower and upper condidence intervals in z space are calculated with the formula
      z ± critical value*error
  
      The confidence interval is then converted back to r space
  
      :param stat : correlation coefficient
      :param nx : length of vector x
      :param ny :length of vector y
      :param confidence : Confidence level (0.95 = 95%)
  
      :returns : array containing confidence interval
      """
  
      assert r is not None and nx is not None
      assert isinstance(confidence, float)
      assert 0 < confidence < 1
  
      z = np.arctanh(r)  # Fisher Transform  from r to z
      se = 1 / np.sqrt(
          nx - 3
      )  # Standard error = 1/sqrt(N-3) where N is sample size
      crit = np.abs(norm.ppf((1 - confidence) / 2))  # Z-critical value
      ci_z = np.array(
          [z - crit * se, z + crit * se]
      )  # CI = point estimator ± critical value*error
      ci = np.tanh(ci_z)  # Back Transform to r-space
  
      return ci
  
file_path: dowhy/dowhy/utils/cit.py
imports: from collections import defaultdict
  from math import log
  import numpy
  from scipy.stats import norm, t
label_desc: Use image node_id 1 for calling a global function with example usage: compute_ci(r, nx, ny, confidence) and returns: ci