class_docstr: Plotter for numeric independent variables with regression model.
  
  This does the computations and drawing for the `regplot` function, and
  is thus also used indirectly by `lmplot`.
class_docstr_tok: ["Plotter","for","numeric","independent","variables","with","regression","model",".","This","does","the","computations","and","drawing","for","the","`","regplot","`","function",",","and","is","thus","also","used","indirectly","by","`","lmplot","`","."]
docstr: More general regression function using statsmodels objects.
docstr_tok: ["More","general","regression","function","using","statsmodels","objects","."]
code: def fit_statsmodels(self, grid, model, **kwargs):
      """More general regression function using statsmodels objects."""
      import statsmodels.tools.sm_exceptions as sme
  
      X, y = np.c_[np.ones(len(self.x)), self.x], self.y
      grid = np.c_[np.ones(len(grid)), grid]
  
      def reg_func(_x, _y):
          err_classes = (sme.PerfectSeparationError,)
          try:
              with warnings.catch_warnings():
                  if hasattr(sme, "PerfectSeparationWarning"):
                      # statsmodels>=0.14.0
                      warnings.simplefilter(
                          "error", sme.PerfectSeparationWarning
                      )
                      err_classes = (
                          *err_classes,
                          sme.PerfectSeparationWarning,
                      )
                  yhat = model(_y, _x, **kwargs).fit().predict(grid)
          except err_classes:
              yhat = np.empty(len(grid))
              yhat.fill(np.nan)
          return yhat
  
      yhat = reg_func(X, y)
      if self.ci is None:
          return yhat, None
  
      yhat_boots = algo.bootstrap(
          X,
          y,
          func=reg_func,
          n_boot=self.n_boot,
          units=self.units,
          seed=self.seed,
      )
      return yhat, yhat_boots
  
imports: import copy
  from textwrap import dedent
  import warnings
  import numpy
  import pandas
  import matplotlib
  import matplotlib.pyplot
  from .None import utils
  from .None import algorithms
  from .axisgrid import FacetGrid, _facet_docs
label_desc: Use image node_id 8 for calling the _RegressionPlotter obj's underlying member method code with example usage: obj.fit_statsmodels(grid, model) and returns: yhat,  yhat_boots, yhat, yhat,  None