code: def test_brockwell_davis_example_517():
      # Get the lake data
      endog = lake.copy()
  
      # BD do not implement the "bias correction" third step that they describe,
      # so we can't use their results to test that. Thus here `unbiased=False`.
      # Note: it's not clear why BD use initial_order=22 (and they don't mention
      # that they do this), but it is the value that allows the test to pass.
      hr, _ = hannan_rissanen(
          endog,
          ar_order=1,
          ma_order=1,
          demean=True,
          initial_ar_order=22,
          unbiased=False,
      )
      assert_allclose(hr.ar_params, [0.6961], atol=1e-4)
      assert_allclose(hr.ma_params, [0.3788], atol=1e-4)
  
      # Because our fast implementation of the innovations algorithm does not
      # allow for non-stationary processes, the estimate of the variance returned
      # by `hannan_rissanen` is based on the residuals from the least-squares
      # regression, rather than (as reported by BD) based on the innovations
      # algorithm output. Since the estimates here do correspond to a stationary
      # series, we can compute the innovations variance manually to check
      # against BD.
      u, v = arma_innovations(
          endog - endog.mean(), hr.ar_params, hr.ma_params, sigma2=1
      )
      tmp = u / v**0.5
      assert_allclose(np.inner(tmp, tmp) / len(u), 0.4774, atol=1e-4)
  
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose
  from statsmodels.tsa.innovations.arma_innovations import arma_innovations
  from statsmodels.tsa.arima.datasets.brockwell_davis_2002 import lake
  from statsmodels.tsa.arima.estimators.hannan_rissanen import hannan_rissanen, _validate_fixed_params, _package_fixed_and_free_params_info, _stitch_fixed_and_free_params
  from statsmodels.tsa.arima.specification import SARIMAXSpecification
  from statsmodels.tools.tools import Bunch
label_desc: Use image node_id 1 for calling a global function with example usage: test_brockwell_davis_example_517() without return types