Skip to content

Commit

Permalink
included @bluesmoon stackd/gauss@1ed40bd and package restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrick Galoso committed Aug 11, 2011
1 parent cdef97b commit 05676f0
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -42,7 +42,7 @@ You can then invoke the tests with either `node` or `vows`:
*Run tests and view specification (verbose)*

$ vows test/* --spec

##API

For now Gauss only has methods for univariate analysis. We're constantly working on adding more functions, adding multivariate statistics, and we encourage additions to the library. Accuracy is a primary concern. If Gauss is returning incorrect results, [please submit an issue](https://github.com/stackd/gauss/issues) and/or [submit a patch](https://github.com/stackd/gauss#fork_box)!
Expand All @@ -52,7 +52,7 @@ For now Gauss only has methods for univariate analysis. We're constantly working
Conventional:

var gauss = require('gauss');
var set = new guass.Vector(5, 1, 3, 2, 21);
var set = new gauss.Vector(5, 1, 3, 2, 21);

Monkey patch:

Expand Down Expand Up @@ -103,11 +103,11 @@ Returns the difference between the largest and smallest value in a data set.

**.mean(callback)**

Returns the average.
Returns the arithmetic mean.

**.median(callback)**

Returns the median. If there are an even amount of numbers in the data set, returns the average of the two middle values.
Returns the median. If there are an even amount of numbers in the data set, returns the arithmetic mean of the two middle values.

**.mode(callback)**

Expand Down
2 changes: 1 addition & 1 deletion index.js
@@ -1 +1 @@
module.exports = require('./lib/vector');
module.exports = require('./lib/gauss');
21 changes: 21 additions & 0 deletions lib/gauss.js
@@ -0,0 +1,21 @@
/**
* Gauss
* Copyright(c) 2011 Fredrick Galoso
* LICENSE: MIT/X11
*/

var Vector = require('./vector'),
TimeSeries = require('./timeseries');

/**
* Library version
*/

exports.version = '0.2';

/**
* Expose constructors
*/

exports.Vector = Vector;
exports.TimeSeries = TimeSeries;
4 changes: 2 additions & 2 deletions lib/vector.js
Expand Up @@ -144,7 +144,7 @@ Array.prototype.percentile = function(percent, callback) {
buffer.sort(this.asc);
var percentile = buffer[0];
if (percent > 0)
percentile = buffer[this.length * percent - 1];
percentile = buffer[Math.ceil(this.length * percent) - 1];
if (callback)
return callback(percentile);
else
Expand Down Expand Up @@ -232,4 +232,4 @@ Array.prototype.min = function(callback) {
return min;
};

exports.Vector = Array;
exports = module.exports = Array;
4 changes: 2 additions & 2 deletions test/vector.test.js
Expand Up @@ -10,7 +10,7 @@ var vows = require('vows'),
* the Array type with some of gauss's goodies.
*/

Array = require('../lib/vector').Vector;
Array = require('../lib/gauss').Vector;

var set = [10, 82, 67, 17, 36, 3, 1, 61, 33, 20,
18, 35, 15, 39, 52, 85, 17, 92, 88, 70,
Expand Down Expand Up @@ -43,7 +43,7 @@ vows.describe('Vector').addBatch({
assert.equal(topic, 2697);
}
},
'Mean': {
'Arithmetic Mean': {
topic: set.mean(),
'53.94': function(topic) {
assert.equal(topic, 53.94);
Expand Down

0 comments on commit 05676f0

Please sign in to comment.