|
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.Variance
public class Variance
The variance of a sample is the average squared deviations from the sample mean. It measures the amount of variation the sample values have.
Var(X, Y) = E[(X - E(X))2]
This implementation uses Chan's update formula to incrementally compute the new statistic.
The R equivalent function is sd.
| Field Summary | |
|---|---|
boolean |
unbiased
indicate whether the variance calculation is unbiased or not; true iff unbiased |
| Constructor Summary | |
|---|---|
Variance()
Construct an empty Variance calculator. |
|
Variance(double[] data)
Construct an unbiased Variance calculator. |
|
Variance(double[] data,
boolean unbiased)
Construct a Variance calculator, initialized with a sample. |
|
Variance(Variance that)
Copy constructor. |
|
| Method Summary | |
|---|---|
void |
addData(double... data)
Recompute the statistic, incrementally if possible. |
long |
N()
Get the size of the sample. |
double |
standardDeviation()
Get the standard deviation of the sample, which is the square root of the variance. |
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 boolean unbiased
true iff unbiased
| Constructor Detail |
|---|
public Variance()
public Variance(double[] data,
boolean unbiased)
data - a sampleunbiased - true if the variance calculation uses the unbiased formulapublic Variance(double[] data)
data - a samplepublic Variance(Variance that)
that - another Variance 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 double standardDeviation()
public long N()
Statistic
N in interface Statisticpublic 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 | |||||||