Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
255 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
'use strict'; | ||
|
||
var module = require( './../lib' ); | ||
var incrmstdev = require( './../lib' ); | ||
|
||
// Initialize a method to calculate the moving sample standard deviation incrementally: | ||
var mstdev = incrmstdev( 5 ); | ||
|
||
// Simulate some data... | ||
var value, sigma; | ||
|
||
console.log( '\nValue\tSample StDev\n' ); | ||
|
||
for ( var i = 0; i < 100; i++ ) { | ||
|
||
value = Math.random() * 100; | ||
sigma = mstdev( value ); | ||
|
||
console.log( '%d\t%d', value.toFixed( 4 ), sigma.toFixed( 4 ) ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters