StatsLib is a templated C++ library for fast computation of statistical distribution functions.
Author: Keith O'Hara
License: StatsLib is licensed under the GNU General Public License (GPL) version 2, or (at your option) any later version.
cdf, pdf, quantile, and random variable generation:
// evaluate the normal PDF at x = 1, mu = 0, sigma = 1 double dval_1 = stats::dnorm(1.0,0.0,1.0) // evaluate the normal PDF at x = 1, mu = 0, sigma = 1, and return the log value double dval_2 = stats::dnorm(1.0,0.0,1.0,true) // evaluate the normal CDF at x = 1, mu = 0, sigma = 1 double pval_1 = stats::pnorm(1.0,0.0,1.0) // evaluate the Laplacian quantile at p = 0.1, mu = 0, sigma = 1 double qval_1 = stats::qlaplace(0.1,0.0,1.0) // matrix input of beta-distributed random variables arma::mat beta_rvs = stats::rbeta(100,100,3.0,2.0); arma::mat beta_cdf_vals = stats::pbeta(beta_rvs,3.0,2.0);
To build the test files:
# clone stats git clone -b master --single-branch https://github.com/kthohr/stats ./stats # compile tests cd ./stats/tests ./cov_setup