package stats
Statistical functions
- quantile computation
Overview
The main functions in this package are used as follows
import scala.util.Random val computeQuantilesEvery10 = computeQuantiles(Seq(10,20,30,40,50,60,70,80,90))_ // partial evaluation (currying) val q = computeQuantilesEvery10(Seq.fill(123)(Random.nextDouble))
- Alphabetic
- By Inheritance
- stats
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
BoxPlot[T](mean: Double, median: Double, lowerQuartile: T, upperQuartile: T, lowerWhisker: Double, upperWhisker: Double, outliers: Seq[T]) extends Product with Serializable
Container for the results from the boxplot computation.
Container for the results from the boxplot computation.
The whiskers are computed as in the pfgplots package (https://ctan.org/pkg/pgfplots?lang=en).
- T
type of data
- mean
mean of the data
- median
median of the data
- lowerQuartile
upper quartile
- upperQuartile
lower quartile
- lowerWhisker
lower whisker
- upperWhisker
upper whisker
- outliers
collection of outliers
-
implicit
class
ComputeQuantiles[T] extends AnyRef
- T
must be Numeric
- implicit class ComputeStats[T] extends AnyRef
-
case class
Quantile[T](quantile: Double, value: T, sampleSize: Int)(implicit evidence$1: Numeric[T]) extends Product with Serializable
Stores a single quantile of a Seq.
Stores a single quantile of a Seq. Data type for computeQuantile function
- quantile
define the quantile
- value
the value at that quantile
- sampleSize
the size of the data on which the quantile is calculated
-
case class
Quantiles[T](quantiles: Seq[Double], values: Seq[T], sampleSize: Int)(implicit evidence$2: Numeric[T]) extends Product with Serializable
Storing multiple quantiles of the same Seq.
Storing multiple quantiles of the same Seq. Data type for computeQuantiles function
- quantiles
defining the quantiles
- values
the values of the quantiles
- sampleSize
the size of the input Seq
-
case class
Stats[T](size: Int, mean: Double, variance: Double, median: Double, min: T, max: T)(implicit evidence$3: Numeric[T]) extends Product with Serializable
Results from the statistics computation.
Results from the statistics computation.
- T
type of the data
- size
size of the data
- mean
mean of the data
- variance
variance of the data
- median
median of the data
- min
minimum value of the data
- max
maximum value of the data
Value Members
-
def
computeBoxPlotData[T](data: Seq[T])(implicit arg0: Numeric[T]): BoxPlot[T]
Computes the data for plotting a box plot.
Computes the data for plotting a box plot. The input is a Seq of Numeric type. The output is a BoxPlot object containing the results.
The whiskers are defined in the pgfplots manual in the section about boxplots (https://ctan.org/pkg/pgfplots?lang=en).
- data
Seq of numeric type to compute the boxplot data for.
- returns
BoxPlot object
-
def
computeQuantile[T](q: Double)(data: Seq[T])(implicit arg0: Numeric[T]): Quantile[T]
Computes a specific quantile of the data
Computes a specific quantile of the data
- q
where the quantile should be computed
- data
the data
- returns
a Quantile object
-
def
computeQuantiles[T](q: Seq[Double])(data: Seq[T])(implicit arg0: Numeric[T]): Quantiles[T]
Returns a Quantiles object with the values of the quantiles
Returns a Quantiles object with the values of the quantiles
- q
the set of quantiles to use
- data
the data
- returns
a Quantiles object
-
def
stats[T](v: Iterable[T])(implicit arg0: Numeric[T]): (Int, Double, Double, Double, T, T)
Computes basic statistics of a collection of numeric type.
Computes basic statistics of a collection of numeric type. The statistics are the following: mean, variance, median, max, min.
- T
numeric type
- v
collection of numeric type
- returns
(size, mean, var, median, min, max)