def arma_order_select_ic(y, max_ar=4, max_ma=2, ic='bic', trend='c', model_kw={}, fit_kw={}):
    "\n    Returns information criteria for many ARMA models\n\n    Parameters\n    ----------\n    y : array-like\n        Time-series data\n    max_ar : int\n        Maximum number of AR lags to use. Default 4.\n    max_ma : int\n        Maximum number of MA lags to use. Default 2.\n    ic : str, list\n        Information criteria to report. Either a single string or a list\n        of different criteria is possible.\n    trend : str\n        The trend to use when fitting the ARMA models.\n    model_kw : dict\n        Keyword arguments to be passed to the ``ARMA`` model\n    fit_kw : dict\n        Keyword arguments to be passed to ``ARMA.fit``.\n\n    Returns\n    -------\n    obj : Results object\n        Each ic is an attribute with a DataFrame for the results. The AR order\n        used is the row index. The ma order used is the column index. The\n        minimum orders are available as ``ic_min_order``.\n\n    Examples\n    --------\n\n    >>> from statsmodels.tsa.arima_process import arma_generate_sample\n    >>> import statsmodels.api as sm\n    >>> import numpy as np\n\n    >>> arparams = np.array([.75, -.25])\n    >>> maparams = np.array([.65, .35])\n    >>> arparams = np.r_[1, -arparams]\n    >>> maparam = np.r_[1, maparams]\n    >>> nobs = 250\n    >>> np.random.seed(2014)\n    >>> y = arma_generate_sample(arparams, maparams, nobs)\n    >>> res = sm.tsa.arma_order_select_ic(y, ic=['aic', 'bic'], trend='nc')\n    >>> res.aic_min_order\n    >>> res.bic_min_order\n\n    Notes\n    -----\n    This method can be used to tentatively identify the order of an ARMA\n    process, provided that the time series is stationary and invertible. This\n    function computes the full exact MLE estimate of each model and can be,\n    therefore a little slow. An implementation using approximate estimates\n    will be provided in the future. In the meantime, consider passing\n    {method : 'css'} to fit_kw.\n    "
    from pandas import DataFrame
    ar_range = lrange(0, (max_ar + 1))
    ma_range = lrange(0, (max_ma + 1))
    if isinstance(ic, string_types):
        ic = [ic]
    elif (not isinstance(ic, (list, tuple))):
        raise ValueError('Need a list or a tuple for ic if not a string.')
    results = np.zeros((len(ic), (max_ar + 1), (max_ma + 1)))
    for ar in ar_range:
        for ma in ma_range:
            if ((ar == 0) and (ma == 0) and (trend == 'nc')):
                results[:, ar, ma] = np.nan
                continue
            mod = _safe_arma_fit(y, (ar, ma), model_kw, trend, fit_kw)
            if (mod is None):
                results[:, ar, ma] = np.nan
                continue
            for (i, criteria) in enumerate(ic):
                results[(i, ar, ma)] = getattr(mod, criteria)
    dfs = [DataFrame(res, columns=ma_range, index=ar_range) for res in results]
    res = dict(zip(ic, dfs))
    min_res = {}
    for (i, result) in iteritems(res):
        mins = np.where((result.min().min() == result))
        min_res.update({(i + '_min_order'): (mins[0][0], mins[1][0])})
    res.update(min_res)
    return Bunch(**res)
Returns information criteria for many ARMA models

Parameters
----------
y : array-like
    Time-series data
max_ar : int
    Maximum number of AR lags to use. Default 4.
max_ma : int
    Maximum number of MA lags to use. Default 2.
ic : str, list
    Information criteria to report. Either a single string or a list
    of different criteria is possible.
trend : str
    The trend to use when fitting the ARMA models.
model_kw : dict
    Keyword arguments to be passed to the ``ARMA`` model
fit_kw : dict
    Keyword arguments to be passed to ``ARMA.fit``.

Returns
-------
obj : Results object
    Each ic is an attribute with a DataFrame for the results. The AR order
    used is the row index. The ma order used is the column index. The
    minimum orders are available as ``ic_min_order``.

Examples
--------

>>> from statsmodels.tsa.arima_process import arma_generate_sample
>>> import statsmodels.api as sm
>>> import numpy as np

>>> arparams = np.array([.75, -.25])
>>> maparams = np.array([.65, .35])
>>> arparams = np.r_[1, -arparams]
>>> maparam = np.r_[1, maparams]
>>> nobs = 250
>>> np.random.seed(2014)
>>> y = arma_generate_sample(arparams, maparams, nobs)
>>> res = sm.tsa.arma_order_select_ic(y, ic=['aic', 'bic'], trend='nc')
>>> res.aic_min_order
>>> res.bic_min_order

Notes
-----
This method can be used to tentatively identify the order of an ARMA
process, provided that the time series is stationary and invertible. This
function computes the full exact MLE estimate of each model and can be,
therefore a little slow. An implementation using approximate estimates
will be provided in the future. In the meantime, consider passing
{method : 'css'} to fit_kw.
def arma_order_select_ic(y, max_ar=4, max_ma=2, ic='bic', trend='c', model_kw={}, fit_kw={}):
    "\n    Returns information criteria for many ARMA models\n\n    Parameters\n    ----------\n    y : array-like\n        Time-series data\n    max_ar : int\n        Maximum number of AR lags to use. Default 4.\n    max_ma : int\n        Maximum number of MA lags to use. Default 2.\n    ic : str, list\n        Information criteria to report. Either a single string or a list\n        of different criteria is possible.\n    trend : str\n        The trend to use when fitting the ARMA models.\n    model_kw : dict\n        Keyword arguments to be passed to the ``ARMA`` model\n    fit_kw : dict\n        Keyword arguments to be passed to ``ARMA.fit``.\n\n    Returns\n    -------\n    obj : Results object\n        Each ic is an attribute with a DataFrame for the results. The AR order\n        used is the row index. The ma order used is the column index. The\n        minimum orders are available as ``ic_min_order``.\n\n    Examples\n    --------\n\n    >>> from statsmodels.tsa.arima_process import arma_generate_sample\n    >>> import statsmodels.api as sm\n    >>> import numpy as np\n\n    >>> arparams = np.array([.75, -.25])\n    >>> maparams = np.array([.65, .35])\n    >>> arparams = np.r_[1, -arparams]\n    >>> maparam = np.r_[1, maparams]\n    >>> nobs = 250\n    >>> np.random.seed(2014)\n    >>> y = arma_generate_sample(arparams, maparams, nobs)\n    >>> res = sm.tsa.arma_order_select_ic(y, ic=['aic', 'bic'], trend='nc')\n    >>> res.aic_min_order\n    >>> res.bic_min_order\n\n    Notes\n    -----\n    This method can be used to tentatively identify the order of an ARMA\n    process, provided that the time series is stationary and invertible. This\n    function computes the full exact MLE estimate of each model and can be,\n    therefore a little slow. An implementation using approximate estimates\n    will be provided in the future. In the meantime, consider passing\n    {method : 'css'} to fit_kw.\n    "
    from pandas import DataFrame
    ar_range = lrange(0, (max_ar + 1))
    ma_range = lrange(0, (max_ma + 1))
    if isinstance(ic, string_types):
        ic = [ic]
    elif (not isinstance(ic, (list, tuple))):
        raise ValueError('Need a list or a tuple for ic if not a string.')
    results = np.zeros((len(ic), (max_ar + 1), (max_ma + 1)))
    for ar in ar_range:
        for ma in ma_range:
            if ((ar == 0) and (ma == 0) and (trend == 'nc')):
                results[:, ar, ma] = np.nan
                continue
            mod = _safe_arma_fit(y, (ar, ma), model_kw, trend, fit_kw)
            if (mod is None):
                results[:, ar, ma] = np.nan
                continue
            for (i, criteria) in enumerate(ic):
                results[(i, ar, ma)] = getattr(mod, criteria)
    dfs = [DataFrame(res, columns=ma_range, index=ar_range) for res in results]
    res = dict(zip(ic, dfs))
    min_res = {}
    for (i, result) in iteritems(res):
        mins = np.where((result.min().min() == result))
        min_res.update({(i + '_min_order'): (mins[0][0], mins[1][0])})
    res.update(min_res)
    return Bunch(**res)