Repository navigation
Conversation
|
Hello @josef-pkt! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-10-11 20:06:35 UTC |
|
This pull request introduces 3 alerts when merging 3d8b5b0 into f67fc16 - view on LGTM.com new alerts:
|
|
I'm also getting a discrepancy in scale estimate between GammaHet and GLM-Gamma. If I fix the scale and use observed hessian in GLM, then cov_params are close to inverting the mean parameter part of MLE negative hessian. The GammaHet MLE model here estimates constant scale, exog_scale is ones. mod_gamm is GammaHet with good agreement on params (using default convergence tolerance and bfgs in both models) |
|
Gamma model with estimated heteroscedasticity compared to GLM-gamma with var_weight = 1 / scale_predicted_mle params agree, bse are closer if we use mean-parameter submatrix of hessian (one parameter) GLM/LEF: also have mean orthogonal to scale/dispersion (EIM) |
|
maybe I should try maybe similar to copula distribution and CopulaModel, with a list of marginals, Here it would be a list of links and a tuple of args. The list of links could be in generic code, base classes. When we have a specific subclass we can use named keywords for the links. In terms of transformation (a, b) are loc and scale in the base (normal) distribution that is sinh transformed. mean in wikipedia is another question: Do we want to have (Could we use offset and empty exog for one of a parameter? Would that be easier than using the constraint mask?) |
|
likely design The default for args, if no exog for them is specified, is constant, and identity link. Limited constraints: fix arg, but don't fix coefficients for exog within arg. I'm not sure yet how to specify exog_extra, If we use tuple fun, when it works, first try nobs = 1000, constant parameters, exogs are ones |
|
gamlss has parameters: and "obvious" link defaults aside: |
|
I need unit test, just regression tests, so I don't mess up (much) during refactoring. MultiLinkModel is still missing pieces to support links and exog for all distribution parameters. |
8eea010 to
53609e4
Compare
53609e4 to
9e47490
Compare
|
links are not yet implemented for all params, currently only link_scale. We also have the new BetaModel as comparison test case available. It follows the same Currently MultiLinkModel is agnostic to the meaning of the parameters. We have 2 explicit and an arbitrary number of This means that families like If we add subclasses of MultiLinkModel that are for categories of models, and delegate e.g. a scipy distribution, then we would have to choose a parameterization, e.g. either scale or precision in AFT-type models. On naming problem is that MultiLinkModel use names, mean, scale, based on the initial |
fd1c7fb to
0480ced
Compare
|
BetaMultiLinkModel as testcase also works, compared with betareg.BetaModel. I'm not happy with the nongeneric name not yet: #7666 generalized extreme value and weibull exponential distribution is not supported by MultiLink because it has only 1 parameter. |
0480ced to
cf0396b
Compare
|
code style check sucks: test failures on some machines with BetaMultilink |
|
eponential is also a special case of gamma GLM with dispersion parameter scale=1, according to answers here The main other one parameter families are discrete, like Binomial, Bernoulli, Logit, Probit, and Poisson. Related 2 parameter family (that I wanted for a long time) Beta-Binomial. In my current examples, |
|
Beta-Binomial works essentially out of the box, based on #2632 (comment) Example with nobs i= 1000, constant mean and dispersion, n_trials=7 df_model is still wrong in BB, with 2 exog each, I have df_model=3, it should be 2 (2 slope exog in total) |
|
The basics for MultiLinkModel works. Where do we put it? How much more do we generalize the MultiLink class? Currently, the user needs to provide start_params. In the general case, the first two distribution parameters, mean and variance/scale based on the Het interpretation, could be anything. We don't have enough information to compute reasonable start_params by default. (e.g. scale versus precision versus some kind of dispersion parameter) Predict is not yet generalized to multilink. The assumption is that the first distribution parameter and first exog provides the mean. That's only true for models with mean parameterization, GLM-families, Beta, BetaBinomial and symmetric families like gaussian and T. It will not be the mean in survival/lifetime models like AFT, or in extreme value analysis, genextreme, genpareto. I still don't like the misuse of the name
Specific Extensions: What are useful subclasses of MultiLinkModel? e.g.
|
|
and minimal GeneralizedPoisson also works |
cf0396b to
077bf3f
Compare
|
preliminary plan for modules:
another generic class: CensoredModel and TruncatedModels (*) johnsonsu and other skewed distributions on real line will have a
If we get a larger number of distribution families, then we should split in submodules like scipy. |
|
I'm thinking now more of not really naming the second parameter, and use numbering instead, e.g. Maybe zero based names is not so intuitive: exog, exog_2, exog_3, ... Not nice, but we could put exog extras in kwargs, and corresponding links. Problem: If we don't store, Names of distribution parameters, like "scale" are only used in |
|
naming Should I rename |
|
one more design decision: In base class MultiLinkModel, I could include the second parameter among the extras. The dispersion/het subclass could still have two explicit parameters and the others as optional extras. |
077bf3f to
6b75831
Compare
|
superseded by #7793 which contains most code of this PR (but not the history) |

update this has been generalized to MultiLinkModel, not restricted to mean-variance models anymore.
see #7639
getting started
code based on miscmodels TLinearModel and
__init__from BetaModel.class structure not clear yet
gamma will need link for mean for endog and mean > 0
Most likely distribution specific code, loglike, ..., will be delegated to new family classes (or genmod families if available) #7769