public class MixtureDistribution extends Distribution implements java.io.Serializable
CONTINUOUS, DISCRETE, MIXED
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
getDomain, getFailureRate, getMaxDensity, getMedian, getMGF, getMoment, getMoment, getPGF, getQuantile, getSD, getType, setDomain, setDomain, toString
public MixtureDistribution(Distribution[] d, double[] p)
d
- the array of distributions to be mixedp
- the array of mixing probabilitiespublic MixtureDistribution(Distribution d0, Distribution d1, double a)
d0
- the index 0 distributionsd1
- the index 1 distributionsa
- the index 1 mixing parameter (the index 0 parameter is 1 − a)public MixtureDistribution(Distribution d0, Distribution d1)
d0
- the index 0 distributiond1
- the index 1 distributionpublic MixtureDistribution()
public void setParameters(Distribution[] d, double[] p)
d
- the array of distributions being mixedp
- the array of mixing probabilitiespublic void setParameters(Distribution d0, Distribution d1, double a)
d0
- the index 0 distributionsd1
- the index 1 distributionsa
- the index 1 mixing parameter (the index 0 parameter is 1 − a)public double getDensity(double x)
getDensity
in class Distribution
x
- a number in the domain of the distributionspublic double getCDF(double x)
getCDF
in class Distribution
x
- a number in the domain of the distributionpublic double getMean()
getMean
in class Distribution
public double getVariance()
getVariance
in class Distribution
public double simulate()
simulate
in class Distribution
public void setDistributions(Distribution[] d)
d
- the array of distributionspublic void setDistributions(int i, Distribution d)
i
- the indexd
- the distributionpublic Distribution[] getDistributions()
public Distribution getDistributions(int i)
i
- the indexpublic void setProbabilities(double[] p)
p
- the array of probabilitiespublic void setProbabilities(int i, double p)
i
- the indexp
- the probabilitypublic double[] getProbabilities()
public double getProbability(int i)
i
- the index