SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members

Represents a constant discrete distribution taking a single real value with probability 1. More...

Inheritance diagram for ConstantDist:
[legend]
Collaboration diagram for ConstantDist:
[legend]

Public Member Functions

 ConstantDist (double c)
 Constructs a new constant distribution with probability 1 at c.
 
double getMean ()
 Returns the mean \(E[X] = c\). More...
 
double getVariance ()
 Returns the variance \(\mbox{Var}[X] = 0\). More...
 
double getStandardDeviation ()
 Returns the standard deviation = 0. More...
 
double inverseF (double u)
 Returns the inverse distribution function \(c = F^{-1}(u)\). More...
 
- Public Member Functions inherited from DiscreteDistribution
 DiscreteDistribution (double[] values, double[] prob, int n)
 Constructs a discrete distribution over the \(n\) values contained in array values, with probabilities given in array prob. More...
 
 DiscreteDistribution (int[] values, double[] prob, int n)
 Similar to DiscreteDistribution(double[], double[], int).
 
double cdf (double x)
 
double barF (double x)
 
double inverseF (double u)
 
double getMean ()
 Computes the mean \(E[X] = \sum_i^{} p_i x_i\) of the distribution.
 
double getVariance ()
 Computes the variance \(\mbox{Var}[X] = \sum_i^{} p_i (x_i - E[X])^2\) of the distribution.
 
double getStandardDeviation ()
 Computes the standard deviation of the distribution.
 
double [] getParams ()
 Returns a table containing the parameters of the current distribution. More...
 
int getN ()
 Returns the number of possible values \(x_i\).
 
double prob (int i)
 Returns \(p_i\), the probability of the \(i\)-th value, for. More...
 
double getValue (int i)
 Returns the \(i\)-th value \(x_i\), for \(0\le i<n\).
 
double getXinf ()
 Returns the lower limit \(x_0\) of the support of the distribution. More...
 
double getXsup ()
 Returns the upper limit \(x_{n-1}\) of the support of the distribution. More...
 
String toString ()
 Returns a String containing information about the current distribution.
 

Additional Inherited Members

- Protected Attributes inherited from DiscreteDistribution
double cdf [] = null
 
double pr [] = null
 
int xmin = 0
 
int xmax = 0
 
int xmed = 0
 
int nVal
 
double sortedVal []
 
double supportA = Double.NEGATIVE_INFINITY
 
double supportB = Double.POSITIVE_INFINITY
 

Detailed Description

Represents a constant discrete distribution taking a single real value with probability 1.

Its mass function is

\[ p(x) = \left\{\begin{array}{ll} 1, & \qquad\mbox{for } x = c, \\ 0, & \qquad\mbox{elsewhere. } \end{array}\right. \tag{fcons} \]

Its distribution function is

\[ F(x) = \left\{\begin{array}{ll} 0, & \qquad\mbox{ for } x < c \\ 1, & \qquad\mbox{ for } x \ge c. \end{array}\right. \tag{cdfcons} \]

Member Function Documentation

◆ getMean()

double getMean ( )

Returns the mean \(E[X] = c\).

Returns
\(c\)

Implements Distribution.

◆ getStandardDeviation()

double getStandardDeviation ( )

Returns the standard deviation = 0.

Returns
0

Implements Distribution.

◆ getVariance()

double getVariance ( )

Returns the variance \(\mbox{Var}[X] = 0\).

Returns
0

Implements Distribution.

◆ inverseF()

double inverseF ( double  u)

Returns the inverse distribution function \(c = F^{-1}(u)\).

Returns
\(c\)

Implements Distribution.


The documentation for this class was generated from the following file: