package stats
Statistical functions
- quantile computation
Overview
The main functions in this package are used as follows
import scala.util.Random // Computation of quantiles example val computeQuantilesEvery10 = computeQuantiles(Seq(10,20,30,40,50,60,70,80,90))_ // partial evaluation (currying) val q = computeQuantilesEvery10(Seq.fill(123)(Random.nextDouble)) // Statistics example val data = Vector(1,2,3,4,5,6,7,8,9,10)s data.statistics // thanks to the implicit class
- 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])(implicit evidence$1: Numeric[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
- class EmptyStatistics extends Statistics[Double]
Container for returning no results if the data is empty.
- 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$1: 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 Statistics[T](size: Int, mean: Double, median: Double, min: T, max: T, variance: Double)(implicit evidence$1: Numeric[T]) extends Product with Serializable
Container for the results of computing the statistics of an sequence.
Container for the results of computing the statistics of an sequence.
- T
numeric type
- size
number of values in the sample
- mean
mean of the sample
- median
median of the sample
- min
minimum
- max
maximum
- variance
variance
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](quantile: Double)(data: Seq[T])(implicit arg0: Numeric[T]): Quantile[T]
Computes a specific quantile of the data
Computes a specific quantile of the data
- quantile
where the quantile should be computed
- data
the data
- returns
a Quantile object
- def computeQuantiles[T](listQuantiles: 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
- listQuantiles
the set of quantiles to use
- data
the data
- returns
a Quantiles object
- def statistics[T](v: Iterable[T])(implicit arg0: Numeric[T]): Statistics[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)
Deprecated Value Members
- def stats[T](v: Iterable[T])(implicit arg0: Numeric[T]): (Int, Double, Double, Double, T, T)
- Annotations
- @deprecated
- Deprecated
(Since version 1.3.0) Will be removed