View source: R/1_moving_average.R
simple_ma | R Documentation |
A simple moving average is a moving average whose coefficients are all equal and whose sum is 1
simple_ma(order, lags = -trunc((order - 1)/2))
order |
number of terms of the moving_average |
lags |
integer indicating the number of lags of the moving average. |
# The M2X12 moving average is computed as
(simple_ma(12, -6) + simple_ma(12, -5)) / 2
# The M3X3 moving average is computed as
simple_ma(3, -1) ^ 2
# The M3X5 moving average is computed as
simple_ma(3, -1) * simple_ma(5, -2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.