From 94bf2c5cae6df1e7c6083f5ff6c9c1e43ee4043b Mon Sep 17 00:00:00 2001 From: Scott Anderson <scott@influxdata.com> Date: Mon, 15 Jul 2019 08:57:32 -0600 Subject: [PATCH] updated exponentialMovingAverage to address PR feedback --- .../aggregates/exponentialmovingaverage.md | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/content/v2.0/reference/flux/functions/built-in/transformations/aggregates/exponentialmovingaverage.md b/content/v2.0/reference/flux/functions/built-in/transformations/aggregates/exponentialmovingaverage.md index db888b171..da132b4ab 100644 --- a/content/v2.0/reference/flux/functions/built-in/transformations/aggregates/exponentialmovingaverage.md +++ b/content/v2.0/reference/flux/functions/built-in/transformations/aggregates/exponentialmovingaverage.md @@ -2,7 +2,7 @@ title: exponentialMovingAverage() function description: > The `exponentialMovingAverage()` function calculates the exponential moving average - of values grouped into `n` number of points giving more weight to recent data. + of values grouped into `n` number of points, giving more weight to recent data. menu: v2_0_ref: name: exponentialMovingAverage @@ -15,7 +15,7 @@ related: --- The `exponentialMovingAverage()` function calculates the exponential moving average -of values grouped into `n` number of points giving more weight to recent data. +of values grouped into `n` number of points, giving more weight to recent data. _**Function type:** Aggregate_ @@ -28,11 +28,11 @@ exponentialMovingAverage( ##### Exponential moving average rules: - The first value of an exponential moving average over `n` values is the - algebraic mean of the first `n` values. + algebraic mean of `n` values. - Subsequent values are calculated as `y(t) = x(t) * k + y(t-1) * (1 - k)`, where: - - `k = 2 / (1 + n)`. - `y(t)` is the exponential moving average at time `t`. - `x(t)` is the value at time `t`. + - `k = 2 / (1 + n)`. - The average over a period populated by only `null` values is `null`. - Exponential moving averages skip `null` values. @@ -57,13 +57,6 @@ from(bucket: "example-bucket"): |> exponentialMovingAverage(n: 5) ``` -#### Calculate a ten point exponential moving average -```js -from(bucket: "example-bucket"): - |> range(start: -12h) - |> exponentialMovingAverage(n: 10) -``` - #### Table transformation with a two point exponential moving average ###### Input table: