Open josef-pkt opened 3 years ago
Problem with implementing parameter transformatiion is that the unconstrained score and hessian are not appropriate for the constrained optimization.
Similar problem is already in hardcoded optional transformation for extra variance params in count models. We need to add derivatives of the transformation depending on whether the transformation is used or not. It also depends on whether the optimization method uses the derivatives. We had problems and might still have some in the newer countmodels like NBP and GPP.
For that case it would be cleaner to add a link for the extra params, given that we have explicit derivatives for link functions.
OrderedModel parameterization is messy. I parameterize the model to impose monotonicity constraint across parameters, but then derivatives, score and hessian, for those became to complex and I did not add analytical derivatives.
The current generic fit_constrained is easier because it has a well defined auxiliary model without constraints.
fix_params constraints are also easy because either the derivative is unconstrained or the derivative drops out (zero or not used)
GenericLikelihoodModel added the pattern for fixing params a long time ago, based on parameter transformation or expansion/reduction.
_transparams
attribute to select whether to switch between linear and exp ilink for extra dispersion parametersMy generic
fit_constrained
used in GLM also transform exog in addition to params and uses offset.issue here
fix_params
fix_params
only uses a mask for parameters fixed at user given values.can we extend this to
fix params: constraint on individual parameters, e.g. zero constraint, p1 = value = 0
simple case : impose two parameters are the same: p1 = p2 = p
x1 + x2
as regressor, optimize reduced model,p
and compute loglike based onp1, p2
(maybe I have some code for this in orthogonal complement linalg tools) (will in general not be unique)nonlinear case: e.g.
p1 / p2 = value
or implicit functiong(p1, p2) = value
parameter transformation, max w.r.t.p2
, in loglike setp1 = p2 * value
But in general case, we need to make implicit function into function that maps constrained to unconstrained parameter space.specific cases currently not supported to get started: