edu.uah.math.distributions
Class DieDistribution

java.lang.Object
  extended by edu.uah.math.distributions.Distribution
      extended by edu.uah.math.distributions.FiniteDistribution
          extended by edu.uah.math.distributions.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.

Version:
August, 2003
Author:
Kyle Siegrist, Dawn Duehring
See Also:
Serialized Form

Field Summary
static int FAIR
           
static int FLAT16
           
static int FLAT25
           
static int FLAT34
           
static int LEFT
           
static int RIGHT
           
 
Fields inherited from class edu.uah.math.distributions.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 edu.uah.math.distributions.FiniteDistribution
getDensity, getLowerValue, getProbabilities, getProbabilities, getSize, getUpperValue, getWidth, setLowerValue, setParameters, setProbabilities, setUpperValue, setWidth
 
Methods inherited from class edu.uah.math.distributions.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
See Also:
Constant Field Values

FLAT16

public static final int FLAT16
See Also:
Constant Field Values

FLAT25

public static final int FLAT25
See Also:
Constant Field Values

FLAT34

public static final int FLAT34
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
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 - the lower value of the domain
b - the upper value of the domain
w - the step size of the domain
p - the array of probabilities

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