edu.uah.math.distributions
Class MixtureDistribution

java.lang.Object
  extended by edu.uah.math.distributions.Distribution
      extended by edu.uah.math.distributions.MixtureDistribution
All Implemented Interfaces:
java.io.Serializable

public class MixtureDistribution
extends Distribution
implements java.io.Serializable

This class models a distributions which is the mixture of a given set of distributions using a given set of probabilities as the mixing parameters

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

Field Summary
 
Fields inherited from class edu.uah.math.distributions.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
MixtureDistribution()
          This default constructor creates the mixture of two standard normal distributions with equal mixing parameters.
MixtureDistribution(Distribution[] d, double[] p)
          This general constructor creates the mixture of a given array of distribuitons using a given array of probabilities as the mixing parameters.
MixtureDistribution(Distribution d0, Distribution d1)
          This special constructor creates the mixture of two distributions with equal mixing probabilities
MixtureDistribution(Distribution d0, Distribution d1, double a)
          This special constructor creates the mixture of two distributions using a specified number and its complement as the mixing probabilities.
 
Method Summary
 double getCDF(double x)
          This method computes the cumulative distributions function of the mixture distributions as a linear combination of the CDFs of the given distributions, using the mixing probabilities.
 double getDensity(double x)
          This method computes the density function of the mixture distributions as a linear combination of the densities of the given distributions using the mixing probabilities.
 Distribution[] getDistributions()
          This method returns the array of distributions.
 Distribution getDistributions(int i)
          This method returns a particular distribution.
 double getMean()
          This method computes the mean of the mixture distributions as a linear combination of the means of the given distributions, using the mixing probabilities.
 double[] getProbabilities()
          This method returns the array of probabilities.
 double getProbability(int i)
          This method returns a particular probability .
 double getVariance()
          This method computes the variance of the mixture distributions in terms of the variances and means of the given distributions and the mixing parameters.
 void setDistributions(Distribution[] d)
          This method sets the distributions.
 void setDistributions(int i, Distribution d)
          This method sets a particular distribution.
 void setParameters(Distribution[] d, double[] p)
          This method sets up the domain of the general mixture distributions in terms of the distributions being mixed.
 void setParameters(Distribution d0, Distribution d1, double a)
          This method sets up the domain of for the mixture of two distributions.
 void setProbabilities(double[] p)
          This method sets the probabilities.
 void setProbabilities(int i, double p)
          This method sets a particular probability.
 double simulate()
          This method simulates a value from the mixture distributions.
 
Methods inherited from class edu.uah.math.distributions.Distribution
getDomain, getFailureRate, getMaxDensity, getMedian, getMGF, getMoment, getMoment, getPGF, getQuantile, getSD, getType, setDomain, setDomain, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MixtureDistribution

public MixtureDistribution(Distribution[] d,
                           double[] p)
This general constructor creates the mixture of a given array of distribuitons using a given array of probabilities as the mixing parameters.

Parameters:
d - the array of distributions to be mixed
p - the array of mixing probabilities

MixtureDistribution

public MixtureDistribution(Distribution d0,
                           Distribution d1,
                           double a)
This special constructor creates the mixture of two distributions using a specified number and its complement as the mixing probabilities.

Parameters:
d0 - the index 0 distributions
d1 - the index 1 distributions
a - the index 1 mixing parameter (the index 0 parameter is 1 − a)

MixtureDistribution

public MixtureDistribution(Distribution d0,
                           Distribution d1)
This special constructor creates the mixture of two distributions with equal mixing probabilities

Parameters:
d0 - the index 0 distribution
d1 - the index 1 distribution

MixtureDistribution

public MixtureDistribution()
This default constructor creates the mixture of two standard normal distributions with equal mixing parameters. The result, of course, is simply another standard normal distribution.

Method Detail

setParameters

public void setParameters(Distribution[] d,
                          double[] p)
This method sets up the domain of the general mixture distributions in terms of the distributions being mixed.

Parameters:
d - the array of distributions being mixed
p - the array of mixing probabilities

setParameters

public void setParameters(Distribution d0,
                          Distribution d1,
                          double a)
This method sets up the domain of for the mixture of two distributions.

Parameters:
d0 - the index 0 distributions
d1 - the index 1 distributions
a - the index 1 mixing parameter (the index 0 parameter is 1 − a)

getDensity

public double getDensity(double x)
This method computes the density function of the mixture distributions as a linear combination of the densities of the given distributions using the mixing probabilities.

Specified by:
getDensity in class Distribution
Parameters:
x - a number in the domain of the distributions
Returns:
the probability density at x

getCDF

public double getCDF(double x)
This method computes the cumulative distributions function of the mixture distributions as a linear combination of the CDFs of the given distributions, using the mixing probabilities.

Overrides:
getCDF in class Distribution
Parameters:
x - a number in the domain of the distribution
Returns:
the cumulative probability at x

getMean

public double getMean()
This method computes the mean of the mixture distributions as a linear combination of the means of the given distributions, using the mixing probabilities.

Overrides:
getMean in class Distribution
Returns:
the mean

getVariance

public double getVariance()
This method computes the variance of the mixture distributions in terms of the variances and means of the given distributions and the mixing parameters.

Overrides:
getVariance in class Distribution
Returns:
the variance

simulate

public double simulate()
This method simulates a value from the mixture distributions. This is done by selecting an index at random, according to the mixing parameters, and then simulating a value from the randomly chosen distributions.

Overrides:
simulate in class Distribution
Returns:
a simulated value from the distribution

setDistributions

public void setDistributions(Distribution[] d)
This method sets the distributions.

Parameters:
d - the array of distributions

setDistributions

public void setDistributions(int i,
                             Distribution d)
This method sets a particular distribution.

Parameters:
i - the index
d - the distribution

getDistributions

public Distribution[] getDistributions()
This method returns the array of distributions.

Returns:
the array of distributions

getDistributions

public Distribution getDistributions(int i)
This method returns a particular distribution.

Parameters:
i - the index
Returns:
the distribution corresponding to the index

setProbabilities

public void setProbabilities(double[] p)
This method sets the probabilities.

Parameters:
p - the array of probabilities

setProbabilities

public void setProbabilities(int i,
                             double p)
This method sets a particular probability.

Parameters:
i - the index
p - the probability

getProbabilities

public double[] getProbabilities()
This method returns the array of probabilities.

Returns:
the array of distributions

getProbability

public double getProbability(int i)
This method returns a particular probability .

Parameters:
i - the index
Returns:
the probability corresponding to the index