1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

/// Continuous distribution
pub trait Continuous<A, B>
{
   	/// Probability density function
   	///
   	/// # Arguments
   	///
   	/// *`x`: random variable
   	///
    fn pdf<'a, 'b>(self: &'a Self, x: A) -> f64;

    /// Cumulative distribution function
    ///
    /// # Arguments
    ///
    /// *`x`: random variable
    ///
    fn cdf<'a, 'b>(self: &'a Self, x: B) -> f64;

	/// Quantile function, inverse cdf
    fn quantile<'a, 'b>(self: &'a Self, p: B) -> f64;

	/// Mean
	fn mean<'a>(self: &'a Self) -> f64;

	/// Variance
	fn variance<'a>(self: &'a Self) -> f64;

}

/// Discrete distribution
pub trait Discrete<A, B>
{
   	/// Probability mass function
   	///
   	/// # Arguments
   	///
   	/// *`x`: random variable
   	///
    fn pmf<'a, 'b>(self: &'a Self, x: A) -> f64;

    ///Cumulative distribution function
    ///
    /// # Arguments
    ///
    /// * `x`: random variable
    ///
    fn cdf<'a, 'b>(self: &'a Self, x: B) -> f64;

    /// Mean
    ///
	fn mean<'a>(self: &'a Self) -> f64;

   	/// Variance
   	///
	fn variance<'a>(self: &'a Self) -> f64;

}