Copulas icon indicating copy to clipboard operation
Copulas copied to clipboard

Gumbel copula partial_derivative incorrectly documented/implemented

Open LiZhongyangLi opened this issue 4 years ago • 0 comments

Environment Details

Please indicate the following details about the environment in which you found the bug:

*Copulas version: 0.5.1 *Python version: 3.6.3 *Operating System: CentOS Linux release 7.9.2009

Error Description

In the documentation copulas.bivariate.gumbel.Gumbel.partial_derivative is described as the partial derivative w.r.t. the first entry u, but it is implemented w.r.t. the second entry v. It can be verified numerically.

Steps to reproduce

from copulas.bivariate import gumbel
g = gumbel.Gumbel()
g.theta = 1.2
arr = np.array([0.3,0.2]).reshape(1,2)
h = 1e-5
eps1 = np.array([h,0]).reshape(1,2)
eps2 = np.array([0,h]).reshape(1,2)

# should be close to 0 if it is partial derivative w.r.t. u
print(g.partial_derivative(arr) - (g.cumulative_distribution(arr + eps1) - g.cumulative_distribution(arr - eps1))/2/h)
# should be close to 0 if it is partial derivative w.r.t. v
print(g.partial_derivative(arr) - (g.cumulative_distribution(arr + eps2) - g.cumulative_distribution(arr - eps2))/2/h)
[0.13765666]
[-7.83406673e-12]

LiZhongyangLi avatar Oct 28 '21 15:10 LiZhongyangLi