Suggestion: "recalculate" option for ModelResult.conf_interval()
#796
jagerber48
started this conversation in
Ideas
Replies: 1 comment
-
Oops, this is a duplicate of this issue: #791 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I generate a model, give it data, fit it, and then calculate the confidence interval using
result.conf_interval()
the confidence interval will be calculated withsigmas = [1, 2, 3]
by default. If I realize I wantsigmas = [1]
, orsigmas=[4]
after the fact I must manually setresult.ci_out = None
prior to making a second call toresult.conf_interval()
.My suggestion would be to have a
recalculate
(orforce_recalculate
?) kwarg inresut.conf_interval
which, when True, always recalculates the confidence interval even if it had been calculated previously. Backwards compatibility would suggest the kwarg defaults to False though it's not obvious to me that's the most expected behavior. It is strange to do, for exampleresult.conf_interval(sigmas=[1])
thenresult.conf_interval(sigmas=[1, 2])
and get the same result both times (with the latter being incorrect in my opinion). So that would suggest therecalculate
keyword should default to True.Perhaps a more sophisticated solution would be to "memoize" not only the
ci_out
, but also the function call signature that was used to generateci_out
. Then ifresult.conf_interval
is called with an identical signature the memoized version is used, but if it is called with a different signature the calculation is repeated with the new signature.Here's a minimal example showing the current (in my opinion, strange) behavior.
Beta Was this translation helpful? Give feedback.
All reactions