org.apache.poi.hssf.record.formula.functions
Class StatsLib

java.lang.Object
  extended by org.apache.poi.hssf.record.formula.functions.StatsLib

public final class StatsLib
extends java.lang.Object

Author:
Amol S. Deshmukh < amolweb at ya hoo dot com > Library for common statistics functions

Method Summary
static double avedev(double[] v)
          returns the mean of deviations from mean.
static double devsq(double[] v)
           
static double kthLargest(double[] v, int k)
          returns the kth largest element in the array.
static double kthSmallest(double[] v, int k)
          returns the kth smallest element in the array.
static double median(double[] v)
           
static double mode(double[] v)
          if v is zero length or contains no duplicates, return value is Double.NaN.
static double stdev(double[] v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

avedev

public static double avedev(double[] v)
returns the mean of deviations from mean.

Parameters:
v -

stdev

public static double stdev(double[] v)

mode

public static double mode(double[] v)
if v is zero length or contains no duplicates, return value is Double.NaN. Else returns the value that occurs most times and if there is a tie, returns the first such value.

Parameters:
v -

median

public static double median(double[] v)

devsq

public static double devsq(double[] v)

kthLargest

public static double kthLargest(double[] v,
                                int k)
returns the kth largest element in the array. Duplicates are considered as distinct values. Hence, eg. for array {1,2,4,3,3} & k=2, returned value is 3.
k <= 0 & k >= v.length and null or empty arrays will result in return value Double.NaN

Parameters:
v -
k -

kthSmallest

public static double kthSmallest(double[] v,
                                 int k)
returns the kth smallest element in the array. Duplicates are considered as distinct values. Hence, eg. for array {1,1,2,4,3,3} & k=2, returned value is 1.
k <= 0 & k >= v.length or null array or empty array will result in return value Double.NaN

Parameters:
v -
k -


Copyright 2008 The Apache Software Foundation or its licensors, as applicable.