code: def test_glm(self):
      # prelimnimary, getting started with basic test for GLM.get_prediction
      from statsmodels.genmod.generalized_linear_model import GLM
  
      res_wls = self.res_wls
      mod_wls = res_wls.model
      y, X, wi = mod_wls.endog, mod_wls.exog, mod_wls.weights
  
      w_sqrt = np.sqrt(wi)  # notation wi is weights, `w` is var
      mod_glm = GLM(y * w_sqrt, X * w_sqrt[:, None])
  
      # compare using t distribution
      res_glm = mod_glm.fit(use_t=True)
      pred_glm = res_glm.get_prediction()
      sf_glm = pred_glm.summary_frame()
  
      pred_res_wls = res_wls.get_prediction()
      sf_wls = pred_res_wls.summary_frame()
      n_compare = 30  # in glm with predict wendog
      assert_allclose(
          sf_glm.values[:n_compare], sf_wls.values[:n_compare, :4]
      )
  
      # compare using normal distribution
  
      res_glm = mod_glm.fit()  # default use_t=False
      pred_glm = res_glm.get_prediction()
      sf_glm = pred_glm.summary_frame()
  
      res_wls = mod_wls.fit(use_t=False)
      pred_res_wls = res_wls.get_prediction()
      sf_wls = pred_res_wls.summary_frame()
      assert_allclose(
          sf_glm.values[:n_compare], sf_wls.values[:n_compare, :4]
      )
  
      # function for parameter transformation
      # should be separate test method
      from statsmodels.base._prediction_inference import (
          params_transform_univariate,
      )
  
      rates = params_transform_univariate(
          res_glm.params, res_glm.cov_params()
      )
  
      rates2 = np.column_stack(
          (
              np.exp(res_glm.params),
              res_glm.bse * np.exp(res_glm.params),
              np.exp(res_glm.conf_int()),
          )
      )
      assert_allclose(rates.summary_frame().values, rates2, rtol=1e-13)
  
      from statsmodels.genmod.families import links
  
      # with identity transform
      pt = params_transform_univariate(
          res_glm.params, res_glm.cov_params(), link=links.Identity()
      )
  
      assert_allclose(pt.tvalues, res_glm.tvalues, rtol=1e-13)
      assert_allclose(pt.se_mean, res_glm.bse, rtol=1e-13)
      ptt = pt.t_test()
      assert_allclose(ptt[0], res_glm.tvalues, rtol=1e-13)
      assert_allclose(ptt[1], res_glm.pvalues, rtol=1e-13)
  
      # prediction with exog and no weights does not error
      res_glm = mod_glm.fit()
      pred_glm = res_glm.get_prediction(X)
  
      # check that list works, issue 4437
      x = res_glm.model.exog.mean(0)
      pred_res3 = res_glm.get_prediction(x)
      ci3 = pred_res3.conf_int()
      pred_res3b = res_glm.get_prediction(x.tolist())
      ci3b = pred_res3b.conf_int()
      assert_allclose(pred_res3b.se_mean, pred_res3.se_mean, rtol=1e-13)
      assert_allclose(ci3b, ci3, rtol=1e-13)
      res_df = pred_res3b.summary_frame()
      assert_equal(res_df.index.values, [0])
  
      x = res_glm.model.exog[-2:]
      pred_res3 = res_glm.get_prediction(x)
      ci3 = pred_res3.conf_int()
      pred_res3b = res_glm.get_prediction(x.tolist())
      ci3b = pred_res3b.conf_int()
      assert_allclose(pred_res3b.se_mean, pred_res3.se_mean, rtol=1e-13)
      assert_allclose(ci3b, ci3, rtol=1e-13)
      res_df = pred_res3b.summary_frame()
      assert_equal(res_df.index.values, [0, 1])
  
file_path: statsmodels/statsmodels/regression/tests/test_predict.py
imports: import numpy
  from numpy.testing import assert_allclose, assert_equal
  import pandas
  from statsmodels.regression.linear_model import OLS, WLS
  from statsmodels.sandbox.regression.predstd import wls_prediction_std
  from statsmodels.regression._prediction import get_prediction
label_desc: Use image node_id 3 for calling the TestWLSPrediction obj's underlying member method code with example usage: obj.test_glm() without return types