Commit Graph

55 Commits

Author SHA1 Message Date
kortschak
a377c62d90 stat: add simple linear regression 2016-08-05 14:59:01 +09:30
Armadilloa16
926be36d48 ROC function
Produces a ROC curve either for all possible
cutoffs, or for n equally spaced cutoffs.
2016-04-26 16:05:46 +09:30
btracey
c920f60416 Fix ExampleHistogram for new floats behavior 2015-01-11 09:31:10 -08:00
btracey
3093608919 Zeroed count in Histogram so the correct answer is returned when count != nil 2015-01-10 12:42:45 -08:00
btracey
a723bc27d8 Fix Histogram implementation.
The former behavior of Histogram did not agree with the documentation. The documentation matched
the spirit of floats.Within, so keep the documentation and fix the behavior. This change updates
the function behavior, as well as corrects the test and the example.
2015-01-10 10:41:15 -08:00
Jonathan J Lawlor
fb2fe6268d fix weighted covariance implementation
Weighted covariance accidentally used squared weights.  Added a test
case and fixed implementation.
2014-12-23 21:41:15 -05:00
Jonathan J Lawlor
d50d7fb383 correct weighted test, and make fixture clearer
Changed the names of the test table to be clearer.  Also made the
answer a matrix and used Dense.Equals instead of performing the
comparison on r, c, and the raw data.

Also, the old results for the weighted case were wrong.  I’ve added the
same items into the stat_test.go file.
2014-12-22 19:58:09 -05:00
Jonathan J Lawlor
26cf6c0af7 remove unneeded print-comment
The sentence was a bit of a non-sequitur.
2014-11-14 11:31:59 -05:00
Jonathan J Lawlor
cf4e806f4c Rename MomentAt -> MomentAbout
Change the name of MomentAt to MomentAbout, as discussed on gonum-dev.
2014-11-07 21:20:16 -05:00
Jonathan J Lawlor
de2c9e7595 Simplify Moment Sig
Simplify the moment function to no longer take a mean, and implement
tests.
2014-11-07 21:17:58 -05:00
Jonathan J Lawlor
cefae5e543 Simplify ExKurtosis Sig
Remove mean and std from the input to ExKurtosis.
2014-11-07 18:33:15 -05:00
Jonathan J Lawlor
943fa00fdc Simplify Skew Sig
Simplify the Skew interface to remove dependence on mean and standard
deviation calculation.
2014-11-07 18:23:43 -05:00
Jonathan J Lawlor
d310d7322a Simplify Correlation Sig
This used similar code as the Covariance function.  Also, the example
was incorrect (verified via MATLAB) and had a line
`meanY := Mean(x, w)`

Which demonstrates the problem of calculating the weighted mean and
standard deviation externally.
2014-11-07 00:09:08 -05:00
Jonathan J Lawlor
c69ec6cd62 Simplify covariance sig
Changed covariance to remove the need to supply the means.  Also
implemented the corrected two-pass method to estimate the covariance.
2014-11-06 23:00:27 -05:00
Jonathan J Lawlor
40ba293d33 simplify sig to StdDev
Removed the mean from the standard deviation calculation.
2014-11-06 20:45:03 -05:00
Jonathan J Lawlor
1d2d682785 implement new MeanVariance and Variance
Simplified Variance by removing the input mean from the sig, and
implemented a MeanVariance function which calculates the corrected
two-pass corrected sample variance.  It also calculates the mean, so it
returns that as well, which should save some calculation under most
cases.
2014-11-06 20:40:10 -05:00
Jonathan J Lawlor
84e5c41a10 add test fixture for Quantile when p is NaN 2014-11-02 23:18:52 -05:00
Jonathan J Lawlor
ad68effc03 Add test fixture for weighted Harmonic Mean
Added a simple test case for weighted harmonic mean.
2014-11-02 23:12:11 -05:00
Jonathan J Lawlor
e96934fae8 add test fixture for weighted geometric mean
Added a simple test case for a weighted geometric mean
2014-11-02 23:11:44 -05:00
Jonathan J Lawlor
fc2026e897 add test for Variance panic 2014-10-31 00:02:20 -04:00
Jonathan J Lawlor
137309c26e add test for StdScore 2014-10-31 00:00:58 -04:00
Jonathan J Lawlor
bcb8fc7d46 add tests for SortWeighted 2014-10-30 23:46:08 -04:00
Jonathan J Lawlor
97ce3fb14a add test for Skew
Added test for the Skew panic.
2014-10-30 23:36:33 -04:00
Jonathan J Lawlor
e64d007bb4 add tests for Quantile
Added test fixture for the NaN case, which required a bit of
modification to the test code as well, and added tests for the various
panics that can occur.
2014-10-30 23:34:10 -04:00
Jonathan J Lawlor
e291e27aeb add tests for Moment
Added test for panic and  weighted case.
2014-10-30 23:16:03 -04:00
Jonathan J Lawlor
4080c2b351 add test for Mode panic 2014-10-30 23:07:26 -04:00
Jonathan J Lawlor
de72537e4e add test for Mean panic 2014-10-30 23:06:13 -04:00
Jonathan J Lawlor
219b791a54 add test for KL panic 2014-10-30 23:04:56 -04:00
Jonathan J Lawlor
f3f7e82a84 Add tests for KS NaNs and panics
Added tests for the special cases of KolmogorovSmirnov, specifically
when the inputs have NaN or the various ways that result in a panic.
2014-10-30 22:51:41 -04:00
Jonathan J Lawlor
9c9aa85f27 Add test for JensenShannon panic
Add test when p and q have different lengths.
2014-10-30 22:36:36 -04:00
Jonathan J Lawlor
f7a24e5044 Add tests to for Histogram panics
Added tests for the possible panics in Histogram.
2014-10-30 22:26:46 -04:00
Jonathan J Lawlor
b46612a979 add test for Hellinger panic
Add test for slice length mismatch.
2014-10-30 21:45:07 -04:00
Jonathan J Lawlor
21f8a0983b add tests for HarmonicMean
Added tests for harmonic mean, specifically when the weights are nil or
the possible panic.
2014-10-30 21:41:18 -04:00
Jonathan J Lawlor
d31cd5d21e add tests for GeometricMean
Add tests for GeometricMean, specifically the case without any weights
and the possible panic.
2014-10-30 20:48:20 -04:00
Jonathan J Lawlor
6eab3f0cba Add test for ExKurtosis panic
Added a test for the slice length mismatch
2014-10-30 20:24:03 -04:00
Jonathan J Lawlor
8669c5e165 Add tests for cross entropy's panic 2014-10-19 22:00:15 -04:00
Jonathan J Lawlor
19ed9ad89b Add tests for Covariance
There were no tests for covariance, only the example.
2014-10-19 21:53:28 -04:00
Jonathan J Lawlor
b77ecc2c2d Add test for chi2 panic 2014-10-19 18:37:14 -04:00
Jonathan J Lawlor
5d7e4d3b79 test for chi2 special case
Add test for chi squared distance special case, with both bins == 0.
2014-10-19 18:35:42 -04:00
Jonathan J Lawlor
f510cbd899 Handle NaN inputs in CDF
When sort.Float64sAreSorted is called, it panics on NaN inputs.

The way the code is written, there seems to be an intent that if the
input x contains a NaN, then the function should return a NaN.  I
switched the order of the conditional statements so that this became
possible.

I also modified the test cases so that cases with NaN could be
evaluated.
2014-10-19 18:28:50 -04:00
Jonathan J Lawlor
2afe21d761 Add tests for panics in CDF
Add test cases for the various ways that CDF can panic.

We might want to have a reserved CumulantKind that is always invalid,
just for testing.
2014-10-19 17:31:03 -04:00
Jonathan J Lawlor
e5c3361454 Add test for panic in Bhattacharyya 2014-10-19 17:09:43 -04:00
Jonathan J Lawlor
013f164022 add Panics to help test code that should panic
This is from gonum/floats’s tests.  It wraps a called function in a
defer / panic (hopefully) / recover.
2014-10-19 17:09:19 -04:00
btracey
c2c92a04af Added Kolmogorov-Smirnov distance function and test 2014-09-18 16:20:10 -07:00
btracey
1da795789e Fixed check for zero probability value in JensenShannon and updated test. 2014-09-16 23:46:39 -07:00
btracey
6f420f1ff0 Added JensenShannon distance function with test 2014-09-16 22:57:24 -07:00
Brendan Tracey
9cabea418c Merge pull request #6 from pradeep-pyro/stat_distances
Added a few statistical distances
2014-09-02 22:27:49 -07:00
btracey
fae354edd8 Fixed spelling of Kullback-Leibler. 2014-09-01 10:19:05 -07:00
pradeep
ceb78858fe Reorder functions in alphabetical order.
Remove normalization in bhattacharyyaCoeff().
2014-09-01 16:35:40 +08:00
pradeep
ca4b71f0fa Fixed bugs;
Added Bhattacharyya(), Hellinger() and tests;
Removed Intersection().
2014-09-01 14:26:59 +08:00