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
Beta regression still needs api improvement and cleanup, part of it is to support a second exog.
For some of it we don't have a consistent pattern and similar problems in ZeroInflated models.
user interface:
formula support for second exog, exog_precision
api design
not supported in predict, exog transformation is handled by super predict.
update: df for likelihood ratio test for Null model has been fixed in #7586
tests
no unit tests for res_meth.llnull, res_meth.llr, res_meth.llr_pvalue inherited from base _LLRMixin
BUG: LR-test compared to null model uses wrong, the mixin uses df_model which only counts 1 constant afair
df_model = 5, LR-null test has 4 = 6 - 2 in example
loglike values and test statistic llr agree with betareg/lmtest
I might just make a method to override inherited llr_pvalue.
The df_model mess in generic likelihood, still needs more review and cleanup.
I might add a k_null attribute, similar to the df_null in R betareg.
(df_model, k_constant, has_const, ... are all messy things for inference and other competing use cases.)
What happens with no constant, no parameter models, e.g. if precision were fixed or only depends on offset?
analogues of linear regression through the origin, for rsquared and similar.
get_prediction (as in DiscreteResults) works for NonlinearDeltaCov, but not with endpoint transformation, pred.get_prediction_monotonic which is the default for which="mean"
linear/linpred doesn't work pl = get_prediction(res_meth._results, which="linpred")
fails with ValueError: shapes (6,6) and (4,36) not aligned: 6 (dim 1) != 4 (dim 0)
This is still wrong. We are going through regression linear prediction which does not trim params and cov_params to the length of exog.
I think we don't need endpoint transformation for other exog/link.
e.g conditional variance of y |x depends on mean and precision parameter.
The only interesting case might be GaussianHet where variance is equal to the scale parameter.
TModel would also have monotonic variance when df is fixed, but not otherwise.
If we stick with endpoint transformation at most for the first link function, then only get_prediction(res_meth._results, which="linear") needs to be fixed.
get_influence for BetaNodel needs _deriv_score_obs_dendog
explicit formulas for computing that is in
Silvia Ferrari & Francisco Cribari-Neto (2004) Beta Regression for Modelling Rates and Proportions,
Journal of Applied Statistics, 31:7, 799-815, DOI: 10.1080/0266476042000214501
AFAICS, I use the same definition of generalized leverage in MLEInfluence.
Influence for beta regression was one of my example to figure out generic MLEInfluence definitions.
I have not tried yet whether we can use numdiff for numerical derivatives in these cases #7891
update _deriv_score_obs_dendog has been implemented using _approx_fprime_cs_scalar for derivative "factors"
Activity
josef-pkt commentedon Jul 16, 2021
need to add references to docs
(I didn't look at any references in last round before merge)
josef-pkt commentedon Jul 16, 2021
docs
https://www.statsmodels.org/dev/othermodels.htmlupdate correct link is https://www.statsmodels.org/dev/other_models.html
othermodelsneeds to be added touser-guide.rstquite a few problems with docstring
get_distribution does not have any docstring
some inherited docstrings are not appropriate
prsquared docsting is picked up in
Attributeslooks fine.josef-pkt commentedon Jul 16, 2021
update: df for likelihood ratio test for Null model has been fixed in #7586
tests
no unit tests for
res_meth.llnull, res_meth.llr, res_meth.llr_pvalueinherited from base_LLRMixinBUG: LR-test compared to null model uses wrong, the mixin uses df_model which only counts 1 constant afair
df_model = 5, LR-null test has 4 = 6 - 2 in example
loglike values and test statistic llr agree with betareg/lmtest
edit
I guess R lrtest has smaller model first
I might just make a method to override inherited llr_pvalue.
The df_model mess in generic likelihood, still needs more review and cleanup.
I might add a k_null attribute, similar to the df_null in R betareg.
(df_model, k_constant, has_const, ... are all messy things for inference and other competing use cases.)
What happens with no constant, no parameter models, e.g. if precision were fixed or only depends on offset?
analogues of linear regression through the origin, for rsquared and similar.
josef-pkt commentedon Jul 16, 2021
aside:
set_null_optionsis not called automatically.i.e. if we want to store res_null, then we need to call
set_null_optionsbefore accessing nullREF/BUG generic likelihood LLRMixin use df_resid for llr_pvalue see s…
josef-pkt commentedon Nov 22, 2021
R:
betareg package include influence/leverage measures
seems there is no direct confidence interval for prediction https://stats.stackexchange.com/questions/86432/how-do-i-predict-with-standard-errors-using-betareg-package-in-r
references appendix B of Ferrari, S.L.P., and Cribari-Neto, F. (2004). That uses endpoint transformation confint for mean
mubased on linpred for mean.second answer refers to package 'effects' and might be standard NonlinearDeltaCov version
Stata also only has se for linpred in predict, and I guess delta methods in margins
josef-pkt commentedon Nov 22, 2021
get_prediction (as in DiscreteResults) works for NonlinearDeltaCov, but not with endpoint transformation, pred.get_prediction_monotonic which is the default for
which="mean"oops, inconsistent naming, generic is
which="linear", betamodel useswhich="linpred"allowing linear as alias gets endpoint confint work for "mean"
josef-pkt commentedon Nov 22, 2021
linear/linpred doesn't work
pl = get_prediction(res_meth._results, which="linpred")fails with
ValueError: shapes (6,6) and (4,36) not aligned: 6 (dim 1) != 4 (dim 0)This is still wrong. We are going through regression linear prediction which does not trim params and cov_params to the length of exog.
I think we don't need endpoint transformation for other exog/link.
e.g conditional variance of y |x depends on mean and precision parameter.
The only interesting case might be GaussianHet where variance is equal to the scale parameter.
TModel would also have monotonic variance when df is fixed, but not otherwise.
If we stick with endpoint transformation at most for the first link function, then only
get_prediction(res_meth._results, which="linear")needs to be fixed.update get_prediction works now, PR #7900
josef-pkt commentedon Nov 25, 2021
BUG: results cov_type attribute is missing if cov_type is "nonrobust"
res_income.cov_type
AttributeError: 'BetaResults' object has no attribute 'cov_type'
I'm fixing this in GenericLikelihoodModel.fit add cov_type to kwargs if not there yet.
josef-pkt commentedon Nov 25, 2021
scoretest option 3, using params_constrained in unrestricted model, works.
score_test results are close to the wald test result
example: slope variable for precision parameter is zero, i.e. constant precision parameter, constant dispersion.
josef-pkt commentedon Nov 26, 2021
get_influence for BetaNodel needs
_deriv_score_obs_dendogexplicit formulas for computing that is in
Silvia Ferrari & Francisco Cribari-Neto (2004) Beta Regression for Modelling Rates and Proportions,
Journal of Applied Statistics, 31:7, 799-815, DOI: 10.1080/0266476042000214501
AFAICS, I use the same definition of generalized leverage in MLEInfluence.
Influence for beta regression was one of my example to figure out generic MLEInfluence definitions.
I have not tried yet whether we can use numdiff for numerical derivatives in these cases #7891
update
_deriv_score_obs_dendoghas been implemented using_approx_fprime_cs_scalarfor derivative "factors"josef-pkt commentedon Sep 28, 2022
current:
BetaResults has
nothing for diagnostic and specification tests
predict (and get_prediction ?) has
which="var"using model method_predict_var