Skip to content

Design: handling of transformed parameters #2256

Open

Description

@josef-pkt

There are different problems when we reparameterize for optimization

for SARIMAX: https://github.com/statsmodels/statsmodels/issues/#2252#issuecomment-74252465
for MixedLM: #2231

frequently used design (Skipper's code) set transform_params flag as attribute for likelihood calculation.

in fit_restricted or fit_transformed, I create a separate transformed model, but it's because of the data transformation and not just parameter transformation.

There is also a constraint fit with parameter transformation for restrictions in GenericLikelihoodModel. IIRC there is no choice in that case once the transformation, restriction has been set, and results params, bse,... are for transformed params.

Activity

  1. josef-pkt commented on Feb 18, 2018

    @josef-pkt
    MemberAuthor

    another point confidence interval by endpoint transformation

    if an extra non-negative or positive parameter is estimated via exp(p) transformation during the optimization it is often more accurate to get confint by endpoint transformation instead of through the delta method or hessian of the untransformed parameter.
    example: scale parameter in Weibull AFT

    in these cases stata report the transformed plus additionally the original parameter.

    partially related: #3224 (transformation to normality)
    we use endpoint transformation for some cases, eform, prediction with link/index models. #2235 #2015 and likely some others
    #2396, and some issues with problems in current design with transformed params

    Our initial usage was driven largely by a comment in Greene about using transformed parameter for estimation and untransformed parameter for the final and postestimation analysis.
    This might not be such a great idea for confidence intervals.

    possibility to refactor, different design:

    • keep params and cov_params for transformed params
    • add original params as extra to summary and as attributes.

    one problem is other post-estimation, e.g. hypothesis tests formulated on original parameter.
    e.g. pvalue for test that exp transformed variable is zero corresponds to original value is one.
    Wald and score tests are not invariant to non-linear transformation, so maybe we shouldn't just silently use a different parameterization for hypothesis tests.

    example
    Weibull AFT scale=1 reduces to exponential and similar for other models with extra parameters
    Generalized Poisson versus Poisson (I don't remember the details right now)

    Design decision and refactoring are not urgent but we will get more cases where this will show up.

  2. josef-pkt commented on Aug 23, 2021

    @josef-pkt
    MemberAuthor

    another option: add link function for extra parameter

    This overlaps with adding explanatory variables for extra params
    e.g. shape parameter in weibull #4217 or dispersion parameter in NegBin, ... e.g. #7639
    Current example is betareg where we have precision as second parameter with link function.

    In this case, the transformation for the extra parameter is parameterized and we inherit derivatives of the transform.
    We could also get linpred for the extra parameter as the "original" parameterization.

    I think, we could then drop the switch inside fit to transform only during the optimization, which would make the loglike less ambiguous. (AFAIR, that is still messy in the newer count models NBP and GPP)

  3. josef-pkt commented on Aug 25, 2021

    @josef-pkt
    MemberAuthor

    Beta regression should be a good example how to use link for auxiliary params.

    aside:

    BetaModel.score_factor and score_hessian_factor has

            t = 1. / self.link.deriv(mu)
            h = 1. / self.link_precision.deriv(phi)
    

    I think this should use self.link.derive_inverse , i.e. we should mainly use the inverse link
    (and eventually use inverted transform, ilink instead of link.)

    For hessian, I guess, there should also be a simplification that uses self.link.deriv2_inverse instead of self.link.deriv2

    Once we have score_factor based on ilink, then it's trivial to add exog_extra to score.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions