Comments (8)
The first (non-zero) value is x = 1.452e+5
and alpha=-1
. Now, wright_bessel(1, 0, 1e5) = 2.356e+275
and np.finfo(np.float64).max = 1.798e+308
. So the simple answer is that wright_bessel(1, 0, 1.4e5)
is simply larger than the max floating point number.
I think the tweedie package treats it differently and works with the logarithm of Wright's Bessel function, thus avoiding the overflow.
from statsmodels.
Thanks for the answer and for opening the Scipy issue, @lorentzenchr
In your opinion, would it be better to wait/push for the Scipy update and then modify the wright_bessel here? Or would it be a good idea to remove wright_bessel and try to add the more detailed calculations here? I noticed that glum and tweedie packages have the latter. I'm not familiar with Scipy's release cycle, so not sure what the timeline for that feature would be.
Also interested on your input here, @josef-pkt
from statsmodels.
That's a question for @josef-pkt to answer and it also depends on you expected timeline. I will only pursue the "proper" solution with scipy. Let's see how they respond.
from statsmodels.
(I'm currently stuck in a very different neighborhood of statistics and have not looked at the details for this.)
If there is a workaround that can be added in statsmodels, then it would be good to have it because it would also work with older scipy versions, e.g. we copied some code from scipy to statsmodels.compat to make parts available faster.
However, if there is no good replacement for (compiled) scipy.special functions, then we just have to wait for the fix/enhancement in scipy and the release cycle.
from statsmodels.
Great point, @josef-pkt. An alternative implementation wouldn't limit users to the eventual version of SciPy with the fix. I'm interest in working on this. We would love to have everything available in Statsmodels and not have to rely on the Tweedie package.
A question for you both regarding licenses @josef-pkt @lorentzenchr Can I read code available in other packages to help with this? Or should I rely on papers only? I think Tweedie and GLUM licenses are pretty permissive, but I don't want to start looking at the source code if I'm not allowed to.
from statsmodels.
GLUM https://github.com/Quantco/glum is also BSD-3 licensed, so there is no restriction looking at their code, or even copying parts.
@thequackdaddy was the original contributor of tweedie in statsmodels. His package might not have much additional to our code, but I haven't looked at it.
from statsmodels.
related:
tweedie family is missing get_distribution
. We currently do not have a distribution class for it, AFAICS
from statsmodels.
With scipy/scipy#20646 merged, as of (future) scipy 1.14, statsmodels can replace log(wright_bessel)
with log_wright_bessel
. This should solve this issue.
from statsmodels.
Related Issues (20)
- BUG: RLM fit history uses WLS scale and not the robust scale estimate
- ARIMA(1,1,1) model doesn't seem to discard non-differentiated values after differentiation. HOT 3
- ENH: handle dummy and categorical variables in robust methods, e.g. cov, mahalanobis, subsampling
- ENH: roadmap, overview robust HOT 1
- Is the implementation of the clopper-pearson upperbound correct? HOT 1
- DOC: Some function links in 'Regression diagnostics' are broken HOT 3
- How to get in touch regarding a security concern HOT 8
- BUG: RLM fit with start_params raises if only one parameter
- Failed to install on android HOT 10
- bug:too many indices for array: array is 0-dimensional, but 1 were indexed
- stats/proportion.py's binom_test_reject_interval function's error HOT 2
- ENH: proportion_confint only has two-sided confidence intervals, no "alternative" option HOT 3
- ENH: robust default start_params in M-estimators, RLM, and CovM ?
- ENH: maybe, S- and M-estimator for multivariate mean, scatter for large k_vars HOT 3
- ENH: pseudo-determinant, matrix determinant for singular cov, mahalanobis
- Possibility to enter stock data with sales and mark special days like Launnch day or Black Friday HOT 3
- GLM cannot converge due to weights HOT 2
- ATIMA.fit() parallel jobs mutliprocessing HOT 1
- Updating OLS model's degrees of freedom doesn't change results HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statsmodels.