|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.stats.descriptive.moment.Moments
public class Moments
Compute the central moment of a data set incrementally.
The n-th moment is the expected value of the n-th power of the differences from the mean.
μk = E[(X - E(X))k]
This implementation uses Pébay's update formula to incrementally compute the new statistic.
| Field Summary | |
|---|---|
int |
order
the highest moment to compute |
| Constructor Summary | |
|---|---|
Moments(int order)
Construct an instance to compute all moments up to the order-th moment. |
|
Moments(int order,
double... data)
Construct an instance to compute all moments up to the order-th moment,
initialized with a sample. |
|
Moments(Moments that)
Copy constructor. |
|
| Method Summary | |
|---|---|
void |
addData(double... data)
Recompute the statistic, incrementally if possible. |
double |
centralMoment(int k)
Get the value of the k-th central moment. |
long |
N()
Get the size of the sample. |
java.lang.String |
toString()
|
double |
value()
Get the value of the statistic. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final int order
| Constructor Detail |
|---|
public Moments(int order)
order-th moment.
order - the number of the highest moment
public Moments(int order,
double... data)
order-th moment,
initialized with a sample.
order - the number of the highest momentdata - a samplepublic Moments(Moments that)
that - another Moments object| Method Detail |
|---|
public void addData(double... data)
Statistic
addData in interface Statisticdata - an array of new itemspublic double value()
Statistic
value in interface Statisticpublic long N()
Statistic
N in interface Statisticpublic double centralMoment(int k)
k-th central moment.
This method can be used to compute the lower moments.
For example,
centralMoment(1) is the mean.
For higher central moments, they do not correspond to variance, skew, kurtosis, etc.
k - the order of the moment
k-th central momentpublic java.lang.String toString()
toString in class java.lang.Object
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||