to top
public class

SimpleStats

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

Class Overview

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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SimpleStats ()

Public Methods

public void add (double meas)

Add a measurement to the dataset.

Parameters
meas double

public 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

public List<Double> getData ()

Retrieve the dataset.

Returns
List<Double>

public boolean isEmpty ()

Check if the dataset is empty.

Returns
boolean

public Double max ()

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

Returns
Double

public Double mean ()

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

Returns
Double

public 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

public Double median ()

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

Returns
Double

public Double min ()

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

Returns
Double

public int size ()

Check how many elements are in the dataset.

Returns
int

public 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