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
Inclusion of non-negative continuous probability distributions (e.g. Weibull, Pareto) for regression? #5094
Apologies if this is not the right place to ask/request this functionality. I have been exploring the code of statsmodels to learn whether this (fantastic!) piece of software includes continuous probability distributions for multivariate regression (e.g. Weibull, Pareto, exponential), in a similar fashion as the discrete case (e.g Poisson, Neg. Binomial and its zero-inflated versions). I am modelling daily values of precipitation data, and this type of "power law" models (continuous or discrete) are really handy for these tasks, because they handle decently skewed distributions.
For what I understood, with the current version of statsmodels, it is possible to fit a multivariate Gamma distribution as a combination of a GLM and a link function from the gamma family (please, correct me if I use the wrong terms):
Thus, I can train my gamma model with part of my multivariate data , and then test its performance with unseen data to calculate few statistical metrics.
In Python, there are some great examples to learn how to fit probability distributions to univariate data, mostly relying on scipy.stats. However, I could not find similar software packages doing the same for multivariate data. Actually with statsmodels, I think the only continuous distributions that I found is gamma (perhaps I overlooked the rest).
Is there any way of doing the same multivariate fitting I did with Gamma but with a Weibull/Pareto distribution? Are there any plans to include these multivariate regression models in statsmodels?
I assume you mean using a regression setting where the distribution depends on explanatory variables. multivariate models means in general that endog, i.e. ytrain, is multivariate. GLM Gamma estimate a "Univariate Gamma Regression". endog ytrain is univariate, exog xtrain is multivariate
short answer: statsmodels does currently not include Weibull/Pareto and similar distributions.
in decreasing generality
GenericLikelihoodModel is a base class for maximum likelihood regression models that can be subclassed where the user needs to provide loglike and optionally as many other methods, like derivatives, as possible.
aside:
Our count models allow for continuous data with exponential mean function E(y | x) = exp( x b)
The parameters for the mean models can be consistently estimated, but we need to correct the cov_params (cov_type=HC0). However, it will not model correctly other properties of the distribution besides mean/expected value, i.e. it's fine for mean prediction but not for predicting quantiles of the observations.
GLM also has InverseGaussian and Tweedie as distribution with positive valued observations (endog). Tweedie has in general an additional mass point at zero, and is identical to gamma for a special case.
But GLM does not include parametric failure time models, and is restricted to models without shape parameters (i.e. only for one parameter families, and dispersion as nuisance parameter).
changed the title [-]Inclusion of continuous probability distributions (e.g. Weibull, Pareto) for regression?[/-][+]Inclusion of non-negative continuous probability distributions (e.g. Weibull, Pareto) for regression?[/+]on Sep 3, 2018
simplest case might be distributions on R+ with exp scale function that depends on explanatory variables, and constant shape parameters in the intitial version. #4217 (comment)
Activity
josef-pkt commentedon Sep 3, 2018
To clarify a bit the terminology
I assume you mean using a regression setting where the distribution depends on explanatory variables.
multivariatemodels means in general that endog, i.e. ytrain, is multivariate. GLM Gamma estimate a "Univariate Gamma Regression". endog ytrain is univariate, exog xtrain is multivariateshort answer: statsmodels does currently not include Weibull/Pareto and similar distributions.
in decreasing generality
ENH: parametric survival/failure time models #4217
see https://gist.github.com/josef-pkt/10caecb77f0bf6e11826ac0b01cbf27f see class in [In 28]
aside:
Our count models allow for continuous data with exponential mean function
E(y | x) = exp( x b)The parameters for the mean models can be consistently estimated, but we need to correct the cov_params (
cov_type=HC0). However, it will not model correctly other properties of the distribution besides mean/expected value, i.e. it's fine for mean prediction but not for predicting quantiles of the observations.GLM also has InverseGaussian and Tweedie as distribution with positive valued observations (endog). Tweedie has in general an additional mass point at zero, and is identical to gamma for a special case.
But GLM does not include parametric failure time models, and is restricted to models without shape parameters (i.e. only for one parameter families, and dispersion as nuisance parameter).
[-]Inclusion of continuous probability distributions (e.g. Weibull, Pareto) for regression?[/-][+]Inclusion of non-negative continuous probability distributions (e.g. Weibull, Pareto) for regression?[/+]josef-pkt commentedon Sep 3, 2018
I changed title to reflect that the issue is for
positiveornon-negativeendog.josef-pkt commentedon Jun 16, 2021
bump
simplest case might be distributions on R+ with
expscale function that depends on explanatory variables, and constant shape parameters in the intitial version. #4217 (comment)