org.jscience.mathematics.statistics
Class DieDistribution

java.lang.Object
  extended by org.jscience.mathematics.statistics.Distribution
      extended by org.jscience.mathematics.statistics.FiniteDistribution
          extended by org.jscience.mathematics.statistics.DieDistribution
All Implemented Interfaces:
java.io.Serializable

public class DieDistribution
extends FiniteDistribution
implements java.io.Serializable

This class models the distribution for a standard 6-sided die.

See Also:
Serialized Form

Field Summary
static int FAIR
          DOCUMENT ME!
static int FLAT16
          DOCUMENT ME!
static int FLAT25
          DOCUMENT ME!
static int FLAT34
          DOCUMENT ME!
static int LEFT
          DOCUMENT ME!
static int RIGHT
          DOCUMENT ME!
 
Fields inherited from class org.jscience.mathematics.statistics.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
DieDistribution()
          This default constructor creates a new fair die distribution.
DieDistribution(double[] p)
          This general constructor creates a new die distribution with specified probabilities.
DieDistribution(int n)
          This special constructor creates a new die distribution of a special type (1-6 flat, 2-5 flat, 3-4 flat, skewed left, skewed right, or fair).
 
Method Summary
 void setParameters(double a, double b, double w, double[] p)
          This method ensures that the finite distribution parameters are not changed to inappropriate values.
 void setProbabilities(double[] p)
          This method sets the probabilities.
 void setProbabilities(int n)
          This method specifies the probabilities for the special types (fair, 1-6 flat, 2-5 flat, 3-4 flat, skewed left, or skewed right).
 java.lang.String toString()
          This method returns a string that gives the name of the distribution and the values of the parameters.
 
Methods inherited from class org.jscience.mathematics.statistics.FiniteDistribution
getDensity, getLowerValue, getProbabilities, getProbabilities, getSize, getUpperValue, getWidth, setLowerValue, setParameters, setProbabilities, setUpperValue, setWidth
 
Methods inherited from class org.jscience.mathematics.statistics.Distribution
getCDF, getDomain, getFailureRate, getMaxDensity, getMean, getMedian, getMGF, getMoment, getMoment, getPGF, getQuantile, getSD, getType, getVariance, setDomain, setDomain, simulate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FAIR

public static final int FAIR
DOCUMENT ME!

See Also:
Constant Field Values

FLAT16

public static final int FLAT16
DOCUMENT ME!

See Also:
Constant Field Values

FLAT25

public static final int FLAT25
DOCUMENT ME!

See Also:
Constant Field Values

FLAT34

public static final int FLAT34
DOCUMENT ME!

See Also:
Constant Field Values

LEFT

public static final int LEFT
DOCUMENT ME!

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
DOCUMENT ME!

See Also:
Constant Field Values
Constructor Detail

DieDistribution

public DieDistribution(double[] p)
This general constructor creates a new die distribution with specified probabilities.

Parameters:
p - the array of probabilities

DieDistribution

public DieDistribution(int n)
This special constructor creates a new die distribution of a special type (1-6 flat, 2-5 flat, 3-4 flat, skewed left, skewed right, or fair).

Parameters:
n - the type of distribution

DieDistribution

public DieDistribution()
This default constructor creates a new fair die distribution.

Method Detail

setProbabilities

public void setProbabilities(int n)
This method specifies the probabilities for the special types (fair, 1-6 flat, 2-5 flat, 3-4 flat, skewed left, or skewed right).

Parameters:
n - the type of distribution

setProbabilities

public void setProbabilities(double[] p)
This method sets the probabilities. The length of the array must be 6.

Overrides:
setProbabilities in class FiniteDistribution
Parameters:
p - the array of probabilities

setParameters

public void setParameters(double a,
                          double b,
                          double w,
                          double[] p)
This method ensures that the finite distribution parameters are not changed to inappropriate values.

Overrides:
setParameters in class FiniteDistribution
Parameters:
a - DOCUMENT ME!
b - DOCUMENT ME!
w - DOCUMENT ME!
p - DOCUMENT ME!

toString

public java.lang.String toString()
This method returns a string that gives the name of the distribution and the values of the parameters.

Overrides:
toString in class FiniteDistribution
Returns:
a string giving the name of the distribution and the values of the parameters