Package com.imsl.stat
Class GammaDistribution
java.lang.Object
com.imsl.stat.GammaDistribution
- All Implemented Interfaces:
Distribution,ProbabilityDistribution,Serializable
Evaluates a gamma probability density for a given set of data.
GammaDistribution evaluates the gamma density of a given
set of data, xData. If parameters are not supplied, the
Eval method fits the gamma probability density function to
the data by first calculating the shape and scale parameters using an MLE
technique for a best fit. The gamma probability density function is defined
as:
$$ f(x)= {x}^{a-1}\frac{e^{-\frac{x}{b}}} {b^a \Gamma(a)} \mbox{,}\,\,\,x \gt 0 \,\mbox{,}\,\,a \gt 0 \,\,\,\mbox{and}\,\,\, b \gt 0 \,\,\mbox{,}
$$ where a and b are the scale and shape parameters.
The DataMining package class NaiveBayesClassifier
uses GammaDistribution as a method to train continuous data.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]eval(double[] xData) Fits a gamma probability distribution toxDataand returns the probability density at each value.double[]Evaluates a gamma probability distribution with a given set of parameters at each point inxDataand returns the probability density at each value.doubleEvaluates a gamma probability density at a given pointxData.Object[]Returns the current parameters of the gamma probability density function.doubleReturns the maximum-likelihood estimate found for the gamma scale parameter.doubleReturns the maximum-likelihood estimate found for the gamma shape parameter.
-
Constructor Details
-
GammaDistribution
public GammaDistribution()
-
-
Method Details
-
getShapeParameter
public double getShapeParameter()Returns the maximum-likelihood estimate found for the gamma shape parameter.- Returns:
- a
doublerepresenting the maximum-likelihood estimate found for the gamma shape parameter
-
getScaleParameter
public double getScaleParameter()Returns the maximum-likelihood estimate found for the gamma scale parameter.- Returns:
- a
doublerepresenting the maximum-likelihood estimate found for the gamma scale parameter
-
eval
public double[] eval(double[] xData) Fits a gamma probability distribution toxDataand returns the probability density at each value.- Specified by:
evalin interfaceDistribution- Parameters:
xData- adoublearray representing the points at which the gamma probability distribution function is to be evaluated- Returns:
- a
doublearray representing the gamma probability density at each value ofxData
-
eval
Evaluates a gamma probability distribution with a given set of parameters at each point inxDataand returns the probability density at each value.- Specified by:
evalin interfaceProbabilityDistribution- Parameters:
xData- adoublearray representing the points at which the gamma probability distribution function is to be evaluatedparameters- anObjectarray representing the parameters used to evaluate the gamma distribution, see methodgetParameters- Returns:
- a
doublearray representing the gamma probability density at each value ofxData
-
eval
Evaluates a gamma probability density at a given pointxData.- Specified by:
evalin interfaceProbabilityDistribution- Parameters:
xData- adoublerepresenting the point at which the gamma probability distribution function is to be evaluatedparameters- anObjectarray representing the parameters used to evaluate the gamma distribution, see methodgetParameters- Returns:
- a
doublerepresenting the gamma probability density atxData
-
getParameters
Returns the current parameters of the gamma probability density function.- Specified by:
getParametersin interfaceProbabilityDistribution- Returns:
- an
Objectarray containing the parameters resulting from the last invocation of the (Distribution)evalmethod with the following signature,double[] eval(double[] xData). ThisObjectarray can be used as input to theevalmethods that require anObjectarray of distribution parameters as input.
-