code: def test_combine_subset_regression(self):
      # split sample into two, use first sample as prior for second
      endog = self.endog
      exog = self.exog
      nobs = len(endog)
  
      n05 = nobs // 2
      np.random.seed(987125)
      # shuffle to get random subsamples
      shuffle_idx = np.random.permutation(np.arange(nobs))
      ys = endog[shuffle_idx]
      xs = exog[shuffle_idx]
      k = 10
      res_ols0 = OLS(ys[:n05], xs[:n05, :k]).fit()
      res_ols1 = OLS(ys[n05:], xs[n05:, :k]).fit()
  
      w = res_ols1.scale / res_ols0.scale  # 1.01
      mod_1 = TheilGLS(
          ys[n05:],
          xs[n05:, :k],
          r_matrix=np.eye(k),
          q_matrix=res_ols0.params,
          sigma_prior=w * res_ols0.cov_params(),
      )
      res_1p = mod_1.fit(cov_type="data-prior")
      res_1s = mod_1.fit(cov_type="sandwich")
      res_olsf = OLS(ys, xs[:, :k]).fit()
  
      assert_allclose(res_1p.params, res_olsf.params, rtol=1e-9)
      corr_fact = np.sqrt(res_1p.scale / res_olsf.scale)
      # corrct for differences in scale computation
      assert_allclose(res_1p.bse, res_olsf.bse * corr_fact, rtol=1e-3)
  
      # regression test, does not verify numbers
      # especially why are these smaller than OLS on full sample
      # in larger sample, nobs=600, those were close to full OLS
      bse1 = np.array(
          [
              0.26589869,
              0.15224812,
              0.38407399,
              0.75679949,
              0.66084200,
              0.54174080,
              0.53697607,
              0.66006377,
              0.38228551,
              0.53920485,
          ]
      )
      assert_allclose(res_1s.bse, bse1, rtol=1e-7)
  
imports: import os
  import numpy
  import pandas
  import pytest
  from numpy.testing import assert_allclose
  from statsmodels.regression.linear_model import OLS, GLS
  from statsmodels.sandbox.regression.penalized import TheilGLS
label_desc: Use image node_id 3 for calling the TestTheilPanel obj's underlying member method code with example usage: obj.test_combine_subset_regression() without return types