code: def test_cochransq():
      # example from dataplot docs, Conovover p. 253
      # http://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/cochran.htm
      x = np.array(
          [
              [1, 1, 1],
              [1, 1, 1],
              [0, 1, 0],
              [1, 1, 0],
              [0, 0, 0],
              [1, 1, 1],
              [1, 1, 1],
              [1, 1, 0],
              [0, 0, 1],
              [0, 1, 0],
              [1, 1, 1],
              [1, 1, 1],
          ]
      )
      res_qstat = 2.8
      res_pvalue = 0.246597
      res = cochrans_q(x)
      assert_almost_equal(
          [res.statistic, res.pvalue], [res_qstat, res_pvalue]
      )
  
      # equivalence of mcnemar and cochranq for 2 samples
      a, b = x[:, :2].T
      res = cochrans_q(x[:, :2])
      with pytest.warns(FutureWarning):
          assert_almost_equal(
              sbmcnemar(a, b, exact=False, correction=False),
              [res.statistic, res.pvalue],
          )
  
imports: from statsmodels.compat.python import lzip
  import numpy
  from numpy.testing import assert_allclose, assert_almost_equal, assert_approx_equal, assert_
  from scipy import stats
  import pytest
  from statsmodels.stats.contingency_tables import mcnemar, cochrans_q, SquareTable
  from statsmodels.sandbox.stats.runs import Runs, runstest_1samp, runstest_2samp
  from statsmodels.sandbox.stats.runs import mcnemar
  from statsmodels.stats.nonparametric import rank_compare_2indep, rank_compare_2ordinal, prob_larger_continuous, cohensd2problarger
  from statsmodels.tools.testing import Holder
label_desc: Use image node_id 6 for calling a global function with example usage: test_cochransq() without return types