Package com.imsl.stat.distributions
Class DiscreteUniformPD
java.lang.Object
com.imsl.stat.distributions.ProbabilityDistribution
com.imsl.stat.distributions.DiscreteUniformPD
- All Implemented Interfaces:
ClosedFormMaximumLikelihoodInterface,PDFGradientInterface,PDFHessianInterface,Serializable,Cloneable
public class DiscreteUniformPD
extends ProbabilityDistribution
implements Serializable, Cloneable, PDFHessianInterface, ClosedFormMaximumLikelihoodInterface
The discrete uniform probability distribution.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for the discrete uniform probability distribution. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]getClosedFormMLE(double[] x) Returns the maximum likelihood estimate for the parameter.double[]getClosedFormMlStandardError(double[] x) Returns the standard error of the maximum likelihood estimate.double[]Returns the lower bound of the parameter.double[]Returns the upper bound of the parameter.double[]getPDFGradient(double x, double... params) Returns the analytic gradient of the pdf evaluated atx.double[][]getPDFHessian(double x, double... params) Returns the analytic Hessian matrix evaluated atx.doublepdf(double x, double... params) Evaluates the discrete uniform probability density function.Methods inherited from class com.imsl.stat.distributions.ProbabilityDistribution
getNumberOfParameters, getPDFGradientApproximation, getPDFHessianApproximation, getRangeOfX, setRangeOfX
-
Constructor Details
-
DiscreteUniformPD
public DiscreteUniformPD()Constructor for the discrete uniform probability distribution.
-
-
Method Details
-
getParameterLowerBounds
public double[] getParameterLowerBounds()Returns the lower bound of the parameter.- Specified by:
getParameterLowerBoundsin classProbabilityDistribution- Returns:
- a
doublearray of length 1 containing the lower bound (1)
-
getParameterUpperBounds
public double[] getParameterUpperBounds()Returns the upper bound of the parameter.- Specified by:
getParameterUpperBoundsin classProbabilityDistribution- Returns:
- a
doublearray of length 1 containing the upper bound
-
pdf
public double pdf(double x, double... params) Evaluates the discrete uniform probability density function.The discrete uniform probability distribution with scale parameter \(n\) is defined as $$f(x;n) = \frac{1}{n}, \quad x=1,\ldots n$$
- Specified by:
pdfin classProbabilityDistribution- Parameters:
x- adouble, the value (quantile) at which to evaluate the pdf.xshould be a positive integer between the lower limit 1 and upper limitn. Ifxis not a whole number, it is type cast to an integer.params- adouble, the upper limitnof the discrete uniform distribution.paramsshould be a positive integer. Ifparamsis not a whole number, the type cast to integer is used instead.- Returns:
- a
double, the probability that a discrete uniform random variable takes a value equal tox
-
getPDFGradient
public double[] getPDFGradient(double x, double... params) Returns the analytic gradient of the pdf evaluated atx.- Specified by:
getPDFGradientin interfacePDFGradientInterface- Parameters:
x- adoublevalue.xmust be a positive integer. Ifxis not a whole number, the type cast to integer is used instead.params- a positivedoublespecifying the upper limit of the discrete uniform distribution.paramsshould be positive integer. Ifparamsis not a whole number, the type cast to integer is used instead.- Returns:
- a
doublearray containing the first partial derivative of the parameter
-
getPDFHessian
public double[][] getPDFHessian(double x, double... params) Returns the analytic Hessian matrix evaluated atx.- Specified by:
getPDFHessianin interfacePDFHessianInterface- Parameters:
x- adoublevalue.xmust be a positive integer. Ifxis not a whole number, the type cast to integer is used instead.params- adoublespecifying the upper limit of the discrete uniform distribution.paramsshould be positive.- Returns:
- a
doublematrix containing the second derivative of the parameter
-
getClosedFormMLE
public double[] getClosedFormMLE(double[] x) Returns the maximum likelihood estimate for the parameter.- Specified by:
getClosedFormMLEin interfaceClosedFormMaximumLikelihoodInterface- Parameters:
x- adoublearray containing the data- Returns:
- a
doublearray containing the maximum likelihood estimate for the upper limit of the discrete uniform distribution
-
getClosedFormMlStandardError
public double[] getClosedFormMlStandardError(double[] x) Returns the standard error of the maximum likelihood estimate.- Specified by:
getClosedFormMlStandardErrorin interfaceClosedFormMaximumLikelihoodInterface- Parameters:
x- adoublearray containing the data- Returns:
- a
doublearray containing the standard error
-