vinecopulib::tools_stats namespace

Utilities for statistical analysis.

Functions

auto simulate_uniform(const size_t& n, const size_t& d, bool qrng, std::vector<int> seeds) -> Eigen::MatrixXd
Simulates from the multivariate uniform distribution.
auto to_pseudo_obs(Eigen::MatrixXd x, const std::string& ties_method) -> Eigen::MatrixXd
Applies the empirical probability integral transform to a data matrix.
auto to_pseudo_obs_1d(Eigen::VectorXd x, const std::string& ties_method) -> Eigen::VectorXd
Applies the empirical probability integral transform to a data vector.
auto pairwise_mcor(const Eigen::MatrixXd& x, const Eigen::VectorXd& weights) -> double
calculates the pairwise maximum correlation coefficient.
auto ghalton(const size_t& n, const size_t& d, const std::vector<int>& seeds) -> Eigen::MatrixXd
Simulates from the multivariate Generalized Halton Sequence.
auto sobol(const size_t& n, const size_t& d, const std::vector<int>& seeds) -> Eigen::MatrixXd
Simulates from the multivariate Sobol sequence.
auto pbvt(const Eigen::MatrixXd& z, int nu, double rho) -> Eigen::VectorXd
Computes bivariate t probabilities.
auto pbvnorm(const Eigen::MatrixXd& z, double rho) -> Eigen::VectorXd
Compute bivariate normal probabilities.
auto dnorm(const Eigen::MatrixXd& x) -> Eigen::MatrixXd
Density function of the Standard normal distribution.
auto pnorm(const Eigen::MatrixXd& x) -> Eigen::MatrixXd
Distribution function of the Standard normal distribution.
auto qnorm(const Eigen::MatrixXd& x) -> Eigen::MatrixXd
Quantile function of the Standard normal distribution.
auto dt(const Eigen::MatrixXd& x, double nu) -> Eigen::MatrixXd
Density function of the Student t distribution.
auto pt(const Eigen::MatrixXd& x, double nu) -> Eigen::MatrixXd
Distribution function of the Student t distribution.
auto qt(const Eigen::MatrixXd& x, double nu) -> Eigen::MatrixXd
Quantile function of the Student t distribution.

Function documentation

Eigen::MatrixXd vinecopulib::tools_stats::simulate_uniform(const size_t& n, const size_t& d, bool qrng, std::vector<int> seeds)

Simulates from the multivariate uniform distribution.

Parameters
n Number of observations.
d Dimension.
qrng If true, quasi-numbers are generated.
seeds Seeds of the random number generator; if empty (default), the random number generator is seeded randomly.
Returns An $ n \times d $ matrix of independent $ \mathrm{U}[0, 1] $ random variables.

If qrng = TRUE, generalized Halton sequences (see ghalton()) are used for $ d \leq 300 $ and Sobol sequences otherwise (see sobol()).

Eigen::MatrixXd vinecopulib::tools_stats::to_pseudo_obs(Eigen::MatrixXd x, const std::string& ties_method)

Applies the empirical probability integral transform to a data matrix.

Parameters
x A matrix of real numbers.
ties_method Indicates how to treat ties; same as in R, see https://stat.ethz.ch/R-manual/R-devel/library/base/html/rank.html.
Returns Pseudo-observations of the copula, i.e. $ F_X(x) $ (column-wise).

Gives pseudo-observations from the copula by applying the empirical distribution function (scaled by $ n + 1 $ ) to each margin/column.

Eigen::VectorXd vinecopulib::tools_stats::to_pseudo_obs_1d(Eigen::VectorXd x, const std::string& ties_method)

Applies the empirical probability integral transform to a data vector.

Parameters
x A vector of real numbers.
ties_method Indicates how to treat ties; same as in R, see https://stat.ethz.ch/R-manual/R-devel/library/base/html/rank.html.
Returns Pseudo-observations of the copula, i.e. $ F_X(x) $ .

Gives pseudo-observations from the copula by applying the empirical distribution function (scaled by $ n + 1 $ ) to each margin/column.

Eigen::MatrixXd vinecopulib::tools_stats::ghalton(const size_t& n, const size_t& d, const std::vector<int>& seeds)

Simulates from the multivariate Generalized Halton Sequence.

Parameters
n Number of observations.
d Dimension.
seeds Seeds to scramble the quasi-random numbers; if empty (default), the quasi-random number generator is seeded randomly.
Returns An $ n \times d $ matrix of quasi-random $ \mathrm{U}[0, 1] $ variables.

For more information on Generalized Halton Sequence, see Faure, H., Lemieux, C. (2009). Generalized Halton Sequences in 2008: A Comparative Study. ACM-TOMACS 19(4), Article 15.

Eigen::MatrixXd vinecopulib::tools_stats::sobol(const size_t& n, const size_t& d, const std::vector<int>& seeds)

Simulates from the multivariate Sobol sequence.

Parameters
n Number of observations.
d Dimension.
seeds Seeds to scramble the quasi-random numbers; if empty (default), the quasi-random number generator is seeded randomly.
Returns An $ n \times d $ matrix of quasi-random $ \mathrm{U}[0, 1] $ variables.

For more information on the Sobol sequence, see S. Joe and F. Y. Kuo (2008), constructing Sobol sequences with better two-dimensional projections, SIAM J. Sci. Comput. 30, 2635–2654.

Eigen::VectorXd vinecopulib::tools_stats::pbvt(const Eigen::MatrixXd& z, int nu, double rho)

Computes bivariate t probabilities.

Parameters
z An $ n \times 2 $ matrix of evaluation points.
nu Number of degrees of freedom.
rho Correlation.
Returns An $ n \times 1 $ vector of probabilities.

Based on the method described by Dunnett, C.W. and M. Sobel, (1954), A bivariate generalization of Student's t-distribution with tables for certain special cases, Biometrika 41, pp. 153-169. Translated from the Fortran routines of Alan Genz (www.math.wsu.edu/faculty/genz/software/fort77/mvtdstpack.f).

Eigen::VectorXd vinecopulib::tools_stats::pbvnorm(const Eigen::MatrixXd& z, double rho)

Compute bivariate normal probabilities.

Parameters
z An $ n \times 2 $ matrix of evaluation points.
rho Correlation.
Returns An $ n \times 1 $ vector of probabilities.

A function for computing bivariate normal probabilities; developed using Drezner, Z. and Wesolowsky, G. O. (1989), On the Computation of the Bivariate Normal Integral, J. Stat. Comput. Simul.. 35 pp. 101-107. with extensive modications for double precisions by Alan Genz and Yihong Ge. Translated from the Fortran routines of Alan Genz (www.math.wsu.edu/faculty/genz/software/fort77/mvtdstpack.f).

Eigen::MatrixXd vinecopulib::tools_stats::dnorm(const Eigen::MatrixXd& x)

Density function of the Standard normal distribution.

Parameters
x Evaluation points.
Returns An $ n \times d $ matrix of evaluated densities.

Eigen::MatrixXd vinecopulib::tools_stats::pnorm(const Eigen::MatrixXd& x)

Distribution function of the Standard normal distribution.

Parameters
x Evaluation points.
Returns An $ n \times d $ matrix of evaluated probabilities.

Eigen::MatrixXd vinecopulib::tools_stats::qnorm(const Eigen::MatrixXd& x)

Quantile function of the Standard normal distribution.

Parameters
x Evaluation points.
Returns An $ n \times d $ matrix of evaluated quantiles.

Eigen::MatrixXd vinecopulib::tools_stats::dt(const Eigen::MatrixXd& x, double nu)

Density function of the Student t distribution.

Parameters
x Evaluation points.
nu Degrees of freedom parameter.
Returns An $ n \times d $ matrix of evaluated densities.

Eigen::MatrixXd vinecopulib::tools_stats::pt(const Eigen::MatrixXd& x, double nu)

Distribution function of the Student t distribution.

Parameters
x Evaluation points.
nu Degrees of freedom parameter.
Returns An $ n \times d $ matrix of evaluated probabilities.

Eigen::MatrixXd vinecopulib::tools_stats::qt(const Eigen::MatrixXd& x, double nu)

Quantile function of the Student t distribution.

Parameters
x Evaluation points.
nu Degrees of freedom parameter.
Returns An $ n \times d $ matrix of evaluated quantiles.