code: def test_regression_with_arma_errors(ar_params, ma_params, sigma2):
      # Test loglikelihood computation when model has regressors
      nobs = 100
  
      eps = np.random.normal(nobs)
      exog = np.c_[np.ones(nobs), np.random.uniform(size=nobs)]
      beta = [5, -0.2]
      endog = np.dot(exog, beta) + eps
  
      # Innovations algorithm approach
      beta_hat = np.squeeze(np.linalg.pinv(exog).dot(endog))
      demeaned = endog - np.dot(exog, beta_hat)
      llf_obs = arma_innovations.arma_loglikeobs(
          demeaned, ar_params, ma_params, sigma2
      )
  
      # Kalman filter approach
      # (this works since we impose here that the regression coefficients are
      # beta_hat - in practice, the MLE estimates will not necessarily match
      # the OLS estimates beta_hat)
      mod = SARIMAX(
          endog, exog=exog, order=(len(ar_params), 0, len(ma_params))
      )
      res = mod.filter(np.r_[beta_hat, ar_params, ma_params, sigma2])
  
      # Test that the two approaches are identical
      assert_allclose(llf_obs, res.llf_obs)
  
file_path: statsmodels/statsmodels/tsa/innovations/tests/test_cython_arma_innovations_fast.py
imports: import numpy
  import pytest
  from numpy.testing import assert_equal, assert_allclose
  from statsmodels.tsa.arima_process import arma_acovf
  from statsmodels.tsa.innovations import _arma_innovations, arma_innovations
  from statsmodels.tsa.statespace.sarimax import SARIMAX
label_desc: Use image node_id 6 for calling a global function with example usage: test_regression_with_arma_errors(ar_params, ma_params, sigma2) without return types