When calling the TllBicop in bicop, there seems to be an error in pbicop().
true_copula <- bicop_dist(family = "gaussian", parameters = 0.5)
x <- rbicop(1000, true_copula)
fit_x <- bicop(x, family_set = "tll")
xy <- expand.grid(u1 = seq(0, 1, length.out = 5),
u2 = seq(0, 1, length.out = 5))
zz <- pbicop(as.matrix(xy), fit_x)
contour(x = seq(0, 1, length.out = 5),
y = seq(0, 1, length.out = 5),
z = matrix(zz, nrow = 5, byrow = FALSE))
The CDF surface seems to have some issue.
I found the possible issue in tools_interpolation.ipp: InterpolationGrid::integrate_2d()
tmpint = int_on_grid(upr, tmpvals2, grid_points_);
tmpint1 = int_on_grid(1.0, tmpvals2, grid_points_);
return std::min(std::max(tmpint / tmpint1, 1e-10), 1 - 1e-10);
It seems that dividing by tmpint1 (which is approximately u2) scales the CDF incorrectly. Removing the division fixes the issue:
tmpint = int_on_grid(upr, tmpvals2, grid_points_);
return std::min(std::max(tmpint, 1e-10), 1.0 - 1e-10);
When calling the TllBicop in
bicop, there seems to be an error inpbicop().The CDF surface seems to have some issue.
I found the possible issue in
tools_interpolation.ipp:InterpolationGrid::integrate_2d()It seems that dividing by
tmpint1(which is approximately u2) scales the CDF incorrectly. Removing the division fixes the issue: