You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
import { numFormat } from '../utils/util';
|
|
|
|
const analysis = {
|
|
"STDEVP": function (mean, array1d) {
|
|
let cov = 0;
|
|
for (let i = 0; i < array1d.length; i++) {
|
|
let xi = array1d[i];
|
|
cov += Math.pow(xi - mean, 2);
|
|
}
|
|
return numFormat(Math.sqrt(cov / array1d.length));
|
|
},
|
|
"STDEV": function (mean, array1d) {
|
|
let cov = 0;
|
|
for (let i = 0; i < array1d.length; i++) {
|
|
let xi = array1d[i];
|
|
cov += Math.pow(xi - mean, 2);
|
|
}
|
|
return numFormat(Math.sqrt(cov / (array1d.length - 1)));
|
|
},
|
|
"VARP": function (mean, array1d) {
|
|
let cov = 0;
|
|
for (let i = 0; i < array1d.length; i++) {
|
|
let xi = array1d[i];
|
|
cov += Math.pow(xi - mean, 2);
|
|
}
|
|
return numFormat(cov / array1d.length);
|
|
},
|
|
"let": function (mean, array1d) {
|
|
let cov = 0;
|
|
for (let i = 0; i < array1d.length; i++) {
|
|
let xi = array1d[i];
|
|
cov += Math.pow(xi - mean, 2);
|
|
}
|
|
return numFormat(cov / (array1d.length - 1));
|
|
},
|
|
};
|
|
|
|
export default analysis;
|