statsmodels.genmod.generalized_linear_model.GLM.fit_constrained

GLM.fit_constrained(constraints, start_params=None, **fit_kwds)[source]

fit the model subject to linear equality constraints

The constraints are of the form R params = q where R is the constraint_matrix and q is the vector of constraint_values.

The estimation creates a new model with transformed design matrix, exog, and converts the results back to the original parameterization.

Parameters
constraintsformula expression or tuple

If it is a tuple, then the constraint needs to be given by two arrays (constraint_matrix, constraint_value), i.e. (R, q). Otherwise, the constraints can be given as strings or list of strings. see t_test for details

start_paramsNone or array_like

starting values for the optimization. start_params needs to be given in the original parameter space and are internally transformed.

**fit_kwdskeyword arguments

fit_kwds are used in the optimization of the transformed model.

Returns
resultsResults instance