KO
|
EN
gitlite — search
Search
#hacktoberfest
#java
#ruby
#javascript
#python
#shell
#wordpress
#php
#cli
#android
#erlang
#library
moving-average
★ 62
Open GitHub ↗
Moving Average
Download README (.md)
Explore Similar Repositories
wifimatic-android
:
Wi-Fi Matic Android App
any-saas
:
No description available.
XLocation
:
An Xcode plugin which lets you add easily a new location (GPX file) in your current xcode project using a map point or from an address
Scut-samples
:
Contains different samples that show how to use scut.
MuSiC2
:
identifying mutational significance in cancer genomes
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
moving-average
?
Download (.md)
# moving-average [](https://travis-ci.org/pgte/moving-average) Online calculation of Exponential Moving Average for Node.js. Also suports Moving Variance, Moving Deviation and Forecast. The [following](https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average) online algorithm is implemented: ``` diff := x - mean incr := alpha * diff mean := mean + incr variance := (1 - alpha) * (variance + diff * incr) forecast := mean + alpha * diff ``` ## Install ```bash $ npm install moving-average ``` ## Use ```javascript var timeInterval = 5 * 60 * 1000; // 5 minutes var MA = require('moving-average'); var ma = MA(timeInterval); setInterval(function() { ma.push(Date.now(), Math.random() * 500); console.log('moving average now is', ma.movingAverage()); console.log('moving variance now is', ma.variance()); console.log('moving deviation now is', ma.deviation()); console.log('forecast is', ma.forecast()); }); ``` ## License MIT