Simplify Skew Sig

Simplify the Skew interface to remove dependence on mean and standard
deviation calculation.
This commit is contained in:
Jonathan J Lawlor
2014-11-07 18:23:43 -05:00
parent d310d7322a
commit 943fa00fdc
2 changed files with 11 additions and 10 deletions

View File

@@ -1171,14 +1171,12 @@ func TestSkew(t *testing.T) {
ans: -1.12066646837198,
},
} {
mean := Mean(test.x, test.weights)
std := StdDev(test.x, test.weights)
skew := Skew(test.x, mean, std, test.weights)
skew := Skew(test.x, test.weights)
if math.Abs(skew-test.ans) > 1e-14 {
t.Errorf("Skew mismatch case %d. Expected %v, Found %v", i, test.ans, skew)
}
}
if !Panics(func() { Skew(make([]float64, 3), 0, 1, make([]float64, 2)) }) {
if !Panics(func() { Skew(make([]float64, 3), make([]float64, 2)) }) {
t.Errorf("Skew did not panic with x, weights length mismatch")
}
}