code: def _chi_squared(self, proportions, margin, observed):
          
          n = self._element_count
          chi_squared = np.zeros([n, n])
          for i in xrange(1, n):
              for j in xrange(0, n - 1):
                  denominator = 1 / margin[i] + 1 / margin[j]
                  chi_squared[i, j] = chi_squared[j, i] = (
                      np.sum(np.square(proportions[:, i] - proportions[:, j]) / observed)
                      / denominator
                  )
          return chi_squared
docs: return ndarray of chi-squared measures for proportions' columns.
  
          *proportions* (ndarray): The basis of chi-squared calcualations
          *margin* (ndarray): Column margin for proportions (See `def _margin`)
          *observed* (ndarray): Row margin proportions (See `def _observed`)