brentonk / pbivnorm Goto Github PK
View Code? Open in Web Editor NEWVectorized bivariate normal CDF in R
Vectorized bivariate normal CDF in R
Installation on Fedora Linux 37 with gfortran 12.2.1 and R 4.2.3
* installing *source* package ‘pbivnorm’ ...
** package ‘pbivnorm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -fno-optimize-sibling-calls -fpic -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules -c pbivnorm.f -o pbivnorm.o
f951: Warning: ‘-Werror=’ argument ‘-Werror=format-security’ is not valid for Fortran
pbivnorm.f:381:11:
381 | hs = sign( one, dh - r*dk )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
pbivnorm.f:382:11:
382 | ks = sign( one, dk - r*dh )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
gcc -shared -L/usr/lib64/R/lib -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -o pbivnorm.so pbivnorm.o -lgfortran -lm -lquadmath -L/usr/lib64/R/lib -lR
installing to /home/user/R/x86_64-redhat-linux-gnu-library/4.2/00LOCK-pbivnorm/00new/pbivnorm/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package ‘pbivnorm’
finding HTML links ... done
pbivnorm html
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (pbivnorm)
Unexpected behavior when rho
is a vector while x
is a scalar:
R> library(pbivnorm)
R> rho <- seq(-1, 1, by = 0.1)
R> x <- 1
R> y <- 1
R> pbivnorm(x, y, rho)
[1] 0.68269
Warning message:
In correl[] <- rho :
number of items to replace is not a multiple of replacement length
The package should be fixed to make the above code work the same as the following:
R> library(pbivnorm)
R> rho <- seq(-1, 1, by = 0.1)
R> x <- rep(1, length(rho))
R> y <- rep(1, length(rho))
R> pbivnorm(x, y, rho)
[1] 0.68269 0.68269 0.68275 0.68320 0.68441 0.68647 0.68936 0.69301 0.69734
[10] 0.70230 0.70786 0.71401 0.72076 0.72815 0.73625 0.74520 0.75522 0.76667
[19] 0.78033 0.79818 0.84134
Hi brentonk,
How to specify the lower and upper truncation points? Thanks!
e.g.,
> rho <- 0.31
> upper <- c(1, 1)
> lower <- c(-3, -5)
> pbivnorm(upper[1], upper[2], rho)
[1] 0.728924
> pbivnorm(upper[1], upper[2], rho) - pbivnorm(lower[1], upper[2], rho) - pbivnorm(upper[1], lower[2], rho) + pbivnorm(lower[1], lower[2], rho)
[1] 0.7275971
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.