-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
add parameter allow_singular for gaussian copula #8504
add parameter allow_singular for gaussian copula #8504
Conversation
Do you have a usecase for this? I'm not sure what the implication for the different methods is? We can add it essentially as in this PR, but with a warning that singular correlation matrices are not supported by all methods, and that the behavior is determined by the scipy.stats distribution class. Aside: |
However, copula cdf, pdf and rvs delegate to scipy.stats. And the keyword is opt-in. So we would not have an effect on the current case without singular correlation. For checking: |
It is a border case for me where I vary a parameter and at one end it tends to a correlation matrix full of ones. Always taking care of this border case and only do it with 0.99 is getting ugly. It's just about passing a parameter from scipy to the copula api here.
You often have to expect such problems at extreme values. Just to give you another example, the plot_pdf function raises an error for the Independence case (corr=np.eye). Imo that is up to the user, to deal with singular matrix. The argument is default allow_singular=False .
correlation 1 means u_1=u_2=...=u_n and at least for identical marginals x_i=cdf^-1(u_i) : x_1=x_2=...x_n
|
but it will in general not be true for copula distributions with unequal marginal distributions, where, I guess, marginal distributions could be in the same family but with different parameters. |
The multivariate t distribution in scipy also has the allow_singular option. However the copula does not have the cdf yet. Can you add the caveat about the behavior of singular cases to the docstring for allow_singular? Then I can merge |
aside: we have helper functions that make a matrix positive definite or semi-definite. |
caveat about what? |
We have no unit tests for the singular case. behavior is inherited from scipy which might not be stable (and which might not be what we want). I would not make any guarantees on specific behavior in methods for the singular case, until it has been investigated and has full unit tests. |
NumPy's guide.
Notes:
needed for doc changes.
then show that it is fixed with the new code.
verify you changes are well formatted by running
flake8
is installed. This command is also available on Windowsusing the Windows System for Linux once
flake8
is installed in thelocal Linux environment. While passing this test is not required, it is good practice and it help
improve code quality in
statsmodels
.