code: def _var(indicators, max_dim):
      """
      Calculate the variance of a BDS effect
  
      Parameters
      ----------
      indicators : ndarray
          2d array of distance threshold indicators
      max_dim : int
          maximum embedding dimension
  
      Returns
      -------
      variances : float
          Variance of BDS effect
      """
      nobs = len(indicators)
      corrsum_1dim, _ = correlation_sum(indicators, 1)
      k = (
          (indicators.sum(1) ** 2).sum()
          - 3 * indicators.sum()
          + 2 * nobs
      ) / (nobs * (nobs - 1) * (nobs - 2))
  
      variances = np.zeros((1, max_dim - 1))
  
      for embedding_dim in range(2, max_dim + 1):
          tmp = 0
          for j in range(1, embedding_dim):
              tmp += (k ** (embedding_dim - j)) * (
                  corrsum_1dim ** (2 * j)
              )
          variances[0, embedding_dim - 2] = 4 * (
              k**embedding_dim
              + 2 * tmp
              + ((embedding_dim - 1) ** 2)
              * (corrsum_1dim ** (2 * embedding_dim))
              - (embedding_dim**2)
              * k
              * (corrsum_1dim ** (2 * embedding_dim - 2))
          )
  
      return variances, k
  
file_path: statsmodels/statsmodels/tsa/_bds.py
imports: import numpy
  from scipy import stats
  from statsmodels.tools.validation import array_like
label_desc: Use image node_id 4 for calling a global function with example usage: _var(indicators, max_dim) and returns: variances,  k