describe("Stats", function () {

    describe("sum", function () {
        it("the sum of [1,2,3,4,5] is 15", function () {
         // Compare to MATLAB: sum([1 2 3 4 5])
         // Compare to R: sum(c(1,2,3,4,5))
            var res;
            res = stats.sum([1, 2, 3, 4, 5]);
            expect(res).to.equal(15);
        });
    });

    describe("mean", function () {
        it("the mean of [1,2,3,4,5] is 3", function () {
         // Compare to MATLAB: mean([1 2 3 4 5])
         // Compare to R: mean(c(1,2,3,4,5))
            var res;
            res = stats.mean([1, 2, 3, 4, 5]);
            expect(res).to.equal(3);
        });
    });

    describe("deviation", function () {
        it("the deviation of [1,2,3,4,5] is [-2,-1,0,1,2]", function () {
         // Compare to MATLAB: [1 2 3 4 5] - mean([1 2 3 4 5])
         // Compare to R: c(1,2,3,4,5) - mean(c(1,2,3,4,5))
            var res;
            res = stats.deviation([1, 2, 3, 4, 5]);
            expect(res).to.eql([-2, -1, 0, 1, 2]);
        });
    });

    describe("variance", function () {
        it("the variance of [1,2,3,4,5] is 2.5", function () {
         // Compare to MATLAB: sum(([1 2 3 4 5] - mean([1 2 3 4 5])) .^ 2) / (5 - 1)
         // Compare to R: sum((c(1,2,3,4,5) - mean(c(1,2,3,4,5))) ^ 2) / (5 - 1)
            var res;
            res = stats.variance([1, 2, 3, 4, 5]);
            expect(res).to.equal(2.5);
        });
    });

    describe("standardDeviation", function () {
        it("the standard deviation of [1,2,3,4,5] is 1.5811", function () {
         // Compare to MATLAB: std([1 2 3 4 5])
         // Compare to R: sd(c(1,2,3,4,5))
            var res;
            res = stats.standardDeviation([1, 2, 3, 4, 5]);
            res = stats.round(res, 4);
            expect(res).to.equal(1.5811);
        });
    });

});

@@ -1827,12 +1827,569 @@
    %7D);%0A%0A
+    describe(%22correlation%22, function () %7B%0A        describe(%22pearson%22, function () %7B%0A            it(%22the Pearson correlation coefficient of %5B1,7,2,3,4%5D and %5B9,3,5,2,1%5D is -0.6181%22, function () %7B%0A             // Compare to MATLAB: corr(%5B1;7;2;3;4%5D, %5B9;3;5;2;1%5D)%0A             // Compare to R: cor(c(1,7,2,3,4), c(9,3,5,2,1))%0A                var res;%0A                res = stats.correlation.pearson(%5B1, 7, 2, 3, 4%5D, %5B9, 3, 5, 2, 1%5D);%0A                res = stats.round(res, 4);%0A                expect(res).to.equal(-0.6181);%0A            %7D);%0A        %7D);%0A    %7D);%0A%0A
 %7D);%0A

Add Pearson correlation coefficient test.