Package jsl.utilities.distributions
Class LogLogistic
- java.lang.Object
-
- jsl.utilities.distributions.Distribution
-
- jsl.utilities.distributions.LogLogistic
-
- All Implemented Interfaces:
ControllableIfc
,CDFIfc
,ContinuousDistributionIfc
,DistributionFunctionIfc
,DistributionIfc
,DomainIfc
,InverseCDFIfc
,MeanIfc
,PDFIfc
,VarianceIfc
,GetNameIfc
,IdentityIfc
,NewInstanceIfc
,ParametersIfc
,GetRVariableIfc
public class LogLogistic extends Distribution implements ContinuousDistributionIfc, InverseCDFIfc, GetRVariableIfc
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jsl.utilities.distributions.Distribution
Distribution.RandomControls
-
-
Field Summary
-
Fields inherited from class jsl.utilities.distributions.Distribution
myId, myName
-
-
Constructor Summary
Constructors Constructor Description LogLogistic(double[] parameters)
LogLogistic(double shape, double scale)
LogLogistic(double shape, double scale, java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
cdf(double x)
Returns the F(x) = Pr{X <= x} where F represents the cumulative distribution functionInterval
getDomain()
double
getMean()
Returns the mean or expected value of a distributiondouble[]
getParameters()
Gets the parameters for the distributionRVariableIfc
getRandomVariable(RNStreamIfc rng)
double
getScale()
Gets the scale parameterdouble
getShape()
Gets the shapedouble
getVariance()
Returns the variance of the distribution if defineddouble
invCDF(double p)
Provides the inverse cumulative distribution function for the distribution While closed form solutions for the inverse cdf may not exist, numerical search methods can be used to solve F(X) = U.static void
main(java.lang.String[] args)
LogLogistic
newInstance()
Returns a new instance of the random source with the same parameters but an independent generatordouble
pdf(double x)
Returns the f(x) where f represents the probability density function for the distribution.void
setParameters(double[] parameters)
Sets the parameters for the distribution with shape = parameters[0] and scale = parameters[1]void
setScale(double scale)
Sets the scale parametervoid
setShape(double shape)
Sets the shape parameter-
Methods inherited from class jsl.utilities.distributions.Distribution
getControls, getId, getName, getStandardDeviation, inverseContinuousCDFViaBisection, inverseContinuousCDFViaBisection, inverseDiscreteCDFViaSearchUp, setControls, setId, setName, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsl.utilities.distributions.CDFIfc
cdf, complementaryCDF
-
Methods inherited from interface jsl.utilities.random.rvariable.GetRVariableIfc
getRandomVariable, getRandomVariable
-
-
-
-
Constructor Detail
-
LogLogistic
public LogLogistic(double shape, double scale)
- Parameters:
shape
- the shape parameterscale
- the scale parameter
-
LogLogistic
public LogLogistic(double[] parameters)
- Parameters:
parameters
- the parameter array parameter[0] = shape, parameter[1] = scale
-
LogLogistic
public LogLogistic(double shape, double scale, java.lang.String name)
- Parameters:
shape
- the shape parameterscale
- the scale parametername
- an optional label/name
-
-
Method Detail
-
newInstance
public final LogLogistic newInstance()
Returns a new instance of the random source with the same parameters but an independent generator- Specified by:
newInstance
in interfaceNewInstanceIfc
- Specified by:
newInstance
in classDistribution
- Returns:
-
setShape
public final void setShape(double shape)
Sets the shape parameter- Parameters:
shape
- The shape parameter must > 0.0
-
setScale
public final void setScale(double scale)
Sets the scale parameter- Parameters:
scale
- The scale parameter must be > 0.0
-
getShape
public final double getShape()
Gets the shape- Returns:
- The shape parameter as a double
-
getScale
public final double getScale()
Gets the scale parameter- Returns:
- The scale parameter as a double
-
pdf
public final double pdf(double x)
Description copied from interface:PDFIfc
Returns the f(x) where f represents the probability density function for the distribution. Note this is not a probability.
-
cdf
public final double cdf(double x)
Description copied from interface:CDFIfc
Returns the F(x) = Pr{X <= x} where F represents the cumulative distribution function
-
getMean
public final double getMean()
Description copied from interface:MeanIfc
Returns the mean or expected value of a distribution
-
getVariance
public final double getVariance()
Description copied from interface:VarianceIfc
Returns the variance of the distribution if defined- Specified by:
getVariance
in interfaceVarianceIfc
- Returns:
- double the variance of the random variable
-
invCDF
public final double invCDF(double p)
Description copied from interface:InverseCDFIfc
Provides the inverse cumulative distribution function for the distribution While closed form solutions for the inverse cdf may not exist, numerical search methods can be used to solve F(X) = U.- Specified by:
invCDF
in interfaceInverseCDFIfc
- Parameters:
p
- The probability to be evaluated for the inverse, p must be [0,1] or an IllegalArgumentException is thrown- Returns:
- The inverse cdf evaluated at the supplied probability
-
setParameters
public final void setParameters(double[] parameters)
Sets the parameters for the distribution with shape = parameters[0] and scale = parameters[1]- Specified by:
setParameters
in interfaceParametersIfc
- Parameters:
parameters
- an array of doubles representing the parameters for the distribution
-
getParameters
public final double[] getParameters()
Gets the parameters for the distribution- Specified by:
getParameters
in interfaceParametersIfc
- Returns:
- Returns an array of the parameters for the distribution
-
getRandomVariable
public final RVariableIfc getRandomVariable(RNStreamIfc rng)
- Specified by:
getRandomVariable
in interfaceGetRVariableIfc
- Overrides:
getRandomVariable
in classDistribution
- Parameters:
rng
- the stream to use- Returns:
- a random variable
-
main
public static void main(java.lang.String[] args)
- Parameters:
args
-
-
-