Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function mixup between scipy.stats and wafo.stats #50

Open
morbult opened this issue May 28, 2020 · 2 comments
Open

Function mixup between scipy.stats and wafo.stats #50

morbult opened this issue May 28, 2020 · 2 comments

Comments

@morbult
Copy link
Contributor

morbult commented May 28, 2020

By calling a probability distribution function in scipy.stats, the corresponding function in wafo.stats is actually called.

I discovered this when using scipy.stats.exponweib.fit() (fitting a Weibull distribution to data) but the point is illustrated simpler using scipy.stats.norm.freeze()

import scipy.stats
scipy.stats.norm.freeze()
Out[2]: <scipy.stats._distn_infrastructure.rv_frozen at 0xb9a6b38>

import wafo
scipy.stats.norm.freeze()
Out[4]: <wafo.stats.estimation.rv_frozen at 0xecb72e8>

Tested with scipy 1.2.1 and 1.4.1

So far I have not found the results from wafo.stats and scipy.stats to differ much. But there is a different behaviour with warnings (at least for the function scipy.stats.exponweib.fit()) which can be confusing and annoying. It is also a potential cause of hard to find bugs, so I hope it can be fixed. (If the problem is even within wafo which I honestly don't know.)

@pbrod
Copy link
Member

pbrod commented May 29, 2020

This was a feature of wafo version 0.11.
This is no longer an issue in the current version 1.0.0 available from https://github.com/wafo-project/pywafo.
The main benefit of using wafo.stats over scipy.stats is that it extends
scipy.stats with the possibility to use maximum spacing (MS)
estimator as an alternative to the maximum likelihood (ML) estimator and
the technique known as profile likelihood to construct better confidence intervals.
See https://en.wikipedia.org/wiki/Maximum_spacing_estimation and
https://journals.sagepub.com/doi/pdf/10.1177/1536867X0700700305

To use the extended functionality for parameter estimation you must call the dist.fit2 method
or alternatively use the FitDistribution class in wafo.stats.estimation.
To construct better confidence intervalls for the estimated distribution parameters, probability or quantile you must use the Profile-, ProfileProbability- or ProfileQuantile-class, respectively, in wafo.stats.estimation module.

@morbult
Copy link
Contributor Author

morbult commented May 30, 2020

Great! I installed from the current master and it's no longer an issue as you said. I'm happy to use scipy's fit function for now.

Out of curiosity, how was this accomplished in the previous version? I really don't understand how importing wafo can redirect my call scipy.stats to wafo.stats

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants