Package hec.lang
Class Statistics
java.lang.Object
hec.lang.Statistics
Title: Statistics - supplies static statistical results.
Description: This includes returning the
normal standard deviate for an exceedance probability, getting Log Pearson
Type III deviates, computing
confidence limits using the incomplete beta function, as well as simple
utilities such as ordering an array of numbers and computing the mean
and standard deviation of a series of numbers.
Company:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static double
betacf
(double a, double b, double pn) This is the continued fraction portion of the incomplete beta function evaluation routine as described in "Numerical Recipes (fortran) " by W.protected static double
betai
(double a, double b, double pn) Computes the incomplete beta function routine as described in "Numerical Recipes (fortran) " by W.protected static int
btclmt
(int nsyst, double pe, double[] pc) Compute confidence limits for a given exceedance probability given an ordered set derived from observations of an idependent random variable pc is computed to be the probability tha the quantile (discharge) associated with exceedance probability exceeds a given value Convert exceedance probability to non-exceedance pe is the exceedance probability associated with a quantile xestatic int
computeConfidenceLimits
(int nyr, double probFlow, double[] probFlowExceeds) Computes confidence limits for a given exceedance probability given an ordered set derived from observations of an idependent random variable.static int
computeCurveMoments
(int nuOrds, double[] prob, double[] flow, double[] results) Calculates the mean and standard deviation for the specified frequency curve by approximating the integral definition.protected static double
gammln
(double y) Computes the natural of the gamma function routine as described in "Numerical Recipes (fortran) " by W H Press, Brian P Flannery, Saul A Teukolsky, W T Vetterling, cambridge press, 1989, pg 166.static double
getLP3Deviate
(double stdNormDev, double skew) Return the Log Pearson Type III deviate for the input standard normal deviate and skew.static double
getNormalStandardDeviate
(double lp3Dev, double skew) Return the Standard Normal deviate for the input Log Pearson Type III deviate and skew.static double
getNormalStdDeviate
(double prob) getNormalStdDeviate returns the normal standard deviate for an input probability.static boolean
isMonotonicallyDecreasing
(int nval, double[] x) Returns boolean indicating if x array is monotonically decreasing.static boolean
isMonotonicallyIncreasing
(int nval, double[] x) Returns boolean indicating if x array is monotonically increasing.static void
static boolean
orderArray
(int nval, char direction, double[] x, double[] y) Orders a paired array so that thex
array is monotonically increasing or decreasing.static void
printResult
(String s, double devIn, double devOut) Print Current Deviate Valuesstatic double
roundIt2
(float sp, int nsig) Rounds single precision floating point number to nsig digits and stores in double.static double
roundIt3
(float sp, int nsig) Rounds single precision floating point number to nsig digits and stores in double.static double
roundRealToDouble
(float sp) Rounds single precision floating point number to 7 digits and stores in doublestatic double
roundRealToDouble
(float sp, int numSignificantDigits) Rounds single precision floating point number and stores in doubleprotected static int
search
(int medpos, int npt, double[] sd, int[] compPos, int[] ipos) Finds the minimum in the exceedance probability Uncertainty relationship
-
Constructor Details
-
Statistics
public Statistics()
-
-
Method Details
-
getNormalStdDeviate
public static double getNormalStdDeviate(double prob) getNormalStdDeviate returns the normal standard deviate for an input probability.prob
is exceedance probability between 0 and 1; -
orderArray
public static boolean orderArray(int nval, char direction, double[] x, double[] y) Orders a paired array so that thex
array is monotonically increasing or decreasing.nval
Number of ordinates (rows) in the paired array.direction
Direction that the x array is ordered: d or D Array will decrease. i or I Array will increase.x
Array that will be ordered.y
Array whose ordiantes correspond to the x array. -
isMonotonicallyDecreasing
public static boolean isMonotonicallyDecreasing(int nval, double[] x) Returns boolean indicating if x array is monotonically decreasing. -
isMonotonicallyIncreasing
public static boolean isMonotonicallyIncreasing(int nval, double[] x) Returns boolean indicating if x array is monotonically increasing. -
computeCurveMoments
public static int computeCurveMoments(int nuOrds, double[] prob, double[] flow, double[] results) Calculates the mean and standard deviation for the specified frequency curve by approximating the integral definition.results
is an array of 2 that returns the (1) mean, (2) standard deviation. -
computeConfidenceLimits
public static int computeConfidenceLimits(int nyr, double probFlow, double[] probFlowExceeds) Computes confidence limits for a given exceedance probability given an ordered set derived from observations of an idependent random variable. probFlowExceeds is computed to be the probability that the quantile (discharge) associated with exceedance probability exceed a given value Convert exeedance probability to non-exceedance probFlow is the exceedance probabibility associated with a quantile flow the array is ordered from smallest to largest betai returns the probability that the ith ordered variable is less than the quantile flow associated with non-exeedance probability pn in other words betai returns the probability that the quantile xe exceeds the ith ordered statistic -
betai
protected static double betai(double a, double b, double pn) Computes the incomplete beta function routine as described in "Numerical Recipes (fortran) " by W. H. Press, Brian P. Flannery, Saul A. Teukolsky, W. T. Vetterling, cambridge press, 1989, pg.166 -
betacf
protected static double betacf(double a, double b, double pn) This is the continued fraction portion of the incomplete beta function evaluation routine as described in "Numerical Recipes (fortran) " by W. H. Press, Brian P. Flannery, Saul A. Teukolsky, W. T. Vetterling, Cambridge press, 1989, pg.168 Continued fraction being evaluated is frac = 1/(1 + d1/(1 + d2/(1 + d3 ..... where d2m+1 = -(a+m)(a+b+m)x/((a+2m)(a+2m+1)) d2m = m(b-m)x/((a+2m-1)(a+2m)) -
btclmt
protected static int btclmt(int nsyst, double pe, double[] pc) Compute confidence limits for a given exceedance probability given an ordered set derived from observations of an idependent random variable pc is computed to be the probability tha the quantile (discharge) associated with exceedance probability exceeds a given value Convert exceedance probability to non-exceedance pe is the exceedance probability associated with a quantile xe -
gammln
protected static double gammln(double y) Computes the natural of the gamma function routine as described in "Numerical Recipes (fortran) " by W H Press, Brian P Flannery, Saul A Teukolsky, W T Vetterling, cambridge press, 1989, pg 166. The routine is based on an algorithm by Lanczos who somehow came up with a way of improving the sterling formula. Full accuracy is obtained for y > 1 for y <= 1 the reflection formula is used -
search
protected static int search(int medpos, int npt, double[] sd, int[] compPos, int[] ipos) Finds the minimum in the exceedance probability Uncertainty relationship -
getLP3Deviate
public static double getLP3Deviate(double stdNormDev, double skew) Return the Log Pearson Type III deviate for the input standard normal deviate and skew. -
getNormalStandardDeviate
public static double getNormalStandardDeviate(double lp3Dev, double skew) Return the Standard Normal deviate for the input Log Pearson Type III deviate and skew. -
printResult
Print Current Deviate Values -
roundRealToDouble
public static double roundRealToDouble(float sp, int numSignificantDigits) Rounds single precision floating point number and stores in double- Parameters:
sp
- Single Precision NumbernumSignificantDigits
- Integer Number- Returns:
- Double precision number
-
roundRealToDouble
public static double roundRealToDouble(float sp) Rounds single precision floating point number to 7 digits and stores in double- Parameters:
sp
- Single Precision Number- Returns:
- Double precision number
-
roundIt2
public static double roundIt2(float sp, int nsig) Rounds single precision floating point number to nsig digits and stores in double. It does it by processing characters rather than a numeric calculation.- Parameters:
sp
- Input single precision number.nsig
- Number of significant digits desired in output result.- Returns:
- RESULT contains the double value of sp rounded to nsig digits.
-
roundIt3
public static double roundIt3(float sp, int nsig) Rounds single precision floating point number to nsig digits and stores in double. It does it by processing characters rather than a numeric calculation.- Parameters:
sp
- Input single precision number.nsig
- Number of significant digits desired in output result.- Returns:
- RESULT contains the double value of sp rounded to nsig digits.
-
main
-