public class Moments extends Object implements Statistic
μk = E[(X - E(X))k]This implementation uses Pébay's update formula to incrementally compute the new statistic.
Constructor and Description |
---|
Moments(int order)
Construct an empty moment calculator, computing all moments up to and including the
order -th moment. |
Moments(int order,
double... data)
Construct a moment calculator, computing all moments up to and including the
order -th moment. |
Moments(Moments that)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addData(double... data)
Recompute the statistic with more data, incrementally if possible.
|
double |
centralMoment(int k)
Get the value of the k-th central moment.
|
long |
N()
Get the size of the sample.
|
static double |
sumsOfPowersOfDifferences(int power,
double mean,
double... data)
Compute the
power -th moment of an array of data with respect to a mean . |
String |
toString() |
double |
value()
Get the value of the statistic.
|
public Moments(int order)
order
-th moment.order
- the number of the highest momentpublic Moments(int order, double... data)
order
-th moment.
initialized with a sample.order
- the order of the highest momentdata
- a samplepublic Moments(Moments that)
that
- a moment calculatorpublic double centralMoment(int k)
centralMoment(1)
is the mean.
Note that higher central moments do not correspond to variance, skew, kurtosis, etc.k
- the order of the momentpublic void addData(double... data)
Statistic
public double value()
Statistic
public long N()
Statistic
public static double sumsOfPowersOfDifferences(int power, double mean, double... data)
power
-th moment of an array of data
with respect to a mean
.power
- the power to raise the difference tomean
- the reference/center of the data, e.g., 0 or the meandata
- the data arraypower
-th moment of an array of data
with respect to a mean
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.