Hi pietvo,

Thanks for your comment. It looks like

n-1 subscript would apply. I will double-check and clarify in the documentation.

If you have JavaScript skills, you can make code visible quite easily, but there's no user-sanctioned way to do that.

The code for these two functions looks like this:

- Code: Select all
` "stat_standard_deviation": function() {`

var variances = this["stat_variance"]();

var stddevs = [];

for (var i=0; i<variances.length; i++)

stddevs.push(Math.sqrt(variances[i]));

return stddevs;

},

"stat_variance": function() {

var m = this.stat_data();

var v = [];

for (var col=0; col<m[0].length; col++) {

var squares = 0, sum = 0;

for (var row=0; row<m.length; row++) {

var x = m[row][col];

squares += x * x;

sum += x;

}

var mean = sum / m.length;

var variance = (squares - sum*mean) / (m.length-1);

v.push(variance);

}

return v;

},

(Note that

this refers to

calculator.functions in these functions. A user function would have to say

calculator.functions.stat_data() (or, using the ME alias, more compactly:

ME.stat_data()), instead of

this.stat_data().

If you'd be interested in that, it would be straight-forward to produce the

n subscript version from this.

You can make it either a user function that lives in a folder, or you can inject code and make it available globally. Here's documentation about this

http://naivedesign.com/ND1/ND1_Reference__JavaScript_API.html. I'm glad to help with questions, too.