org.opensha.commons.data.estimate
Class DiscretizedFuncEstimate

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

public abstract class DiscretizedFuncEstimate
extends Estimate

Title: DiscreteValueEstimate.java

Description: This can be used to specify probabilities associated with discrete values from a DiscretizedFunction. Use an EvenlyDiscretizedFunction for a continuous PDF (where it is asssumed that the first and last values are the first and last non-zero values, respectively), or use an ArbitrarilyDiscretizedFunction if the nonzero values are not evenly discretized.

Copyright: Copyright (c) 2002

Company:

Version:
1.0
Author:
not attributable

Field Summary
protected  AbstractDiscretizedFunc cumDistFunc
           
protected  ArbDiscrEmpiricalDistFunc func
           
protected  double 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
DiscretizedFuncEstimate(AbstractDiscretizedFunc func, boolean isNormalized)
          Constructor - Accepts a DiscretizedFunc and an indication of whether it is normalized.
 
Method Summary
 double getDiscreteFractile(double prob)
          Get fractile for a given probability (the value where the CDF equals prob).
 double getFractile(double prob)
          Get fractile for a given probability (the value where the CDF equals prob).
 AbstractDiscretizedFunc getFunc()
          Get the function in which values are stored
 double getMean()
          Get mean
 double getMedian()
          Get the median which is same as fractile at probability of 0.5.
 double getMode()
          Get the mode (X value where Y is maximum).
 double getStdDev()
          Get standard deviation
 AbstractDiscretizedFunc getValues()
          get the values and corresponding probabilities from this estimate
 boolean isMultiModal()
          Whether the estimate has more than one mode
 void setTolerance(double tol)
          This allows the user to set the tolerance used for checking normalization (and perhaps other things in subclasses).
 void setValues(AbstractDiscretizedFunc newFunc, boolean isNormalized)
          As implemented, the function passed in is cloned.
 java.lang.String toString()
           
 
Methods inherited from class org.opensha.commons.data.estimate.Estimate
getCDF_Test, getCDF_TestUsingFractile, getComments, getMax, getMin, getName, getPDF_Test, getProbLessThanEqual, getUnits, isNegativeValuePresent, setComments, setUnits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

func

protected ArbDiscrEmpiricalDistFunc func

cumDistFunc

protected AbstractDiscretizedFunc cumDistFunc

tol

protected double tol
Constructor Detail

DiscretizedFuncEstimate

public DiscretizedFuncEstimate(AbstractDiscretizedFunc func,
                               boolean isNormalized)
Constructor - Accepts a DiscretizedFunc and an indication of whether it is normalized. Note that the function passed in is cloned. MaxX and MinX are set according to those of the function passed in.

Parameters:
func -
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class Estimate

setValues

public void setValues(AbstractDiscretizedFunc newFunc,
                      boolean isNormalized)
As implemented, the function passed in is cloned. Max and Min are set by those in the function passed in.

Parameters:
func -

getValues

public AbstractDiscretizedFunc getValues()
get the values and corresponding probabilities from this estimate

Returns:

getMode

public double getMode()
Get the mode (X value where Y is maximum). Returns the most cental mode value in case of multi-modal distribution Calls the getMostCentralMode() method of ArbDiscrEmpiricalDistFunc

Overrides:
getMode in class Estimate
Returns:

isMultiModal

public boolean isMultiModal()
Whether the estimate has more than one mode

Returns:

getMedian

public double getMedian()
Get the median which is same as fractile at probability of 0.5.

Overrides:
getMedian in class Estimate
Returns:

getStdDev

public double getStdDev()
Get standard deviation

Overrides:
getStdDev in class Estimate
Returns:

getMean

public double getMean()
Get mean

Overrides:
getMean in class Estimate
Returns:

setTolerance

public void setTolerance(double tol)
This allows the user to set the tolerance used for checking normalization (and perhaps other things in subclasses).

Parameters:
tol - double

getFunc

public AbstractDiscretizedFunc getFunc()
Get the function in which values are stored

Returns:

getFractile

public double getFractile(double prob)
Get fractile for a given probability (the value where the CDF equals prob). This gets the interpolated fractile. To get the discrete fractile. getDiscretFractile() funcation can be used

Overrides:
getFractile in class Estimate
Parameters:
prob -
Returns:

getDiscreteFractile

public double getDiscreteFractile(double prob)
Get fractile for a given probability (the value where the CDF equals prob). this gets the discrete fractile.

Parameters:
prob -
Returns: