The following recursive updating formula is used:
Let
SecondMoment new value = old value - 3 * (dev/n) * m2 + (n-1) * (n -2) * (dev^3/n^2)
Returns Double.NaN if no data values have been added and
returns 0 if there is just one value in the data set.
Note that Double.NaN may also be returned if the input includes NaN
and / or infinite values.
Note that this implementation is not synchronized. If
multiple threads access an instance of this class concurrently, and at least
one of the threads invokes the increment() or
clear() method, it must be synchronized externally.
| Modifier and Type | Field and Description |
|---|---|
| protected double | m3
third moment of values that have been added |
| protected double | nDevSq
Square of deviation of most recently added value from previous first moment, normalized by previous sample size. |
| private static final long | serialVersionUID
Hides org. |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | ThirdMoment(ThirdMoment
the original)ThirdMoment instance to copyCopy constructor, creates a new |
| m3 | back to summary |
|---|---|
| protected double m3 third moment of values that have been added | |
| nDevSq | back to summary |
|---|---|
| protected double nDevSq Square of deviation of most recently added value from previous first moment, normalized by previous sample size. Retained to prevent repeated computation in higher order moments. nDevSq = nDev * nDev. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serializable version identifier | |
| ThirdMoment | back to summary |
|---|---|
| pack-priv ThirdMoment() Create a FourthMoment instance | |
| ThirdMoment | back to summary |
|---|---|
| pack-priv ThirdMoment(ThirdMoment original) throws NullArgumentException Copy constructor, creates a new
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides org. Implements org. Doc from org. Clears the internal state of the Statistic
| |
| copy | back to summary |
|---|---|
| public ThirdMoment copy() Overrides org. Implements org. Doc from org. Returns a copy of the statistic with the same internal state.
| |
| copy | back to summary |
|---|---|
| public static void copy(ThirdMoment source, ThirdMoment dest) throws NullArgumentException Copies source to dest. Neither source nor dest can be null.
| |
| getResult | back to summary |
|---|---|
| public double getResult() Overrides org. Implements org. Doc from org. Returns the current value of the Statistic.
| |
| increment | back to summary |
|---|---|
| public void increment(final double d) Overrides org. Implements org. Doc from org. Updates the internal state of the statistic to reflect the addition of the new value.
| |