if (FALSE) {
# A one-side moving average order of 7
USgas_MA7 <- ts_ma(USgas, n_left = 6, n = NULL)
# A two-sided moving average order of 13
USgas_two_side_MA <- ts_ma(USgas, n = 6)
# Unbalanced moving average of order 12
USVSales_MA12 <- ts_ma(USVSales, n_left = 6, n_right = 5, n = NULL,
title = "US Monthly Total Vehicle Sales - MA",
Ytitle = "Thousand of Units")
# Adding double MA of order 2 to balanced the series:
USVSales_MA12 <- ts_ma(USVSales, n_left = 6, n_right = 5, n = NULL,
double = 2,
title = "US Monthly Total Vehicle Sales - MA",
Ytitle = "Thousand of Units")
# Adding several types of two-sided moving averages along with the unblanced
# Plot each on a separate plot
USVSales_MA12 <- ts_ma(USVSales, n_left = 6, n_right = 5, n = c(3, 6, 9),
double = 2, multiple = TRUE,
title = "US Monthly Total Vehicle Sales - MA",
Ytitle = "Thousand of Units")
}
Run the code above in your browser using DataLab