Closed jobstdavid closed 2 months ago
Thanks for pointing this out.
ptvn
function offered here, it does have special cases for handling n<=3:
https://github.com/david-cortes/approxcdf/blob/ff51ad1a177c4be7fc4902f60c6947e2ae3da5b0/src/tvbs.cpp#L198
The method for 3d is very similar to TVPACK
. Note that while it is theoretically possible to vectorize and it has compiler hints for it, it's very unlikely that a compiler will actually end up vectorizing that (at least GCC and CLANG do not), since it includes operations like exp
and sin
.Also, if you're looking for a fast bivariate/trivariate CDF calculator to use in some package, you can shave off most of the running time latency from mvtnorm
by calling the TVPACK Fortran functions directly without the extra checks that mvtnorm
does:
https://www.math.wsu.edu/faculty/genz/software/software.html
Timings from it are not too much worse than from the implementations in this package, but the calculations are more accurate.
@david-cortes Thank you for your helpful hints!
Hey,
I tested your R-package "approxcdf" and I like it a lot, especially due to its speed! That's great! Unfortunately, I detected a completely inaccurate approximation for the trivariate normal distribution:
This issue also happens for
i.e. settings where more than one upper bound is infinity are affected, as well. Do you think, you can fix it?
Some other ideas came to my mind, which could improve the ease of use and you could think about it:
mvtnorm
and relates to the first point.CRAN
?