Package dev.nm.stat.descriptive.moment
Class Mean
- java.lang.Object
-
- dev.nm.stat.descriptive.moment.Mean
-
- All Implemented Interfaces:
Statistic
public class Mean extends Object implements Statistic
The mean of a sample is the sum of all numbers in the sample, divided by the sample size. That is,E(X) = Σ (xi) / N
This implementation supports incremental update of the statistic. The R equivalent function ismean.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddData(double... data)Recompute the statistic with more data, incrementally if possible.longN()Get the size of the sample.StringtoString()doublevalue()Get the value of the statistic.
-
-
-
Constructor Detail
-
Mean
public Mean()
Construct an emptyMeancalculator.
-
Mean
public Mean(double[] data)
Construct aMeancalculator, initialized with a sample.- Parameters:
data- a sample
-
Mean
public Mean(Mean that)
Copy constructor.- Parameters:
that- aMeancalculator
-
-
Method Detail
-
addData
public void addData(double... data)
Description copied from interface:StatisticRecompute the statistic with more data, incrementally if possible.
-
value
public double value()
Description copied from interface:StatisticGet the value of the statistic.
-
N
public long N()
Description copied from interface:StatisticGet the size of the sample.
-
-