statsmodels.discrete.truncated_model.HurdleCountModel.fit_regularized#
- HurdleCountModel.fit_regularized(start_params=None, method='l1', maxiter='defined_by_method', full_output=1, disp=1, callback=None, alpha=0, trim_mode='auto', auto_trim_tol=0.01, size_trim_tol=0.0001, qc_tol=0.03, **kwargs)[source]#
Fit the model using a regularized maximum likelihood.
The zero model and the main model are penalized and fit separately, and the combined parameter vector is then refit jointly.
- Parameters:
- start_paramsarray_like,
optional Initial guess of the solution for the log-likelihood maximization. The default is an array of zeros. Ordered as described under alpha.
- method{‘l1’, ‘l1_cvxopt_cp’},
optional See notes for details.
- maxiter
intor ‘defined_by_method’,optional Maximum number of iterations to perform. If ‘defined_by_method’, then use method defaults (see notes).
- full_outputbool,
optional Set to True to have all available output in the Results object’s mle_retvals attribute. The output is dependent on the solver. See LikelihoodModelResults notes section for more information.
- dispbool,
optional Set to True to print convergence messages.
- callback
callable,optional Called after each iteration, as callback(xk), where xk is the current parameter vector.
- alpha
floator array_like,optional Non-negative. The weight multiplying the l1 penalty term. If a scalar, every exog parameter of both components is penalized by this value and the extra parameters are left unpenalized, for example the shape parameter of a NegativeBinomialP component.
If an array, it must have one entry per parameter, ordered as the zero model’s exog parameters, the zero model’s extra parameters, the main model’s exog parameters and then the main model’s extra parameters. For example, a hurdle model with 3 exog variables,
zerodist="poisson"anddist="negbin"takes an alpha of length 7, whose last entry is the weight on the main model’s shape parameter.- trim_mode{‘auto’, ‘size’, ‘off’},
optional If not ‘off’, trim (set to zero) parameters that would have been zero if the solver reached the theoretical minimum. If ‘auto’, trim params using the theory in the notes below. If ‘size’, trim params if they have very small absolute value.
- auto_trim_tol
float,optional Tolerance used when trim_mode == ‘auto’.
- size_trim_tol
float,optional Tolerance used when trim_mode == ‘size’.
- qc_tol
float,optional Print warning and do not allow auto trim when condition (ii) in the notes below is violated by this much.
- **kwargs
Additional keyword arguments used when fitting the model.
- start_paramsarray_like,
- Returns:
L1HurdleCountResultsWrapperA results instance.
Notes
Using ‘l1_cvxopt_cp’ requires the cvxopt module.
Optional arguments for the solvers (available in Results.mle_settings):
'l1' acc : float (default 1e-6) Requested accuracy as used by slsqp 'l1_cvxopt_cp' abstol : float absolute accuracy (default: 1e-7). reltol : float relative accuracy (default: 1e-6). feastol : float tolerance for feasibility conditions (default: 1e-7). refinement : int number of iterative refinement steps when solving KKT equations (default: 1).
Optimization methodology
With \(L\) the negative log likelihood, we solve the convex but non-smooth problem
\[\min_\beta L(\beta) + \sum_k\alpha_k |\beta_k|\]via the transformation to the smooth, convex, constrained problem in twice as many variables (adding the “added variables” \(u_k\))
\[\min_{\beta,u} L(\beta) + \sum_k\alpha_k u_k,\]subject to
\[-u_k \leq \beta_k \leq u_k.\]With \(\partial_k L\) the derivative of \(L\) in the \(k^{th}\) parameter direction, theory dictates that, at the minimum, exactly one of two conditions holds:
\(|\partial_k L| = \alpha_k\) and \(\beta_k \neq 0\)
\(|\partial_k L| \leq \alpha_k\) and \(\beta_k = 0\)