Function constructs centered moving average based on state space SMA
Vector or ts object, containing data needed to be smoothed.
Order of centered moving average. If
Nothing. Needed only for the transition to the new name of variables.
If the order is odd, then the function constructs SMA(order) and shifts it back in time. Otherwise an AR(order+1) model is constructed with the preset parameters:
phi_i = 0.5,1,1,...,0.5 / order
This then corresponds to the centered MA with 0.5 weight for the first observation and 0.5 weight for an additional one. e.g. if this is monthly data and we use order=12, then half of the first January and half of the new one is taken.
This is not a forecasting tool. This is supposed to smooth the time series in order to find trend. So don't expect any forecasts from this function!
Object of class "smooth" is returned. It contains the list of the following values:
model - the name of the estimated model.
timeElapsed - time elapsed for the construction of the model.
order - order of the moving average.
nParam - table with the number of estimated / provided parameters.
If a previous model was reused, then its initials are reused and the number of
provided parameters will take this into account.
fitted - the fitted values, shifted in time.
forecast - NAs, because this function does not produce forecasts.
residuals - the residuals of the SMA / AR model.
s2 - variance of the residuals (taking degrees of freedom into
account) of the SMA / AR model.
y - the original data.
ICs - values of information criteria from the respective SMA or
AR model. Includes AIC, AICc, BIC and BICc.
logLik - log-likelihood of the SMA / AR model.
lossValue - Cost function value (for the SMA / AR model).
loss - Type of loss function used in the estimation.
Ivan Svetunkov, email@example.com
Svetunkov I. (2015 - Inf) "smooth" package for R - series of posts about the underlying models and how to use them: https://forecasting.svetunkov.ru/en/tag/smooth/.
Svetunkov I. (2017). Statistical models underlying functions of 'smooth' package for R. Working Paper of Department of Management Science, Lancaster University 2017:1, 1-52.
1 2 3 4 5 6 7
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.