object stats
Miscellaneous statistics-related functions.
Note: You must import scala.math.Numeric (or just Numeric._) for these
functions to work. For example:
import Numeric._ import grizzled.math.stats._ val l = List[Double]( ... ) println(median(l))
- Alphabetic
- By Inheritance
- stats
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def arithmeticMean[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Calculates the arithmetic mean of the values of the passed-in numbers.
Calculates the arithmetic mean of the values of the passed-in numbers.
- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the arithmetic mean
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def geometricMean[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Calculates the geometric mean of the values of the passed-in numbers, namely, the n-th root of (x1 * x2 * ...
Calculates the geometric mean of the values of the passed-in numbers, namely, the n-th root of (x1 * x2 * ... * xn). Note that all numbers used in the calculation of a geometric mean must be positive.
For a discussion of when a geometric mean is more suitable than an arithmetic mean, see http://www.math.toronto.edu/mathnet/questionCorner/geomean.html.
- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the geometric mean
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def harmonicMean[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Calculates the harmonic mean of the values of the passed-in numbers, namely:
n / (1/x1 + 1/x2 + ... + 1/xn).Calculates the harmonic mean of the values of the passed-in numbers, namely:
n / (1/x1 + 1/x2 + ... + 1/xn).- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the harmonic mean
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def mean[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Synonym for
arithmeticMean.Synonym for
arithmeticMean.- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the arithmetic mean
- See also
arithmeticMean
- def median[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Calculates the median of the values of the passed-in numbers.
Calculates the median of the values of the passed-in numbers.
- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the median
- def mode[T](item: T, items: T*)(implicit arg0: Numeric[T]): List[T]
Calculates the mode (most common value(s)) of the values of the passed-in numbers.
Calculates the mode (most common value(s)) of the values of the passed-in numbers. If there are multiple common values, they're all returned.
- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
list of modal values
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def popStdDev[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Shorter synonym for
populationStandardDeviation.Shorter synonym for
populationStandardDeviation.- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the standard deviation
- def populationStandardDeviation[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Calculate the population standard deviation of the specified values.
Calculate the population standard deviation of the specified values. The population standard deviation is merely the square root of the population variance. Thus, this function is just shorthand for:
java.lang.Math.sqrt(populationVariance(items))
- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the standard deviation
- def populationVariance[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Calculate the population variance of the finite population defined by the
itemsarguments.Calculate the population variance of the finite population defined by the
itemsarguments. The population variance is defined as:1 - * SUM(i=1, N) { (x[i] - mean)^2^ } N
See:
- http://en.wikipedia.org/wiki/Variance#Population_variance_and_sample_variance - http://www.quickmba.com/stats/standard-deviation/
- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the variance
- def range[T](item: T, items: T*)(implicit arg0: Numeric[T]): T
Calculate the range of a data set.
Calculate the range of a data set. This function does a single linear pass over the data set.
- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the range
- def sampleStandardDeviation[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Calculate the sample standard deviation of the specified values.
Calculate the sample standard deviation of the specified values. The sample standard deviation is merely the square root of the sample variance. Thus, this function is just shorthand for:
java.lang.Math.sqrt(sampleVariance(items))
- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the sample standard deviation
- def sampleStdDev[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Shorter synonym for
sampleStandardDeviation.Shorter synonym for
sampleStandardDeviation.- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the sample standard deviation
- See also
populationStandardDeviation
- def sampleVariance[T](item: T, items: T*)(implicit arg0: Numeric[T]): Double
Calculate the unbiased sample variance of the finite sample defined by the
itemsarguments.Calculate the unbiased sample variance of the finite sample defined by the
itemsarguments. The sample variance is defined as:1 ----- * SUM(i=1, N) { (x[i] - sampleMean)^2^ } N - 1
See:
- http://en.wikipedia.org/wiki/Variance#Population_variance_and_sample_variance - http://www.quickmba.com/stats/standard-deviation/
- item
the first number on which to operate
- items
the remaining numbers on which to operate
- returns
the variance
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()