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
DOC/TST/Review: binomial with non-canonical link #4598
test_glm.py has a comment, which I don't know what it means, or what's the reason for the comment
#TODO:
#Non-Canonical Links for the Binomial family require the algorithm to be
#slightly changed
I never looked at this case, i.e. Binomial count model with n_trials != 1, not Bernoulli.
The link function for the binomial probability can be anything.
The question is whether the current code uses some computation that assumes canonical link, i.e. logit.
The only source could be in the aggregation for n_trials which is the only difference to other families in the implementation.
e.g. related: log-binomial is an example that we looked at, but only with respect to params and possible problems with support violations. ( #2208, #2215)
There might be nothing wrong in this case, but it needs checking.
2 corner problems in binomial deviance and loglike
0 / 0, and 0 log 0
_clean clips away from zero, so we don't have log 0, (old code)
I added now 1e-20 in denominator so we don't have 0/0
then cloglog finishes without nan llf and deviance and without RuntimeWarnings.
deviance and llf are the same as Stata base on print summary.
The part of the code where we have 0 log 0 should be refactored to use the scipy special functions that have existed now already for some time. They were added to scipy to handle cases like this.
Activity
MAINT: Deprecate scale in test function
MAINT: Deprecate scale in test function
bashtage commentedon May 3, 2019
Wrongly closed.
josef-pkt commentedon Dec 21, 2020
checking cloglog against Stata with constrict example
params and bse seem to agree well (based on summary prints)
ours has nan llf because 2 observations have fittedvalues = 1, both with newton and with irls, irls doesn't raise with perfect separation exception
glm in Stata doesn't show a warning or nan
glm constrict log_rate log_volumne, family(binomial) link(cloglog)josef-pkt commentedon Dec 21, 2020
Stata has
cloglogandloglogwith the same signs of params (i.e. seems to have the same definition of prob)We only have
cloglog.I guess we should get loglog to have skewness in the other direction from cloglog without having to flip/reparameterize endog
josef-pkt commentedon Dec 21, 2020
2 corner problems in binomial deviance and loglike
0 / 0, and 0 log 0
_cleanclips away from zero, so we don't have log 0, (old code)I added now 1e-20 in denominator so we don't have 0/0
then cloglog finishes without nan llf and deviance and without RuntimeWarnings.
deviance and llf are the same as Stata base on print summary.
The part of the code where we have 0 log 0 should be refactored to use the scipy special functions that have existed now already for some time. They were added to scipy to handle cases like this.