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
{{ message }}
Repository navigation
ENH: parameterized link functions for GLM, discrete, #624
the following looks like a nice article with enough formulas that implementation shouldn't be too difficult, includes influence diagnostic and hat matrix diag
uses power transformation of cdf, i.e. cdf = G(.)**p
Koenker/Yoon has two general links, "Gosset" which is Student-T distribution, and "Tukey-Lambda" which in the literature is mostly called generalized lambda distribution and has an additional skewness parameter. (Tukey-Lambda in wikipedia and scipy are symmetric with only one shape parameter for tail behavior)
Generalized lambda is defined through quantile, ppf, function, not the cdf, or pdf. The latter have to be recovered from the ppf.
This looks too messy and we don't get an analytical (or precoded) functional form for the mean function.
grumbling aside: Links in GLM are back to front. The literature was written for IRLS and analogy to linear model. #4278 and #7023 for ordinal models.
log link is exp mean function, but in CDFLink the link is the ppf and the cdf is the mean function.
There is a recent literature of using quantile defined function like tukey lamba or g-h distribution also for estimation given the increased computing power. The original use was for simulation where we need the ppf to create random numbers.
I guess we could look for other flexible distribution families that are e.g. based on nonlinear transformation for cdf, which, I think, will make it easier to compute loglike, derivatives and margins for it,
(maybe something like VGAM in R, which uses IIRC the inverse links as transformation function for mean, scale and shape)
update
reference that describes how to compute MLE in a computing intensive way by inverting ppf at each sample point:
uses only Nelder-Mead for optimization, because other optimization methods have problems like
"These methods require likelihood derivatives or expected values of likelihood derivatives, which are even more expensively computed and more prone to numerical problems than the likelihood function."
see #7237 for sinh-arcsinh transformed distributions.
Adding parametric links is not enough, we need to support them in GLM both for estimation and for specification testing, e.g. score tests on shape parameters, like skew and kurtosis for generalizations or variations on logit.
Estimation
easiest is profile likelihood as what Kerby used for Neg Bin dispersion parameter
full MLE: currently not supported because estimation is focused on one-parameter family with scale as orthogonal, auxiliary parameter
need derivatives with respect to link shape parameters in links, for score and hessian
need general optimization methods that allows for extra params as in discrete models
specification testing
score test: need score function at null (e.g. logit), i.e. derivatives of loglike with respect to link parameters
There is an alternative for link test using variable addition test, but I never tried to fully figure out the structure of the variable to add for link tests.
likelihood ratio test and similar, will work if we can get MLE for extended model, For general distribution testing LR test looks pretty good to test for skew and kurtosis deviations from, e.g., normal or logistic.
All current Links that have a parameter, have the parameter specified in __init__.
In most cases the parameter could be changed in the attached attribute without having to create a new instance.
However, this does not work for CDFLinks. If the distribution has a shape parameter, then it currently requires that the distribution is frozen and we cannot just change the parameter attribute of the link instance.
When we want to estimate the link parameters, then it would be useful to add *args.
In a similar case, copulas allow for both, specify and fix params/args in __init__, or override them by specifying method arguments.
Similarly we could have parameterized variance functions
Binomial is a messier case because the variance function already depends on n, the number of draws or trials in an observation.
In contrast var_weights and exposure are handled in GLM or families directly.
The links for binomial are not affected by n because the model/prediction is for proportion and not for counts.
random thought ( I didn't check whether I saw or mentioned this already)
transformation using Beta cdf on top of a CDF link, i.e. composed, nested cdf links.
It would be another way to make, for example logistic and normal, Logit and Probit links, asymmetric, or use it for diagnostic and specification tests at the original link.
There are some related distributions based on beta transformation.
I had read some abstracts for #7237 but not much of the details for the beta transformation.
I guess adding flexible variance and link function parameter estimation to GLM-like cases needs to wait for multilink MLE models.
However those are intended as full MLE models, QMLE will likely not be covered.
GLM has the advantage of being "semi-parametric" only needing mean/link function and auxiliary variance function. IRLS is just a moment estimator.
For generic QMLE we would not have a well defined objective function, e.g. Poisson with "foreign" variance function.
We would need moment based M-estimators or GMM to handle that case.
Although, link parameters are still within the MLE/QMLE case of GLM/LEF, i.e. we just need more flexible mean functions.
related: We could estimate extra params through profile likelihood methods and then base inference on GMM of (horizontally) stacked moment conditions.
a simple addition to cdflinks: skew-t with explicit cdf and ppf
useful for skewed heavy-tailed cases.
we might also want the complementary version (based on sf?)
maybe a generic complementary cdf link (irrelevant for symmetric distributions)
Activity
josef-pkt commentedon Oct 20, 2020
see #5409 (comment) for a generalized logit link
Koenker, Roger, and Jungmo Yoon. 2009. “Parametric Links for Binary Choice Models: A Fisherian–Bayesian Colloquy.” Journal of Econometrics, Nonparametric and Robust Methods in Econometrics, 152 (2): 120–30. https://doi.org/10.1016/j.jeconom.2009.01.009.
http://www.econ.uiuc.edu/~roger/research/links/links.html includes link to RNews article, some R code for links, no package
(downloaded in 2016, but AFAIR I never had looked at it)
the following looks like a nice article with enough formulas that implementation shouldn't be too difficult, includes influence diagnostic and hat matrix diag
uses power transformation of cdf, i.e. cdf = G(.)**p
Lemonte, Artur J., and Jorge L. Bazán. 2018. “New Links for Binary Regression: An Application to Coca Cultivation in Peru.” TEST 27 (3): 597–617. https://doi.org/10.1007/s11749-017-0563-1.
there are also several extension to multinomial model
For link based t distribution: it looks like most of the literature is Bayesian, using simulation, MCMC, ...
josef-pkt commentedon Oct 21, 2020
Koenker/Yoon has two general links, "Gosset" which is Student-T distribution, and "Tukey-Lambda" which in the literature is mostly called generalized lambda distribution and has an additional skewness parameter. (Tukey-Lambda in wikipedia and scipy are symmetric with only one shape parameter for tail behavior)
Generalized lambda is defined through quantile,
ppf, function, not the cdf, or pdf. The latter have to be recovered from the ppf.This looks too messy and we don't get an analytical (or precoded) functional form for the mean function.
grumbling aside: Links in GLM are back to front. The literature was written for IRLS and analogy to linear model. #4278 and #7023 for ordinal models.
log link is exp mean function, but in
CDFLinkthe link is the ppf and the cdf is the mean function.There is a recent literature of using quantile defined function like tukey lamba or g-h distribution also for estimation given the increased computing power. The original use was for simulation where we need the ppf to create random numbers.
I guess we could look for other flexible distribution families that are e.g. based on nonlinear transformation for cdf, which, I think, will make it easier to compute loglike, derivatives and margins for it,
(maybe something like VGAM in R, which uses IIRC the inverse links as transformation function for mean, scale and shape)
update
reference that describes how to compute MLE in a computing intensive way by inverting ppf at each sample point:
Rayner, G. D., and H. L. MacGillivray. 2002. “Numerical Maximum Likelihood Estimation for the G-and-k and Generalized g-and-h Distributions.” Statistics and Computing 12 (1): 57–75. https://doi.org/10.1023/A:1013120305780.
uses only Nelder-Mead for optimization, because other optimization methods have problems like
"These methods require likelihood derivatives or expected values of likelihood derivatives, which are even more expensively computed and more prone to numerical problems than the likelihood function."
update 2
interesting overview of distribution families on R, followed by discussion and rejoinder
Jones, M. C. 2015. “On Families of Distributions with Shape Parameters.” International Statistical Review 83 (2): 175–92. https://doi.org/10.1111/insr.12055.
josef-pkt commentedon Jan 4, 2021
see #7237 for sinh-arcsinh transformed distributions.
Adding parametric links is not enough, we need to support them in GLM both for estimation and for specification testing, e.g. score tests on shape parameters, like skew and kurtosis for generalizations or variations on logit.
Estimation
discretemodelsspecification testing
There is an alternative for link test using variable addition test, but I never tried to fully figure out the structure of the variable to add for link tests.
josef-pkt commentedon Jan 4, 2021
Here is an article that estimates parameters of link functions in full MLE,
example beta regression with two link functions, in their case it is Aranda-Ordaz link
Canterle, Diego Ramos, and Fábio Mariano Bayer. 2019. “Variable Dispersion Beta Regressions with Parametric Link Functions.” Statistical Papers 60 (5): 1541–67. https://doi.org/10.1007/s00362-017-0885-9.
josef-pkt commentedon Sep 1, 2021
in terms of implementation:
All current Links that have a parameter, have the parameter specified in
__init__.In most cases the parameter could be changed in the attached attribute without having to create a new instance.
However, this does not work for CDFLinks. If the distribution has a shape parameter, then it currently requires that the distribution is frozen and we cannot just change the parameter attribute of the link instance.
When we want to estimate the link parameters, then it would be useful to add
*args.In a similar case, copulas allow for both, specify and fix params/args in
__init__, or override them by specifying method arguments.Similarly we could have parameterized variance functions
Binomial is a messier case because the variance function already depends on
n, the number of draws or trials in an observation.In contrast var_weights and exposure are handled in GLM or families directly.
The links for binomial are not affected by
nbecause the model/prediction is for proportion and not for counts.josef-pkt commentedon Feb 23, 2023
random thought ( I didn't check whether I saw or mentioned this already)
transformation using Beta cdf on top of a CDF link, i.e. composed, nested cdf links.
It would be another way to make, for example logistic and normal, Logit and Probit links, asymmetric, or use it for diagnostic and specification tests at the original link.
There are some related distributions based on beta transformation.
I had read some abstracts for #7237 but not much of the details for the beta transformation.
Hutson, Alan D., and Albert Vexler. “A Cautionary Note on Beta Families of Distributions and the Aliases Within.” The American Statistician 72, no. 2 (April 3, 2018): 121–29. https://doi.org/10.1080/00031305.2016.1213661.
Rocke, David M. “On the Beta Transformation Family.” Technometrics 35, no. 1 (1993): 72–81. https://doi.org/10.2307/1269291.
josef-pkt commentedon Apr 3, 2023
another article with Box-Cox link, found because of average marginal effect computation #8767
Basu, Anirban, and Paul J. Rathouz. “Estimating Marginal and Incremental Effects on Health Outcomes Using Flexible Link and Variance Function Models.” Biostatistics 6, no. 1 (January 1, 2005): 93–109. https://doi.org/10.1093/biostatistics/kxh020.
I guess adding flexible variance and link function parameter estimation to GLM-like cases needs to wait for multilink MLE models.
However those are intended as full MLE models, QMLE will likely not be covered.
GLM has the advantage of being "semi-parametric" only needing mean/link function and auxiliary variance function. IRLS is just a moment estimator.
For generic QMLE we would not have a well defined objective function, e.g. Poisson with "foreign" variance function.
We would need moment based M-estimators or GMM to handle that case.
Although, link parameters are still within the MLE/QMLE case of GLM/LEF, i.e. we just need more flexible mean functions.
related: We could estimate extra params through profile likelihood methods and then base inference on GMM of (horizontally) stacked moment conditions.
josef-pkt commentedon Jun 17, 2023
generalized logistic
https://en.wikipedia.org/wiki/Generalized_logistic_distribution#Relationships_with_other_distributions
If p is beta(alpha, beta) distributed, then logit(p) is type 4 generalized logistic distributes
josef-pkt commentedon Sep 6, 2024
a simple addition to cdflinks: skew-t with explicit cdf and ppf
useful for skewed heavy-tailed cases.
we might also want the complementary version (based on sf?)
maybe a generic complementary cdf link (irrelevant for symmetric distributions)
https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.jf_skew_t.html