class_docstr: Generalized Additive Models (GAM)
  
  This inherits from `GLM`.
  
  Warning: Not all inherited methods might take correctly account of the
  penalization. Not all options including offset and exposure have been
  verified yet.
  
  Parameters
  ----------
  endog : array_like
      The response variable.
  exog : array_like or None
      This explanatory variables are treated as linear. The model in this
      case is a partial linear model.
  smoother : instance of additive smoother class
      Examples of smoother instances include Bsplines or CyclicCubicSplines.
  alpha : float or list of floats
      Penalization weights for smooth terms. The length of the list needs
      to be the same as the number of smooth terms in the ``smoother``.
  family : instance of GLM family
      See GLM.
  offset : None or array_like
      See GLM.
  exposure : None or array_like
      See GLM.
  missing : 'none'
      Missing value handling is not supported in this class.
  **kwargs
      Extra keywords are used in call to the super classes.
  
  Notes
  -----
  Status: experimental. This has full unit test coverage for the core
  results with Gaussian and Poisson (without offset and exposure). Other
  options and additional results might not be correctly supported yet.
  (Binomial with counts, i.e. with n_trials, is most likely wrong in pirls.
  User specified var or freq weights are most likely also not correct for
  all results.)
class_docstr_tok: ["Generalized","Additive","Models","(","GAM",")","This","inherits","from","`","GLM","`",".","Warning",":","Not","all","inherited","methods","might","take","correctly","account","of","the","penalization",".","Not","all","options","including","offset","and","exposure","have","been","verified","yet",".","Parameters","--","--","--","--","--","endog",":","array_like","The","response","variable",".","exog",":","array_like","or","None","This","explanatory","variables","are","treated","as","linear",".","The","model","in","this","case","is","a","partial","linear","model",".","smoother",":","instance","of","additive","smoother","class","Examples","of","smoother","instances","include","Bsplines","or","CyclicCubicSplines",".","alpha",":","float","or","list","of","floats","Penalization","weights","for","smooth","terms",".","The","length","of","the","list","needs","to","be","the","same","as","the","number","of","smooth","terms","in","the","``","smoother","``",".","family",":","instance","of","GLM","family","See","GLM",".","offset",":","None","or","array_like","See","GLM",".","exposure",":","None","or","array_like","See","GLM",".","missing",":","'none'","Missing","value","handling","is","not","supported","in","this","class",".","*","*","kwargs","Extra","keywords","are","used","in","call","to","the","super","classes",".","Notes","--","--","-","Status",":","experimental",".","This","has","full","unit","test","coverage","for","the","core","results","with","Gaussian","and","Poisson","(","without","offset","and","exposure",")",".","Other","options","and","additional","results","might","not","be","correctly","supported","yet",".","(","Binomial","with","counts",",","i.e",".","with","n_trials",",","is","most","likely","wrong","in","pirls",".","User","specified","var","or","freq","weights","are","most","likely","also","not","correct","for","all","results",".",")"]
docstr: estimate parameters and create instance of GLMGamResults class
  
  Parameters
  ----------
  most parameters are the same as for GLM
  method : optimization method
      The special optimization method is "pirls" which uses a penalized
      version of IRLS. Other methods are gradient optimizers as used in
      base.model.LikelihoodModel.
  
  Returns
  -------
  res : instance of wrapped GLMGamResults
docstr_tok: ["estimate","parameters","and","create","instance","of","GLMGamResults","class","Parameters","--","--","--","--","--","most","parameters","are","the","same","as","for","GLM","method",":","optimization","method","The","special","optimization","method","is","``","pirls","''","which","uses","a","penalized","version","of","IRLS",".","Other","methods","are","gradient","optimizers","as","used","in","base.model.LikelihoodModel",".","Returns","--","--","--","-","res",":","instance","of","wrapped","GLMGamResults"]
code: def fit(
      self,
      start_params=None,
      maxiter=1000,
      method="pirls",
      tol=1e-8,
      scale=None,
      cov_type="nonrobust",
      cov_kwds=None,
      use_t=None,
      full_output=True,
      disp=False,
      max_start_irls=3,
      **kwargs,
  ):
      """estimate parameters and create instance of GLMGamResults class
  
      Parameters
      ----------
      most parameters are the same as for GLM
      method : optimization method
          The special optimization method is "pirls" which uses a penalized
          version of IRLS. Other methods are gradient optimizers as used in
          base.model.LikelihoodModel.
  
      Returns
      -------
      res : instance of wrapped GLMGamResults
      """
      # TODO: temporary hack to remove attribute
      # formula also might be attached which in inherited from_formula
      # causes problems in predict
      if hasattr(self, "formula"):
          self.formula_linear = self.formula
          del self.formula
  
      # TODO: alpha not allowed yet, but is in `_fit_pirls`
      # alpha = self._check_alpha()
  
      if method.lower() in ["pirls", "irls"]:
          res = self._fit_pirls(
              self.alpha,
              start_params=start_params,
              maxiter=maxiter,
              tol=tol,
              scale=scale,
              cov_type=cov_type,
              cov_kwds=cov_kwds,
              use_t=use_t,
              **kwargs,
          )
      else:
          if max_start_irls > 0 and (start_params is None):
              res = self._fit_pirls(
                  self.alpha,
                  start_params=start_params,
                  maxiter=max_start_irls,
                  tol=tol,
                  scale=scale,
                  cov_type=cov_type,
                  cov_kwds=cov_kwds,
                  use_t=use_t,
                  **kwargs,
              )
              start_params = res.params
              del res
          res = super().fit(
              start_params=start_params,
              maxiter=maxiter,
              method=method,
              tol=tol,
              scale=scale,
              cov_type=cov_type,
              cov_kwds=cov_kwds,
              use_t=use_t,
              full_output=full_output,
              disp=disp,
              max_start_irls=0,
              **kwargs,
          )
      return res
  
imports: from collections.abc import Iterable
  import copy
  import numpy
  from scipy import optimize
  import pandas
  import statsmodels.base.wrapper
  from statsmodels.discrete.discrete_model import Logit
  from statsmodels.genmod.generalized_linear_model import GLM, GLMResults, GLMResultsWrapper, _check_convergence
  import statsmodels.regression.linear_model
  from statsmodels.tools.sm_exceptions import PerfectSeparationError, ValueWarning
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.tools.data import _is_using_pandas
  from statsmodels.tools.linalg import matrix_sqrt
  from statsmodels.base._penalized import PenalizedMixin
  from statsmodels.gam.gam_penalties import MultivariateGamPenalty
  from statsmodels.gam.gam_cross_validation.gam_cross_validation import MultivariateGAMCVPath
  from statsmodels.gam.gam_cross_validation.cross_validators import KFold
label_desc: Use image node_id 3 for calling the GLMGam obj's underlying member method code with example usage: obj.fit(start_params, maxiter, method, tol, scale, cov_type, cov_kwds, use_t, full_output, disp, max_start_irls) and returns: res