is, if one calls::

    res = chi2_contingency(obs, correction=False)

then the following is true::

    (res.statistic, res.pvalue) == stats.chisquare(obs.ravel(),
                                                   f_exp=ex.ravel(),
                                                   ddof=obs.size - 1 - dof)

The `lambda_` argument was added in version 0.13.0 of scipy.

References
----------
.. [1] "Contingency table",
       https://en.wikipedia.org/wiki/Contingency_table
.. [2] "Pearson's chi-squared test",
       https://en.wikipedia.org/wiki/Pearson%27s_chi-squared_test
.. [3] Cressie, N. and Read, T. R. C., "Multinomial Goodness-of-Fit
       Tests", J. Royal Stat. Soc. Series B, Vol. 46, No. 3 (1984),
       pp. 440-464.

Examples
--------
A two-way example (2 x 3):

>>> import numpy as np
>>> from scipy.stats import chi2_contingency
>>> obs = np.array([[10, 10, 20], [20, 20, 20]])
>>> res = chi2_contingency(obs)
>>> res.statistic
2.7777777777777777
>>> res.pvalue
0.24935220877729619
>>> res.dof
2
>>> res.expected_freq
array([[ 12.,  12.,  16.],
       [ 18.,  18.,  24.]])

Perform the test using the log-likelihood ratio (i.e. the "G-test")
instead of Pearson's chi-squared statistic.

>>> res = chi2_contingency(obs, lambda_="log-likelihood")
>>> res.statistic
2.7688587616781319
>>> res.pvalue
0.25046668010954165

A four-way example (2 x 2 x 2 x 2):

>>> obs = np.array(
...     [[[[12, 17],
...        [11, 16]],
...       [[11, 12],
...        [15, 16]]],
...      [[[23, 15],
...        [30, 22]],
...       [[14, 17],
...        [15, 16]]]])
>>> res = chi2_contingency(obs)
>>> res.statistic
8.7584514426741897
>>> res.pvalue
0.64417725029295503

When the sum of the elements in a two-way table is small, the p-value
produced by the default asymptotic approximation may be inaccurate.
Consider passing a `PermutationMethod` or `MonteCarloMethod` as the
`method` parameter with `correction=False`.

>>> from scipy.stats import PermutationMethod
>>> obs = np.asarray([[12, 3],
...                   [17, 16]])
>>> res = chi2_contingency(obs, correction=False)
>>> ref = chi2_contingency(obs, correction=False, method=PermutationMethod())
>>> res.pvalue, ref.pvalue
(0.0614122539870913, 0.1074)  # may vary

For a more detailed example, see :ref:`hypothesis_chi2_contingency`.

r