org.opensha.commons.data.estimate
Class DiscreteValueEstimate

java.lang.Object
  extended by org.opensha.commons.data.estimate.Estimate
      extended by org.opensha.commons.data.estimate.DiscretizedFuncEstimate
          extended by org.opensha.commons.data.estimate.DiscreteValueEstimate
Direct Known Subclasses:
IntegerEstimate

public class DiscreteValueEstimate
extends DiscretizedFuncEstimate

Title: DiscreteValueEstimate.java

Description: This can be used to specify probabilities associated with discrete values from an ArbitrarilyDiscretizedFunction.

Copyright: Copyright (c) 2002

Company:

Version:
1.0
Author:
not attributable

Field Summary
static String NAME
           
 
Fields inherited from class org.opensha.commons.data.estimate.DiscretizedFuncEstimate
cumDistFunc, func, tol
 
Fields inherited from class org.opensha.commons.data.estimate.Estimate
comments, EST_MSG_FIRST_LAST_PROB_ZERO, EST_MSG_INVLID_RANGE, EST_MSG_MAX_LT_MIN, EST_MSG_NOT_NORMALIZED, EST_MSG_PROB_POSITIVE, EST_MSG_PROBS_NOT_INCREASING, FRACTILE_UNDEFINED, max, MEDIAN_UNDEFINED, min, MSG_ALL_PROB_ZERO, MSG_INVALID_STDDEV, units
 
Constructor Summary
DiscreteValueEstimate(ArbitrarilyDiscretizedFunc func, boolean isNormalized)
          Constructor - Accepts a ArbitrarilyDiscretizedFunc and an indication of whether it is normalized.
 
Method Summary
 AbstractDiscretizedFunc getCDF_Test()
          Get the cumulative distribution function
 String getName()
          Return the name of the estimate.
 AbstractDiscretizedFunc getPDF_Test()
          Return the discrete fractile for this probability value.
 double getProbLessThanEqual(double x)
          Get the probability for that the true value is less than or equal to provided x value
 double getRandomValue()
          It returns a random value from this estimate.
 
Methods inherited from class org.opensha.commons.data.estimate.DiscretizedFuncEstimate
getDiscreteFractile, getFractile, getFunc, getMean, getMedian, getMode, getStdDev, getValues, isMultiModal, setTolerance, setValues, toString
 
Methods inherited from class org.opensha.commons.data.estimate.Estimate
getCDF_TestUsingFractile, getComments, getMax, getMin, getUnits, isNegativeValuePresent, setComments, setUnits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values
Constructor Detail

DiscreteValueEstimate

public DiscreteValueEstimate(ArbitrarilyDiscretizedFunc func,
                             boolean isNormalized)
Constructor - Accepts a ArbitrarilyDiscretizedFunc and an indication of whether it is normalized. Note that the function passed in is cloned. min and max are set according to those of the function passed in.

Parameters:
func -
Method Detail

getName

public String getName()
Return the name of the estimate. This is the name visible to the user

Specified by:
getName in class Estimate
Returns:

getCDF_Test

public AbstractDiscretizedFunc getCDF_Test()
Get the cumulative distribution function

Overrides:
getCDF_Test in class Estimate
Returns:

getProbLessThanEqual

public double getProbLessThanEqual(double x)
Get the probability for that the true value is less than or equal to provided x value

Overrides:
getProbLessThanEqual in class Estimate
Parameters:
x -
Returns:

getPDF_Test

public AbstractDiscretizedFunc getPDF_Test()
Return the discrete fractile for this probability value.

Overrides:
getPDF_Test in class Estimate
Parameters:
prob - Probability for which fractile is desired
Returns:

getRandomValue

public double getRandomValue()
It returns a random value from this estimate. It generates a random number from 0 to 1 using Math.random() function. Then it checks the Cum Dist Func and returns the first value where prob>=randomVal

Returns: