sdsu.algorithms.data
Class ProbabilityDistribution

java.lang.Object
  |
  +--sdsu.algorithms.data.ProbabilityDistribution
Direct Known Subclasses:
DiscreteProbability

public abstract class ProbabilityDistribution
extends java.lang.Object
implements NumberGenerator

An abstract class defining an interface for probability distributions. A sample space is the set of events or items of interest. A probability function on a sample space is map from the sample space to the interval [0, 1], such that sum of the probabilities of all items in the space is one. A random variable is a real-valued function defined over the events in a sample space. The probability function of a random varabiel is a probability function. The density is a function that assigns probabilities to allowed ranges of the random variable. This class and many of its subclasses are adapted from Smalltalk-80: The language and Its Implementation, Goldberg & Robson, Addison-Wesley, 1983, chapter 21, pages 417-438.

Version:
1.0 10 June 1997
Author:
Roger Whitney (whitney@cs.sdsu.edu)

Constructor Summary
ProbabilityDistribution()
           
 
Method Summary
abstract  double density(double sampleSpaceItem)
          Returns the probability of an item in the sample space will occur.
 double density(java.lang.Number sampleSpaceItem)
           
abstract  java.util.Vector distribution(java.util.Vector sampleSpaceCollection)
          Computes the density of each item in the vector.
abstract  double mean()
          Returns the mean of the probability distribution
abstract  double nextElement()
          Returns a ramdon element in the sample space.
abstract  double variance()
          Returns the variance of the probability distribution
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProbabilityDistribution

public ProbabilityDistribution()
Method Detail

density

public abstract double density(double sampleSpaceItem)
                        throws OutOfBoundsException
Returns the probability of an item in the sample space will occur.
Parameters:
sampleSpaceItem - item in the sample space for which the probability of occuring is computed.
Throws:
OutOfBoundsException - if sampleSpaceItem is not in the sample space of the distribution.

density

public double density(java.lang.Number sampleSpaceItem)

mean

public abstract double mean()
Returns the mean of the probability distribution

variance

public abstract double variance()
Returns the variance of the probability distribution

distribution

public abstract java.util.Vector distribution(java.util.Vector sampleSpaceCollection)
Computes the density of each item in the vector. Returns a vector of the densities.

nextElement

public abstract double nextElement()
Returns a ramdon element in the sample space. The probability of a given item being returned is determined by the probability distribution on the sample space.
Specified by:
nextElement in interface NumberGenerator