Package dev.nm.stat.descriptive.moment
Class Skewness
- java.lang.Object
-
- dev.nm.stat.descriptive.moment.Skewness
-
- All Implemented Interfaces:
Statistic
public class Skewness extends Object implements Statistic
Skewness is a measure of the asymmetry of the probability distribution. A distribution may either be positively or negatively skewed. For positive skew (or right-skewed), the right tail is longer. The mass of the distribution is concentrated on the left. For negative skew (or left-skewed), the left tail is longer. The mass of the distribution is concentrated on the right. The definition is:γ = E[((X - E(X)) / σ)3]
This implementation uses Chan's update formula to incrementally compute the new statistic. The R equivalent function isskewness.- See Also:
- Wikipedia: Skewness
- Wikipedia: Algorithms for calculating variance
- "Chan, Tony F.; Golub, Gene H.; LeVeque, Randall J. (1979), "Updating Formulae and a Pairwise Algorithm for Computing Sample Variances," Technical Report STAN-CS-79-773, Department of Computer Science, Stanford University."
-
-
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.doublemean()Get the sample mean.longN()Get the size of the sample.doublesample()Get the sample skewness (biased estimator).StringtoString()doublevalue()Get the value of the statistic.doublevariance()Get the (unbiased) variance.
-
-
-
Constructor Detail
-
Skewness
public Skewness()
Construct an emptySkewnesscalculator.
-
Skewness
public Skewness(double[] data)
Construct aSkewnesscalculator, initialized with a sample.- Parameters:
data- a sample
-
Skewness
public Skewness(Skewness that)
Copy constructor.- Parameters:
that- aSkewnesscalculator
-
-
Method Detail
-
sample
public double sample()
Get the sample skewness (biased estimator).- Returns:
- the sample skewness
-
mean
public double mean()
Get the sample mean.- Returns:
- the mean
-
variance
public double variance()
Get the (unbiased) variance.- Returns:
- the (unbiased) variance
-
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.
-
-