You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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)
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.
Activity
josef-pkt commentedon Feb 18, 2018
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:
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.
josef-pkt commentedon Aug 23, 2021
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
fitto 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)josef-pkt commentedon Aug 25, 2021
Beta regression should be a good example how to use link for auxiliary params.
aside:
BetaModel.score_factorandscore_hessian_factorhasI think this should use self.link.derive_inverse , i.e. we should mainly use the inverse link
(and eventually use inverted transform,
ilinkinstead oflink.)For hessian, I guess, there should also be a simplification that uses
self.link.deriv2_inverseinstead ofself.link.deriv2Once we have score_factor based on ilink, then it's trivial to add exog_extra to score.