移动平均和指数平滑

时间:2022-03-07 12:32:43
(1)简单移动平均 移动平均在TTR包中 简单移动平均 SMA(x, n = 10, ...)
指数移动平均 EMA(x, n = 10, wilder = FALSE, ratio = NULL,...)       For EMA,wilder=FALSE (the default) uses an exponential smoothing ratio of2/(n+1),while wilder=TRUE uses Welles Wilder's exponential smoothing ratioof 1/n.
双指数移动平均 DEMA(x, n = 10, v = 1, wilder = FALSE, ratio =NULL)
加权移动平均 WMA(x, n = 10, wts = 1:n,...)(2)HoltWinters指数平滑HoltWinters(x, alpha = NULL, beta = NULL, gamma =NULL,          seasonal = c("additive","multiplicative"),          start.periods = 2, l.start = NULL, b.start =NULL,          s.start = NULL,          optim.start = c(alpha = 0.3, beta = 0.1, gamma =0.1),          optim.control = list())alpha为水平项,beta为趋势项,gamma为季节项。此指数平滑需设置初始值。l.start为水平初始值,b.start为趋势初始值,s.start为季节初始值。选择季节选项有additive和multiplicative.HoltWinters也可做季节分解(看季节趋势分解