simple_ma: Simple Moving Average

View source: R/1_moving_average.R

simple_maR Documentation

Simple Moving Average

Description

A simple moving average is a moving average whose coefficients are all equal and whose sum is 1

Usage

simple_ma(order, lags = -trunc((order - 1)/2))

Arguments

order

number of terms of the moving_average

lags

integer indicating the number of lags of the moving average.

Examples

# 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)

palatej/rjdfilters documentation built on May 8, 2023, 6:28 a.m.