Package jsl.utilities.distributions
Class Distribution
- java.lang.Object
- 
- jsl.utilities.distributions.Distribution
 
- 
- All Implemented Interfaces:
- ControllableIfc,- CDFIfc,- DistributionFunctionIfc,- DistributionIfc,- InverseCDFIfc,- MeanIfc,- VarianceIfc,- GetNameIfc,- IdentityIfc,- NewInstanceIfc,- ParametersIfc,- GetRVariableIfc
 - Direct Known Subclasses:
- Bernoulli,- Beta,- Binomial,- Constant,- DEmpiricalCDF,- DUniform,- Exponential,- Gamma,- Geometric,- LogLogistic,- Lognormal,- MTP,- NegativeBinomial,- Normal,- PearsonType5,- PearsonType6,- Poisson,- ShiftedDistribution,- ShiftedGeometric,- StudentT,- Triangular,- TruncatedDistribution,- Uniform,- Weibull
 
 public abstract class Distribution extends java.lang.Object implements DistributionIfc, ControllableIfc, NewInstanceIfc An Distribution provides a skeletal implementation for classes that must implement the DistributionIfc. This class is an abstract class. Subclasses must provide concrete implementations.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classDistribution.RandomControls
 - 
Constructor SummaryConstructors Constructor Description Distribution()Constructs a probability distributionDistribution(java.lang.String name)Constructs a probability distribution
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ControlsgetControls()Returns a valid instance of Controls that can be used with this ControllableIfc or nullintgetId()java.lang.StringgetName()RVariableIfcgetRandomVariable(RNStreamIfc rng)doublegetStandardDeviation()Returns the standard deviation for the probability distribution as the square root of the variance if it existsstatic doubleinverseContinuousCDFViaBisection(ContinuousDistributionIfc cdf, double p, double ll, double ul)Computes the inverse CDF by using the bisection method [ll,ul] must contain the desired value.static doubleinverseContinuousCDFViaBisection(ContinuousDistributionIfc cdf, double p, double ll, double ul, double initialX)Computes the inverse CDF by using the bisection method [ll,ul] must contain the desired value [ll, ul] are defined on the domain of the CDF, i.e.static doubleinverseDiscreteCDFViaSearchUp(DiscreteDistributionIfc df, double p, int start)Searches starting at the value start until the CDF > p "start" must be the smallest possible value for the range of the CDF as an integer.abstract DistributionnewInstance()Returns a new instancevoidsetControls(Controls controls)Takes in a valid instance of Controls for this class If controls is null or if it was not created by this class this method should throw an IllegalArgumentExceptionprotected voidsetId()voidsetName(java.lang.String str)Sets the namejava.lang.StringtoString()- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface jsl.utilities.distributions.CDFIfccdf, cdf, complementaryCDF
 - 
Methods inherited from interface jsl.utilities.random.rvariable.GetRVariableIfcgetRandomVariable, getRandomVariable
 - 
Methods inherited from interface jsl.utilities.distributions.InverseCDFIfcinvCDF
 - 
Methods inherited from interface jsl.utilities.random.ParametersIfcgetParameters, setParameters
 - 
Methods inherited from interface jsl.utilities.distributions.VarianceIfcgetVariance
 
- 
 
- 
- 
- 
Method Detail- 
getNamepublic final java.lang.String getName() - Specified by:
- getNamein interface- GetNameIfc
- Returns:
- the assigned name
 
 - 
setNamepublic final void setName(java.lang.String str) Sets the name- Parameters:
- str- The name as a string.
 
 - 
getIdpublic final int getId() - Specified by:
- getIdin interface- IdentityIfc
- Returns:
- a number identifier
 
 - 
setIdprotected final void setId() 
 - 
getControlspublic Controls getControls() Description copied from interface:ControllableIfcReturns a valid instance of Controls that can be used with this ControllableIfc or null- Specified by:
- getControlsin interface- ControllableIfc
- Returns:
 
 - 
setControlspublic void setControls(Controls controls) Description copied from interface:ControllableIfcTakes in a valid instance of Controls for this class If controls is null or if it was not created by this class this method should throw an IllegalArgumentException- Specified by:
- setControlsin interface- ControllableIfc
 
 - 
getStandardDeviationpublic final double getStandardDeviation() Description copied from interface:VarianceIfcReturns the standard deviation for the probability distribution as the square root of the variance if it exists- Specified by:
- getStandardDeviationin interface- VarianceIfc
- Returns:
- sqrt(getVariance())
 
 - 
newInstancepublic abstract Distribution newInstance() Description copied from interface:NewInstanceIfcReturns a new instance- Specified by:
- newInstancein interface- NewInstanceIfc
- Returns:
- the new instance
 
 - 
getRandomVariablepublic RVariableIfc getRandomVariable(RNStreamIfc rng) - Specified by:
- getRandomVariablein interface- GetRVariableIfc
- Parameters:
- rng- the stream to use
- Returns:
- a random variable
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
inverseContinuousCDFViaBisectionpublic static double inverseContinuousCDFViaBisection(ContinuousDistributionIfc cdf, double p, double ll, double ul) Computes the inverse CDF by using the bisection method [ll,ul] must contain the desired value. Initial search point is (ll+ul)/2.0 [ll, ul] are defined on the domain of the CDF, i.e. the X values- Parameters:
- cdf- a reference to the cdf
- p- must be in [0,1]
- ll- lower limit of search range, must be < ul
- ul- upper limit of search range, must be > ll
- Returns:
- the inverse of the CDF evaluated at p
 
 - 
inverseContinuousCDFViaBisectionpublic static double inverseContinuousCDFViaBisection(ContinuousDistributionIfc cdf, double p, double ll, double ul, double initialX) Computes the inverse CDF by using the bisection method [ll,ul] must contain the desired value [ll, ul] are defined on the domain of the CDF, i.e. the x values- Parameters:
- cdf- a reference to the cdf
- p- must be in [0,1]
- ll- lower limit of search range, must be < ul
- ul- upper limit of search range, must be > ll
- initialX- an initial starting point that must be in [ll,ul]
- Returns:
- the inverse of the CDF evaluated at p
 
 - 
inverseDiscreteCDFViaSearchUppublic static double inverseDiscreteCDFViaSearchUp(DiscreteDistributionIfc df, double p, int start) Searches starting at the value start until the CDF > p "start" must be the smallest possible value for the range of the CDF as an integer. This requirement is NOT checked Each value is incremented by 1. Thus, the range of possible values for the CDF is assumed to be {start, start + 1, start + 2, etc.}- Parameters:
- df- a reference to the discrete distribution
- p- the probability to evaluate, must be (0,1)
- start- the initial starting search position
- Returns:
- the found inverse of the CDF found for p
 
 
- 
 
-