public class OnLineStatistics extends Object implements Serializable, Cloneable
Constructor and Description |
---|
OnLineStatistics()
Creates a new set of statistical counts with no information
|
OnLineStatistics(double n,
double mean,
double variance,
double skew,
double kurt)
Creates a new set of statistical counts with these initial values, and can then be updated in an online fashion
|
OnLineStatistics(OnLineStatistics other)
Copy Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(double x)
Adds a data sample with unit weight to the counts.
|
void |
add(double x,
double weight)
Adds a data sample the the counts with the provided weight of influence.
|
void |
add(OnLineStatistics B)
Adds to the current statistics all the samples that were collected in
B . |
static OnLineStatistics |
add(OnLineStatistics A,
OnLineStatistics B)
Computes a new set of counts that is the sum of the counts from the given distributions.
|
OnLineStatistics |
clone() |
double |
getKurtosis() |
double |
getMax() |
double |
getMean() |
double |
getMin() |
double |
getSkewness() |
double |
getStandardDeviation() |
double |
getSumOfWeights()
Returns the sum of the weights for all data points added to the statistics.
|
double |
getVarance()
Computes the population variance
|
void |
remove(double x,
double weight)
Effectively removes a sample with the given value and weight from the total.
|
void |
remove(OnLineStatistics B)
Removes from this set of statistics the observations that where collected
in
B .NOTE: removing statistics is not as numerically stable. |
static OnLineStatistics |
remove(OnLineStatistics A,
OnLineStatistics B)
Computes a new set of statistics that is the equivalent of having removed
all observations in
B from A . |
public OnLineStatistics()
public OnLineStatistics(double n, double mean, double variance, double skew, double kurt)
n
- the total weight of all data points added. This value must be non negativemean
- the starting mean. If n is zero, this value will be ignored.variance
- the starting variance. If n is zero, this value will be ignored.skew
- the starting skewness. If n is zero, this value will be ignored.kurt
- the starting kurtosis. If n is zero, this value will be ignored.ArithmeticException
- if n is a negative numberpublic OnLineStatistics(OnLineStatistics other)
other
- the version to make a copy ofpublic void add(double x)
x
- the data value to addpublic void add(double x, double weight)
x
- the data value to addweight
- the weight to give the valueArithmeticException
- if a negative weight is givenpublic void remove(double x, double weight)
getSkewness()
and getKurtosis()
are not currently updated correctlyx
- the value of the sampleweight
- the weight of the sampleArithmeticException
- if a negative weight is givenpublic static OnLineStatistics remove(OnLineStatistics A, OnLineStatistics B)
B
from A
. getSkewness()
and getKurtosis()
will be inaccurate for many inputs. The min
and
max
can not be determined in this setting, and will not
be altered.A
- the first set of statistics, which must have a larger value for
getSumOfWeights()
than B
B
- the set of statistics to remove from A
.B
from
A
public void remove(OnLineStatistics B)
B
.getSkewness()
and getKurtosis()
will be inaccurate for many inputs. The min
and
max
can not be determined in this setting, and will not
be altered.B
- the set of statistics to removepublic static OnLineStatistics add(OnLineStatistics A, OnLineStatistics B)
getSkewness()
and
getKurtosis()
will suffer from catastrophic cancellations, and may not
be as accurate.A
- the first set of statisticsB
- the second set of statisticspublic void add(OnLineStatistics B)
B
. getSkewness()
and
getKurtosis()
will suffer from catastrophic cancellations, and may not
be as accurate.B
- the set of statistics to add to this setpublic OnLineStatistics clone()
public double getSumOfWeights()
public double getMean()
public double getVarance()
public double getStandardDeviation()
public double getSkewness()
public double getKurtosis()
public double getMin()
public double getMax()
Copyright © 2017. All rights reserved.