javanpst.distributions.common.discrete
Class GeometricDistribution
- java.lang.Object
-
- javanpst.distributions.common.discrete.GeometricDistribution
-
- All Implemented Interfaces:
- Distribution
public final class GeometricDistribution extends java.lang.Object implements Distribution
A geometric distribution, with parameter P
-
-
Constructor Summary
Constructors Constructor and Description GeometricDistribution()Default builder.GeometricDistribution(double p)Builder.GeometricDistribution(GeometricDistribution old)Copy constructor Creates a copy of a given geometric distribution
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecomputeCumulativeProbability(double value)Computes cumulative probability at a given point of the geometric distribution.doublecomputeProbability(double value)Computes mass probability at a given point of the geometric distribution.doublegetP()Gets the P parameter valuevoidsetP(double value)Sets the P parameter.java.lang.StringtoString()To String method.
-
-
-
Constructor Detail
-
GeometricDistribution
public GeometricDistribution()
Default builder. Creates a geometric distribution with parameter P=0.0
-
GeometricDistribution
public GeometricDistribution(double p)
Builder. Creates a geometric distribution with parameter P- Parameters:
p- P parameter
-
GeometricDistribution
public GeometricDistribution(GeometricDistribution old)
Copy constructor Creates a copy of a given geometric distribution- Parameters:
old- geometric distribution to copy
-
-
Method Detail
-
setP
public void setP(double value)
Sets the P parameter. Only works if P is in [0.0,1.0]- Parameters:
value- P parameter value
-
getP
public double getP()
Gets the P parameter value- Returns:
- value of P
-
computeProbability
public double computeProbability(double value)
Computes mass probability at a given point of the geometric distribution. Value given is converted to integer before computing probability.- Specified by:
computeProbabilityin interfaceDistribution- Parameters:
value- point selected- Returns:
- mass probability at 'value'
-
computeCumulativeProbability
public double computeCumulativeProbability(double value)
Computes cumulative probability at a given point of the geometric distribution. Value given is converted to integer before computing probability.- Specified by:
computeCumulativeProbabilityin interfaceDistribution- Parameters:
value- point selected- Returns:
- cumulative probability at 'value'
-
toString
public java.lang.String toString()
To String method.- Overrides:
toStringin classjava.lang.Object- Returns:
- string representation of the distribution
-
-
DMelt 3.0 © DataMelt by jWork.ORG