Class GammaDistribution
- java.lang.Object
-
- de.uka.ipd.sdq.probfunction.math.apache.impl.AbstractContinousPDF
-
- de.uka.ipd.sdq.probfunction.math.apache.impl.GammaDistribution
-
- All Implemented Interfaces:
IContinousPDF,IGammaDistribution,IProbabilityDensityFunction,IProbabilityFunction
- Direct Known Subclasses:
GammaDistributionFromMoments
public class GammaDistribution extends AbstractContinousPDF implements IGammaDistribution
- See Also:
IGammaDistribution
-
-
Field Summary
-
Fields inherited from class de.uka.ipd.sdq.probfunction.math.apache.impl.AbstractContinousPDF
internalFunction, sampleDrawer
-
-
Constructor Summary
Constructors Modifier Constructor Description GammaDistribution(double alpha, double theta, IRandomGenerator rng)Constructs a GammaDist object with parameters alpha and theta.protectedGammaDistribution(IRandomGenerator rng)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IProbabilityDensityFunctionadd(IProbabilityDensityFunction pdf)Adds two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) + g(x)
An addition can only be performed if both functions are in the same domain (frequency or time).voidcheckConstrains()checks whether the following constraints are fulfilled : the sum of all probabilities is one.doubledensity(double x)Returns f(x), the density evaluated at x, as defined inumontreal.iro.lecuyer.probdist.ContinousDistribution#density(double)IProbabilityDensityFunctiondiv(IProbabilityDensityFunction pdf)Divides two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) / g(x)
A division can only be performed if both functions are in the same domain (frequency or time).doublegetAlpha()Shape parameterdoublegetArithmeticMeanValue()For a probability function, whose domain is integer or real the arithmetic mean - the sum of all measurements divided by the number of observations in the data set - is returned.IProbabilityDensityFunctiongetCumulativeFunction()returns the cumulative probability function associated with this probability function.IProbabilityDensityFunctiongetFourierTransform()Computes the fourier transform of the probability density function.IProbabilityDensityFunctiongetInverseFourierTransform()Computes the inverse fourier transform of the probability density function.doublegetLowerDomainBorder()Returns the smallest values of the domain.ObjectgetMedian()A median is a number dividing the higher half of a sample, a population, or a probability distribution from the lower half.ObjectgetPercentile(int p)In descriptive statistics, the 'p'th percentile is a scale value for a data series equal to the p/100 quantile.doublegetStandardDeviation()doublegetTheta()Scale parameter betadoublegetVariance()doublegetXinf()Returns xb such that the probability density is 0 everywhere outside the interval [xa, xb],doublegetXsup()Returns xa such that the probability density is 0 everywhere outside the interval [xa, xb]doublegreaterThan(IProbabilityDensityFunction pdf)Computes the probability that the random variable specified by this PDF is greater than the random variable specified by pdf.booleanhasOrderedDomain()If the domain of the probability functions is ordered, true is returned; false otherwise.doublelessThan(IProbabilityDensityFunction pdf)Computes the probability that the random variable specified by this PDF is less than the random variable specified by pdf.IProbabilityDensityFunctionmult(IProbabilityDensityFunction pdf)Multiplies two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) * g(x)
A multiplication can only be performed if both functions are in the same domain (frequency or time).doubleprobabilisticEquals(IProbabilityDensityFunction pdf)Computes the probability that two random variables characterised by the given PDFs are equal.IProbabilityDensityFunctionscale(double scalar)Scales a ProbabilityDensityFunctions on a "per value" basis:
h(x) = a * f(x)IProbabilityDensityFunctionshiftDomain(double scalar)Shifts the domain values of the PDF by the given scalarIProbabilityDensityFunctionstretchDomain(double scalar)Stretches the domain values of the PDF.IProbabilityDensityFunctionsub(IProbabilityDensityFunction pdf)Subtracts two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) - g(x)
A substraction can only be performed if both functions are in the same domain (frequency or time).-
Methods inherited from class de.uka.ipd.sdq.probfunction.math.apache.impl.AbstractContinousPDF
cdf, drawSample, getCoefficientOfVariance, getProbabilitySum, getUnit, inverseF, isInFrequencyDomain, isInTimeDomain
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.uka.ipd.sdq.probfunction.math.IContinousPDF
cdf, getCoefficientOfVariance, inverseF
-
Methods inherited from interface de.uka.ipd.sdq.probfunction.math.IProbabilityDensityFunction
drawSample
-
Methods inherited from interface de.uka.ipd.sdq.probfunction.math.IProbabilityFunction
getProbabilitySum, getUnit, isInFrequencyDomain, isInTimeDomain
-
-
-
-
Constructor Detail
-
GammaDistribution
public GammaDistribution(double alpha, double theta, IRandomGenerator rng)Constructs a GammaDist object with parameters alpha and theta.- Parameters:
alpha- shape parametertheta- scale parameter = 1 / rate parameter
-
GammaDistribution
protected GammaDistribution(IRandomGenerator rng)
-
-
Method Detail
-
density
public double density(double x)
Description copied from class:AbstractContinousPDFReturns f(x), the density evaluated at x, as defined inumontreal.iro.lecuyer.probdist.ContinousDistribution#density(double)- Specified by:
densityin interfaceIContinousPDF- Overrides:
densityin classAbstractContinousPDF- Returns:
- F(x)
-
add
public IProbabilityDensityFunction add(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException, UnknownPDFTypeException, IncompatibleUnitsException
Description copied from interface:IProbabilityDensityFunctionAdds two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) + g(x)
An addition can only be performed if both functions are in the same domain (frequency or time). If not a FunctionsInDifferenDomainsException is thrown.- Specified by:
addin interfaceIProbabilityDensityFunction- Overrides:
addin classAbstractContinousPDF- Parameters:
pdf- g(x), probability density function to add.- Returns:
- The sum of this function (f(x)) and pdf (g(x))
- Throws:
FunctionsInDifferenDomainsException- Thrown if both functions are in different domains.UnknownPDFTypeException- Thrown if one of the function is of an unknown type (not SamplePDf or BoxedPDF).IncompatibleUnitsException- Thrown if both functions have units that do not match.
-
div
public IProbabilityDensityFunction div(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException, UnknownPDFTypeException, IncompatibleUnitsException
Description copied from interface:IProbabilityDensityFunctionDivides two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) / g(x)
A division can only be performed if both functions are in the same domain (frequency or time). If not a FunctionsInDifferenDomainsException is thrown.- Specified by:
divin interfaceIProbabilityDensityFunction- Overrides:
divin classAbstractContinousPDF- Parameters:
pdf- g(x), probability density function to divide by.- Returns:
- The fraction of this function (f(x)) and pdf (g(x))
- Throws:
FunctionsInDifferenDomainsExceptionUnknownPDFTypeExceptionIncompatibleUnitsException
-
getFourierTransform
public IProbabilityDensityFunction getFourierTransform() throws FunctionNotInTimeDomainException
Description copied from interface:IProbabilityDensityFunctionComputes the fourier transform of the probability density function. Can only be applied if 'isInTimeDomain()' is true, otherwise a FunctionNotInTimeDomain exception is thrown.- Specified by:
getFourierTransformin interfaceIProbabilityDensityFunction- Overrides:
getFourierTransformin classAbstractContinousPDF- Returns:
- fourier transform of the PDF (in frequency domain)
- Throws:
FunctionNotInTimeDomainException
-
getInverseFourierTransform
public IProbabilityDensityFunction getInverseFourierTransform() throws FunctionNotInFrequencyDomainException
Description copied from interface:IProbabilityDensityFunctionComputes the inverse fourier transform of the probability density function. Can only be applied if 'isInFrequencyDomain()' is true, otherwise a FunctionNotInFrequencyDomainException is thrown.- Specified by:
getInverseFourierTransformin interfaceIProbabilityDensityFunction- Overrides:
getInverseFourierTransformin classAbstractContinousPDF- Returns:
- inverse fourier transform of the PDF (in time domain)
- Throws:
FunctionNotInFrequencyDomainException
-
getLowerDomainBorder
public double getLowerDomainBorder()
Description copied from interface:IProbabilityDensityFunctionReturns the smallest values of the domain. At the moment this will be zero. However, future implementations might allow arbitrary values here.- Specified by:
getLowerDomainBorderin interfaceIProbabilityDensityFunction- Returns:
- Smallest value of the domain.
-
greaterThan
public double greaterThan(IProbabilityDensityFunction pdf) throws ProbabilityFunctionException
Description copied from interface:IProbabilityDensityFunctionComputes the probability that the random variable specified by this PDF is greater than the random variable specified by pdf. Note that the randomvariables have to be independent.- Specified by:
greaterThanin interfaceIProbabilityDensityFunction- Overrides:
greaterThanin classAbstractContinousPDF- Parameters:
pdf- PDF to compare to.- Returns:
- Probability X_this > X_pdf
- Throws:
ProbabilityFunctionException
-
lessThan
public double lessThan(IProbabilityDensityFunction pdf) throws ProbabilityFunctionException
Description copied from interface:IProbabilityDensityFunctionComputes the probability that the random variable specified by this PDF is less than the random variable specified by pdf. Note that the randomvariables have to be independent.- Specified by:
lessThanin interfaceIProbabilityDensityFunction- Overrides:
lessThanin classAbstractContinousPDF- Parameters:
pdf- PDF to compare to.- Returns:
- Probability X_this < X_pdf
- Throws:
ProbabilityFunctionException
-
mult
public IProbabilityDensityFunction mult(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException, UnknownPDFTypeException, IncompatibleUnitsException
Description copied from interface:IProbabilityDensityFunctionMultiplies two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) * g(x)
A multiplication can only be performed if both functions are in the same domain (frequency or time). If not a FunctionsInDifferenDomainsException is thrown.- Specified by:
multin interfaceIProbabilityDensityFunction- Overrides:
multin classAbstractContinousPDF- Parameters:
pdf- g(x), probability density function to multiply with.- Returns:
- The product of this function (f(x)) and pdf (g(x))
- Throws:
FunctionsInDifferenDomainsException- Thrown if both functions are in different domains.UnknownPDFTypeException- Thrown if one of the function is of an unknown type (not SamplePDf or BoxedPDF).IncompatibleUnitsException- Thrown if both functions have units that do not match.
-
probabilisticEquals
public double probabilisticEquals(IProbabilityDensityFunction pdf) throws ProbabilityFunctionException
Description copied from interface:IProbabilityDensityFunctionComputes the probability that two random variables characterised by the given PDFs are equal. Note that the randomvariables have to be independent.- Specified by:
probabilisticEqualsin interfaceIProbabilityDensityFunction- Overrides:
probabilisticEqualsin classAbstractContinousPDF- Parameters:
pdf- PDF to compare to.- Returns:
- Probability that the two random variables characterised by the PDFs are equal.
- Throws:
ProbabilityFunctionException
-
scale
public IProbabilityDensityFunction scale(double scalar)
Description copied from interface:IProbabilityDensityFunctionScales a ProbabilityDensityFunctions on a "per value" basis:
h(x) = a * f(x)- Specified by:
scalein interfaceIProbabilityDensityFunction- Overrides:
scalein classAbstractContinousPDF- Parameters:
scalar- a, value to scale with.- Returns:
- The scaled function a*f(x)
-
sub
public IProbabilityDensityFunction sub(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException, UnknownPDFTypeException, IncompatibleUnitsException
Description copied from interface:IProbabilityDensityFunctionSubtracts two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) - g(x)
A substraction can only be performed if both functions are in the same domain (frequency or time). If not a FunctionsInDifferenDomainsException is thrown.- Specified by:
subin interfaceIProbabilityDensityFunction- Overrides:
subin classAbstractContinousPDF- Parameters:
pdf- g(x), probability density function to substract.- Returns:
- The difference of this function (f(x)) and pdf (g(x))
- Throws:
FunctionsInDifferenDomainsException- Thrown if both functions are in different domains.UnknownPDFTypeException- Thrown if one of the function is of an unknown type (not SamplePDf or BoxedPDF).IncompatibleUnitsException- Thrown if both functions have units that do not match.
-
checkConstrains
public void checkConstrains() throws NegativeDistanceException, ProbabilitySumNotOneException, FunctionNotInTimeDomainException, UnitNotSetException, UnitNameNotSetException, InvalidSampleValueExceptionDescription copied from interface:IProbabilityFunctionchecks whether the following constraints are fulfilled : the sum of all probabilities is one. all values are greater or equal 0.- Specified by:
checkConstrainsin interfaceIProbabilityFunction- Overrides:
checkConstrainsin classAbstractContinousPDF- Throws:
NegativeDistanceExceptionProbabilitySumNotOneExceptionFunctionNotInTimeDomainExceptionUnitNotSetExceptionUnitNameNotSetExceptionInvalidSampleValueException
-
getMedian
public Object getMedian() throws UnorderedDomainException
Description copied from interface:IProbabilityFunctionA median is a number dividing the higher half of a sample, a population, or a probability distribution from the lower half. The median of a finite list of numbers can be found by arranging all the observations from lowest value to highest value and picking the middle one.- Specified by:
getMedianin interfaceIProbabilityFunction- Returns:
- Object that is the border for the median.
- Throws:
UnorderedDomainException
-
getPercentile
public Object getPercentile(int p) throws IndexOutOfBoundsException, UnorderedDomainException
Description copied from interface:IProbabilityFunctionIn descriptive statistics, the 'p'th percentile is a scale value for a data series equal to the p/100 quantile. Thus:
* The 1st percentile cuts off lowest 1% of data
* The 98th percentile cuts off lowest 98% of data
* The 25th percentile is the first quartile
* The 50th percentile is the median.
One definition is that the pth percentile of n ordered values is obtained by first calculating the rank k = p(n+1)/100, rounded to the nearest integer and then taking the value that corresponds to that rank.- Specified by:
getPercentilein interfaceIProbabilityFunction- Parameters:
p- sets the percentile which shall be computed. p must take values between 0 and 100.- Returns:
- Object that is the border for the 'p'th percentile.
- Throws:
IndexOutOfBoundsExceptionUnorderedDomainException
-
hasOrderedDomain
public boolean hasOrderedDomain()
Description copied from interface:IProbabilityFunctionIf the domain of the probability functions is ordered, true is returned; false otherwise.- Specified by:
hasOrderedDomainin interfaceIProbabilityFunction- Returns:
- True, if the domain is ordered.
-
getAlpha
public double getAlpha()
Shape parameter- Specified by:
getAlphain interfaceIGammaDistribution
-
getTheta
public double getTheta()
Scale parameter beta- Specified by:
getThetain interfaceIGammaDistribution
-
getCumulativeFunction
public IProbabilityDensityFunction getCumulativeFunction() throws FunctionNotInTimeDomainException
Description copied from interface:IProbabilityDensityFunctionreturns the cumulative probability function associated with this probability function.- Specified by:
getCumulativeFunctionin interfaceIProbabilityDensityFunction- Overrides:
getCumulativeFunctionin classAbstractContinousPDF- Returns:
- the computed cumulative probability function.
- Throws:
FunctionNotInTimeDomainException
-
shiftDomain
public IProbabilityDensityFunction shiftDomain(double scalar) throws DomainNotNumbersException
Description copied from interface:IProbabilityDensityFunctionShifts the domain values of the PDF by the given scalar- Specified by:
shiftDomainin interfaceIProbabilityDensityFunction- Overrides:
shiftDomainin classAbstractContinousPDF- Returns:
- Throws:
DomainNotNumbersException
-
getVariance
public double getVariance()
- Specified by:
getVariancein interfaceIContinousPDF- Overrides:
getVariancein classAbstractContinousPDF
-
stretchDomain
public IProbabilityDensityFunction stretchDomain(double scalar)
Description copied from interface:IProbabilityDensityFunctionStretches the domain values of the PDF. This is equivalent to the multiplication of the specified random variable by the given scalar.- Specified by:
stretchDomainin interfaceIProbabilityDensityFunction- Overrides:
stretchDomainin classAbstractContinousPDF- Returns:
-
getStandardDeviation
public double getStandardDeviation()
- Specified by:
getStandardDeviationin interfaceIContinousPDF
-
getXinf
public double getXinf()
Description copied from interface:IContinousPDFReturns xb such that the probability density is 0 everywhere outside the interval [xa, xb],- Specified by:
getXinfin interfaceIContinousPDF- Returns:
- lower limit of support
-
getXsup
public double getXsup()
Description copied from interface:IContinousPDFReturns xa such that the probability density is 0 everywhere outside the interval [xa, xb]- Specified by:
getXsupin interfaceIContinousPDF- Returns:
- upper limit of support
-
getArithmeticMeanValue
public double getArithmeticMeanValue() throws DomainNotNumbersException, FunctionNotInTimeDomainExceptionDescription copied from interface:IProbabilityFunctionFor a probability function, whose domain is integer or real the arithmetic mean - the sum of all measurements divided by the number of observations in the data set - is returned.- Specified by:
getArithmeticMeanValuein interfaceIProbabilityFunction- Returns:
- The arithmetic mean.
- Throws:
DomainNotNumbersExceptionFunctionNotInTimeDomainException
-
-