Package jsl.utilities.distributions
Class Weibull
- java.lang.Object
-
- jsl.utilities.distributions.Distribution
-
- jsl.utilities.distributions.Weibull
-
- All Implemented Interfaces:
ControllableIfc,CDFIfc,ContinuousDistributionIfc,DistributionFunctionIfc,DistributionIfc,DomainIfc,InverseCDFIfc,MeanIfc,PDFIfc,VarianceIfc,GetNameIfc,IdentityIfc,NewInstanceIfc,ParametersIfc,GetRVariableIfc
public class Weibull extends Distribution implements ContinuousDistributionIfc, InverseCDFIfc, GetRVariableIfc
This class defines a Weibull distribution
-
-
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 Weibull()Creates new weibull with shape 1.0, scale 1.0Weibull(double[] parameters)Constructs a weibull distribution with shape = parameters[0] and scale = parameters[1]Weibull(double shape, double scale)Constructs a weibull distribution with supplied shape and scaleWeibull(double shape, double scale, java.lang.String name)Constructs a weibull distribution with supplied shape and scale
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecdf(double x)Returns the F(x) = Pr{X <= x} where F represents the cumulative distribution functionIntervalgetDomain()doublegetMean()Returns the mean or expected value of a distributiondoublegetMoment3()doublegetMoment4()double[]getParameters()Gets the parameters for the distributionRVariableIfcgetRandomVariable(RNStreamIfc rng)doublegetScale()Gets the scale parameterdoublegetShape()Gets the shapedoublegetVariance()Returns the variance of the distribution if defineddoubleinvCDF(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.doublekurtosis()Gets the kurtosis of the distribution www.mathworld.wolfram.com/WeibullDistribution.htmlWeibullnewInstance()Returns a new instancedoublepdf(double x)Returns the f(x) where f represents the probability density function for the distribution.voidsetParameters(double[] parameters)Sets the parameters for the distribution with shape = parameters[0] and scale = parameters[1]voidsetParameters(double shape, double scale)Sets the parametersvoidsetScale(double scale)Sets the scale parametervoidsetShape(double shape)Sets the shape parameterdoubleskewness()Gets the skewness of the distribution www.mathworld.wolfram.com/WeibullDistribution.html-
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
-
Weibull
public Weibull()
Creates new weibull with shape 1.0, scale 1.0
-
Weibull
public Weibull(double[] parameters)
Constructs a weibull distribution with shape = parameters[0] and scale = parameters[1]- Parameters:
parameters- An array with the shape and scale
-
Weibull
public Weibull(double shape, double scale)Constructs a weibull distribution with supplied shape and scale- Parameters:
shape- The shape parameter of the distributionscale- The scale parameter of the distribution
-
Weibull
public Weibull(double shape, double scale, java.lang.String name)Constructs a weibull distribution with supplied shape and scale- Parameters:
shape- The shape parameter of the distributionscale- The scale parameter of the distributionname- an optional name/label
-
-
Method Detail
-
newInstance
public final Weibull newInstance()
Description copied from interface:NewInstanceIfcReturns a new instance- Specified by:
newInstancein interfaceNewInstanceIfc- Specified by:
newInstancein classDistribution- Returns:
- the new instance
-
setParameters
public final void setParameters(double shape, double scale)Sets the parameters- Parameters:
shape- The shape parameter must > 0.0scale- The scale parameter must be > 0.0
-
setParameters
public final void setParameters(double[] parameters)
Sets the parameters for the distribution with shape = parameters[0] and scale = parameters[1]- Specified by:
setParametersin 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:
getParametersin interfaceParametersIfc- Returns:
- Returns an array of the parameters for the distribution
-
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
-
getMean
public final double getMean()
Description copied from interface:MeanIfcReturns the mean or expected value of a distribution
-
getVariance
public final double getVariance()
Description copied from interface:VarianceIfcReturns the variance of the distribution if defined- Specified by:
getVariancein interfaceVarianceIfc- Returns:
- double the variance of the random variable
-
cdf
public final double cdf(double x)
Description copied from interface:CDFIfcReturns the F(x) = Pr{X <= x} where F represents the cumulative distribution function
-
pdf
public final double pdf(double x)
Description copied from interface:PDFIfcReturns the f(x) where f represents the probability density function for the distribution. Note this is not a probability.
-
invCDF
public final double invCDF(double p)
Description copied from interface:InverseCDFIfcProvides 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:
invCDFin 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
-
getMoment3
public final double getMoment3()
- Returns:
- the 3rd moment
-
getMoment4
public final double getMoment4()
- Returns:
- the 4th moment
-
kurtosis
public final double kurtosis()
Gets the kurtosis of the distribution www.mathworld.wolfram.com/WeibullDistribution.html- Returns:
- the kurtosis
-
skewness
public final double skewness()
Gets the skewness of the distribution www.mathworld.wolfram.com/WeibullDistribution.html- Returns:
- the skewness
-
getRandomVariable
public final RVariableIfc getRandomVariable(RNStreamIfc rng)
- Specified by:
getRandomVariablein interfaceGetRVariableIfc- Overrides:
getRandomVariablein classDistribution- Parameters:
rng- the stream to use- Returns:
- a random variable
-
-