|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.IntegerMoments
public class IntegerMoments
Moments is a stastistic package that allows calculation of sample central moments of discrete samples. They are defined as
M_k=1/n·Σ(x_i-μ)^k,where μ is the sample mean and the summing is done over all smaple values x_i. The connection to the power sums S_k=Σx_i^k is
M_k=Σ_0^n (-1)^(n-k)(n over k) 1/N(n-k+1)S_k*S_1^(n-k)Note that sample moments are not identically to population moments, for the first moments, the following similarites hold
μ=M_1 μ_2=σ²=N/(N-1)·M_2 (μ_2=population variance) μ_3=N²/[(N-1)(N-2)]·M_3 μ_4=N²[(N+1)M_4-3(N-1)M_2²]/[(N-1)(N-2)(N-3)+3N/(N-1)M_2To normalize the moments, they are devided by the k/2-th power of the sample variance (roughly the k-th power of the standard deviation).
| Nested Class Summary | |
|---|---|
static class |
IntegerMoments.FitsMoments
Grabs a fits file and displays the moments up to the order given in the optional second command line argument. |
| Field Summary | |
|---|---|
private long |
n
The number of values in the sample. |
private int |
order
The order of the moments, defined at construction. |
private static int |
ORDER
Default order number. |
private BigInteger[] |
power
The cummulated power sums. |
| Constructor Summary | |
|---|---|
IntegerMoments()
Constructs a new moments object. |
|
IntegerMoments(int k)
Constructs a new moments object. |
|
| Method Summary | |
|---|---|
void |
addValue(int xi)
Adds a raw value. |
double |
getAverage()
Returns the sample average, which is equal to the first raw moment. |
int |
getOrder()
Gets the order. |
double |
getRawMoment(int k)
Returns the k-th sample raw moment, which is 1/N times the power sum. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int ORDER
private int order
private BigInteger[] power
private long n
| Constructor Detail |
|---|
public IntegerMoments()
public IntegerMoments(int k)
| Method Detail |
|---|
public int getOrder()
public void addValue(int xi)
public double getAverage()
public double getRawMoment(int k)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||