Repository navigation
ENH/TST: archimedean rvs for k_dim>2, test/gof tools - #8642
Conversation
|
using cdf instead of averaged pdf in copula approximation solves the problem cop2, cop are Clayton copulas with k_dims 2 and 3 |
|
student-t rvs test fails now, |
|
kendalltau in exchangeable archimedean: e.g. simulated 3d rvs |
|
PR might be good enough to merge making chisquare gof test public is too early, it's still in unit test module, |
|
I forgot to add the changes to generalized nearest_matrix_margins to dim>2 |
|
still something strange: GaussianCopula with k_dim =3 fails the gof unit test, with both use_pdf True and False. I'm changing |
|
Gaussian copula rvs looks correct. problem must be in some changes to check_cop_rvs the following also checks new changes to gaussian copula.fit_corr_param(rvs) |
|
The bug in check_cop_rvs is because of different orientation of the grid matrix (k, k, ... k) This did not show up before because the previous cases were with exchangeable components, archimedean and I had used a gaussian example with equal correlation (all off diagonals of corr the same). Another problem with current implementation: Also, check_cop_rvs seems to be a bit slow with 1000 or a few thousand nobs. |
|
what a pain. confusing myself. I thought I had another bug and wasting a lot of time on it copula = GaussianCopula(corr=[ the correlation matrix in the new test case is still partially exchangeable now I use |
|
now includes rvs gof unit test for gaussian and studentt with k_dim=3 aside: still problem with genericlikelihoodmodel df_xxx in CopulaModel |
|
AFAICS, the transpose bug is in using reshape with the unit tests for Bernstein, for example TestBernsteinBeta2d, use c order reshape test_tools.py |
cd41c2e to
70ddfb5
Compare
|
unrelated problem with azure test environments |
trying to extend archimedean rvs to general k_dim
It looks like the current formulas immediately extend to k_dim > 2.
However, I have problems creating unit tests for it. We need some gof statistics to check whether the generated data has distribution close to the data generating distribution (rvs).
2-dim marginals of k_dim = 3 look good, graphically and with approximate gof test.
But it doesn't work for full k_dim=3 copula.
Current helper function in test_copula was written for 2-d case and does not work for k_dim=3. When I fix it, it rejects the null for the archimedean. Limitation is that function uses approximation using pdf instead of cdf.
check_cop_rvs(cop, rvs=None, nobs=2000, k=10, use_pdf=True)We need better helper tools for mv distribution approximation for k-dim>2.
eg. in statsmodels.distributions.tools, approx_copula_pdf, frequencies_fromdata, and helper functions
no
approx_copula_cdfyet AFAICS.nearest_matrix_marginsis only for k_dim=2, #7444I had used some of those parts with uncommitted extensions when checking BernsteinDistribution.
related: #7470 #7302