Skip to main content

copula_core/
prelude.rs

1//! Convenient imports for common copula operations.
2//!
3//! This module re-exports the most commonly used types and functions,
4//! allowing users to get started quickly with a single `use` statement.
5//!
6//! # Examples
7//!
8//! ```rust
9//! use copula_core::prelude::*;
10//!
11//! let copula = ClaytonCopula::new(2.0)?;
12//! let data = DMatrix::from_row_slice(4, 2, &[1.2, 0.3, 0.7, 0.9, 2.5, 1.1, 1.9, 2.0]);
13//! let pseudo_obs = to_pseudo_observations(&data)?;
14//! let density = copula.pdf(&[pseudo_obs[(0, 0)], pseudo_obs[(0, 1)]])?;
15//! assert!(density >= 0.0);
16//! # Ok::<(), CopulaError>(())
17//! ```
18
19// Core error and result types
20pub use crate::error::{CopulaError, Result};
21
22// Main traits
23pub use crate::traits::{ArchimedeanCopula, Copula};
24
25#[cfg(feature = "estimation")]
26pub use crate::model_selection::k_fold_cv;
27#[cfg(feature = "estimation")]
28pub use crate::traits::FittableCopula;
29
30// Utility functions
31pub use crate::utils::{
32    empirical_copula_cdf, empirical_ranks, information_criteria, kendall_tau,
33    multivariate_kendall_tau, multivariate_spearman_rho, remove_missing_values, spearman_rho,
34    to_pseudo_observations, validate_correlation_matrix,
35};
36// Goodness-of-fit statistics
37pub use crate::testing::{
38    anderson_darling, cramer_von_mises, cvm_multiplier_bootstrap, kolmogorov_smirnov,
39};
40
41// Elliptical copulas
42pub use crate::elliptical::{GaussianCopula, StudentTCopula};
43
44// Archimedean copulas
45pub use crate::archimedean::{AMHCopula, ClaytonCopula, FrankCopula, GumbelCopula, JoeCopula};
46
47// Other copula families
48pub use crate::other::{EmpiricalCopula, MarshallOlkinCopula};
49
50// External types commonly used with copulas
51pub use nalgebra::{DMatrix, DVector};
52
53// Random number generation (commonly needed for sampling)
54pub use rand::{rng, Rng, RngExt};
55
56// Re-export some useful constants
57/// Commonly used confidence levels for statistical tests
58pub mod confidence_levels {
59    /// 90% confidence level (α = 0.10)
60    pub const LEVEL_90: f64 = 0.90;
61    /// 95% confidence level (α = 0.05)  
62    pub const LEVEL_95: f64 = 0.95;
63    /// 99% confidence level (α = 0.01)
64    pub const LEVEL_99: f64 = 0.99;
65}
66
67/// Common significance levels for hypothesis testing
68pub mod significance_levels {
69    /// α = 0.01 (very strong evidence)
70    pub const ALPHA_001: f64 = 0.01;
71    /// α = 0.05 (strong evidence)
72    pub const ALPHA_005: f64 = 0.05;
73    /// α = 0.10 (moderate evidence)
74    pub const ALPHA_010: f64 = 0.10;
75}