code: def test_formula(self, close_figures):
      np.random.seed(542)
      n = 500
      x1 = np.random.normal(size=n)
      x2 = np.random.normal(size=n)
      x3 = np.random.normal(size=n)
      x4 = np.random.randint(0, 5, size=n)
      x4 = np.asarray(["ABCDE"[i] for i in x4])
      x5 = np.random.normal(size=n)
      y = (
          0.3 * x2**2
          + (x4 == "B")
          + 0.1 * (x4 == "B") * x2**2
          + x5
          + np.random.normal(size=n)
      )
  
      df = pd.DataFrame(
          {"y": y, "x1": x1, "x2": x2, "x3": x3, "x4": x4, "x5": x5}
      )
  
      fml = "y ~ x1 + bs(x2, df=4) + x3 + x2*x3 + I(x1**2) + C(x4) + C(x4)*bs(x2, df=4) + x5"
      model = sm.OLS.from_formula(fml, data=df)
      result = model.fit()
  
      summaries = {"x1": np.mean, "x3": pctl(0.75), "x5": np.mean}
  
      values = {"x4": "B"}
      pr1, ci1, fvals1 = predict_functional(
          result, "x2", summaries, values
      )
  
      values = {"x4": "C"}
      pr2, ci2, fvals2 = predict_functional(
          result, "x2", summaries, values
      )
  
      plt.clf()
      fig = plt.figure()
      ax = plt.axes([0.1, 0.1, 0.7, 0.8])
      plt.plot(fvals1, pr1, "-", label="x4=B")
      plt.plot(fvals2, pr2, "-", label="x4=C")
      ha, lb = ax.get_legend_handles_labels()
      plt.figlegend(ha, lb, loc="center right")
      plt.xlabel("Focus variable", size=15)
      plt.ylabel("Fitted mean", size=15)
      plt.title("Linear model prediction")
      self.close_or_save(fig)
  
      plt.clf()
      fig = plt.figure()
      ax = plt.axes([0.1, 0.1, 0.7, 0.8])
      plt.plot(fvals1, pr1, "-", label="x4=B")
      plt.fill_between(fvals1, ci1[:, 0], ci1[:, 1], color="grey")
      plt.plot(fvals2, pr2, "-", label="x4=C")
      plt.fill_between(fvals2, ci2[:, 0], ci2[:, 1], color="grey")
      ha, lb = ax.get_legend_handles_labels()
      plt.figlegend(ha, lb, loc="center right")
      plt.xlabel("Focus variable", size=15)
      plt.ylabel("Fitted mean", size=15)
      plt.title("Linear model prediction")
      self.close_or_save(fig)
  
file_path: statsmodels/statsmodels/sandbox/tests/test_predict_functional.py
imports: from statsmodels.sandbox.predict_functional import predict_functional
  import numpy
  import pandas
  import pytest
  import statsmodels.api
label_desc: Use image node_id 4 for calling the TestPredFunc obj's underlying member method code with example usage: obj.test_formula(close_figures) without return types