SimpleStats

public class SimpleStats
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.SimpleStats


A small utility class that calculates a few statistical measures given a numerical dataset. The values are stored internally as Doubles.

Summary

Public constructors

SimpleStats()

Public methods

void add(double meas)

Add a measurement to the dataset.

void addAll(Collection<? extends Double> c)

Add a number of measurements to the dataset.

List<Double> getData()

Retrieve the dataset.

boolean isEmpty()

Check if the dataset is empty.

Double max()

Return the maximum value in the dataset, or null if the dataset is empty.

Double mean()

Calculate and return the mean of the dataset, or null if the dataset is empty.

Double meanOverOneStandardDeviationRange()

return the average value of the samples that are within one stdev e.g 2.55 50.3 50.4 48.5 50.1 29.8 30 46 48 49 average: 40.45, stdev: 15.54 average of the values within one stdev is: 44.67

Double median()

Calculate and return the median of the dataset, or null if the dataset is empty.

Double min()

Return the minimum value in the dataset, or null if the dataset is empty.

int size()

Check how many elements are in the dataset.

Double stdev()

Return the standard deviation of the dataset, or null if the dataset is empty.

Public constructors

SimpleStats

SimpleStats ()

Public methods

add

void add (double meas)

Add a measurement to the dataset.

Parameters
meas double

addAll

void addAll (Collection<? extends Double> c)

Add a number of measurements to the dataset.

Parameters
c Collection
Throws
NullPointerException if the collection contains any null elements

getData

List<Double> getData ()

Retrieve the dataset.

Returns
List<Double>

isEmpty

boolean isEmpty ()

Check if the dataset is empty.

Returns
boolean

max

Double max ()

Return the maximum value in the dataset, or null if the dataset is empty.

Returns
Double

mean

Double mean ()

Calculate and return the mean of the dataset, or null if the dataset is empty.

Returns
Double

meanOverOneStandardDeviationRange

Double meanOverOneStandardDeviationRange ()

return the average value of the samples that are within one stdev e.g 2.55 50.3 50.4 48.5 50.1 29.8 30 46 48 49 average: 40.45, stdev: 15.54 average of the values within one stdev is: 44.67

Returns
Double

median

Double median ()

Calculate and return the median of the dataset, or null if the dataset is empty.

Returns
Double

min

Double min ()

Return the minimum value in the dataset, or null if the dataset is empty.

Returns
Double

size

int size ()

Check how many elements are in the dataset.

Returns
int

stdev

Double stdev ()

Return the standard deviation of the dataset, or null if the dataset is empty.

Note that this method calculates the population standard deviation, not the sample standard deviation. That is, it assumes that the dataset is entirely contained in the SimpleStats instance.

Returns
Double