statsmodels.gam.generalized_additive_model.GLMGam.fit#
- GLMGam.fit(start_params=None, maxiter=1000, method='pirls', tol=1e-08, scale=None, cov_type='nonrobust', cov_kwds=None, use_t=None, full_output=True, disp=False, max_start_irls=3, **kwargs)[source]#
Estimate parameters and create instance of GLMGamResults class
Most parameters are the same as for GLM and are only used to create the results instance.
- Parameters:
- start_paramsarray_like,
optional Initial guess of the solution for the loglikelihood maximization. If None, then the default for
method="pirls"uses the family-specific starting mu, otherwise it is passed through to the underlying optimizer.- maxiter
int,optional Maximum number of iterations. Default is 1000.
- method
str The special optimization method is “pirls” which uses a penalized version of IRLS. This is the default. Other methods are gradient optimizers as used in base.model.LikelihoodModel.fit that are called on the penalized log-likelihood.
- tol
float Convergence tolerance for “pirls”. Default is 1e-8.
- scale
strorfloat,optional scale can be ‘X2’, ‘dev’, or a float. See GLM.fit for details.
- cov_type
str The type of parameter estimate covariance matrix to compute.
- cov_kwdsdict-like
Extra arguments for calculating the covariance of the parameter estimates.
- use_tbool
If True, the Student t-distribution is used for inference.
- full_outputbool,
optional Set to True to have all available output in the Results object’s mle_retvals attribute. Not used if method is “pirls”.
- dispbool,
optional Set to True to print convergence messages. Not used if method is “pirls”.
- max_start_irls
int The number of PIRLS iterations used to obtain starting values for gradient optimization. Only relevant if method is set to something other than “pirls”.
- **kwargs
Additional keyword arguments used in the call to the underlying optimizer.
- start_paramsarray_like,
- Returns:
- res
instanceofwrappedGLMGamResults
- res