code: def test_constraints_stata():
      endog = dta["infl"]
      exog = add_constant(dta[["m1", "unemp"]])
  
      mod = RecursiveLS(endog, exog, constraints="m1 + unemp = 1")
      res = mod.fit()
  
      # See tests/results/test_rls.do
      desired = [-0.7001083844336, -0.0018477514060, 1.0018477514060]
      assert_allclose(res.params, desired)
  
      # See tests/results/test_rls.do
      desired = [0.4699552366, 0.0005369357, 0.0005369357]
      bse = np.asarray(res.bse)
      assert_allclose(bse[0], desired[0], atol=1e-1)
      assert_allclose(bse[1:], desired[1:], atol=1e-4)
  
      # See tests/results/test_rls.do
      desired = -534.4292052931121
      # Note that to compute what Stata reports as the llf, we need to use a
      # different denominator for estimating the scale, and then compute the
      # llf from the alternative recursive residuals
      scale_alternative = (
          np.sum(
              (
                  res.standardized_forecasts_error[0, 1:]
                  * res.filter_results.obs_cov[0, 0] ** 0.5
              )
              ** 2
          )
          / mod.nobs
      )
      llf_alternative = np.log(
          norm.pdf(
              res.resid_recursive, loc=0, scale=scale_alternative**0.5
          )
      ).sum()
      assert_allclose(llf_alternative, desired)
  
imports: import os
  import numpy
  from numpy.testing import assert_allclose, assert_equal, assert_raises
  import pandas
  import pytest
  from scipy.stats import norm
  from statsmodels.datasets import macrodata
  from statsmodels.genmod.api import GLM
  from statsmodels.regression.linear_model import OLS
  from statsmodels.regression.recursive_ls import RecursiveLS
  from statsmodels.stats.diagnostic import recursive_olsresiduals
  from statsmodels.tools import add_constant
  from statsmodels.tools.eval_measures import aic, bic
  from statsmodels.tools.sm_exceptions import ValueWarning
label_desc: Use image node_id 13 for calling a global function with example usage: test_constraints_stata() without return types