code: def test_predict(self):
      res1 = self.res1
      endog = res1.model.endog
      exog = res1.model.exog
  
      pred_mean = res1.predict(which="mean").mean()
      assert_allclose(pred_mean, endog.mean(), rtol=1e-2)
  
      mask_nz = endog > 0
      mean_nz = endog[mask_nz].mean()
      pred_mean_nz = res1.predict(which="mean-nonzero").mean()
      assert_allclose(pred_mean_nz, mean_nz, rtol=0.05)
      # Note: the Truncated model is based on different exog
      # prediction for nonzero part is better in nonzero sample than full
      pred_mean_nnz = res1.predict(
          exog=exog[mask_nz], which="mean-nonzero"
      ).mean()
      assert_allclose(pred_mean_nnz, mean_nz, rtol=5e-4)
  
      pred_mean_nzm = res1.results_count.predict(which="mean").mean()
      assert_allclose(pred_mean_nzm, mean_nz, rtol=5e-4)
      assert_allclose(pred_mean_nzm, pred_mean_nnz, rtol=1e-4)
  
      # check variance
      pred_var = res1.predict(which="var").mean()
      assert_allclose(pred_var, res1.resid.var(), rtol=0.05)
  
      pred_var = res1.results_count.predict(which="var").mean()
      assert_allclose(pred_var, res1.resid[endog > 0].var(), rtol=0.05)
  
      # check probabilities
      freq = np.bincount(endog.astype(int)) / len(endog)
      pred_prob = res1.predict(which="prob").mean(0)
      assert_allclose(pred_prob, freq, rtol=0.005, atol=0.01)
      dia_hnb = res1.get_diagnostic()
      assert_allclose(
          dia_hnb.probs_predicted.mean(0), pred_prob, rtol=1e-10
      )
      try:
          dia_hnb.plot_probs()
      except ImportError:
          pass
  
      pred_prob0 = res1.predict(which="prob-zero").mean(0)
      assert_allclose(pred_prob0, freq[0], rtol=1e-4)
      assert_allclose(pred_prob0, pred_prob[0], rtol=1e-10)
  
imports: import warnings
  import numpy
  from numpy.testing import assert_allclose, assert_equal
  from statsmodels import datasets
  from statsmodels.tools.tools import add_constant
  from statsmodels.tools.testing import Holder
  from statsmodels.tools.sm_exceptions import ConvergenceWarning
  from statsmodels.distributions.discrete import truncatedpoisson, truncatednegbin
  from statsmodels.discrete.truncated_model import TruncatedLFPoisson, TruncatedLFNegativeBinomialP, HurdleCountModel
  from statsmodels.sandbox.regression.tests.test_gmm_poisson import DATA
  from .results.results_discrete import RandHIE
  from .results import results_truncated
  from .results import results_truncated_st
label_desc: Use image node_id 2 for calling the CheckHurdlePredict obj's underlying member method code with example usage: obj.test_predict() without return types