powered by
Computes the moving average for a ts_data object.
ts_data
ts_moving_average(ts, order)ts_ma(ts, order)
ts_ma(ts, order)
Returns an extended ts_data object with list elements:
filter the filter used
filter
moving.average the computed moving average
moving.average
a ts_data object
integer: order of the moving average
# trend from a quadratic model ts <- ts_data(12, trend.coeff=c(sample(0:10, 1), sample(1+(1:10)/20, 1), 0.5)) ts_moving_average(ts, 3)
Run the code above in your browser using DataLab