Sarima | R Documentation |
Constructor of the SARIMA model for Bayesian estimation in Stan.
Sarima(
ts,
order = c(1, 0, 0),
seasonal = c(0, 0, 0),
xreg = NULL,
period = 0,
series.name = NULL
)
ts |
a numeric or ts object with the univariate time series. |
order |
a three length vector with the specification of the non-seasonal
part of the ARIMA model: the three components |
seasonal |
a vector of length three with the specification of the seasonal
part of the SARIMA model. The three components |
xreg |
Optionally, a numerical matrix of external regressors, which must have the same number of rows as ts. It should not be a data frame. |
period |
an integer specifying the periodicity of the time series by default the value frequency(ts) is used. |
series.name |
an optional string vector with the series names. |
The function returns a list with the data for running stan
function of
rstan package
If xreg
option is used, the model by default will cancel the
seasonal differences adjusted (D = 0). If a value d
> 0 is used, all
the regressor variables in xreg
will be difference as well.
The default priors used in Sarima are:
ar ~ normal(0,0.5)
ma ~ normal(0,0.5)
mu0 ~ t-student(0,2.5,6)
sigma0 ~ t-student(0,1,7)
sar ~ normal(0,0.5)
sma ~ normal(0,0.5)
breg ~ t-student(0,2.5,6)
For changing the default prior use the function set_prior
.
The function returns a list with the data for running stan()
function of rstan package.
Asael Alonzo Matamoros
Box, G. E. P. and Jenkins, G.M. (1978). Time series analysis: Forecasting and
control. San Francisco: Holden-Day. Biometrika, 60(2), 297-303.
doi:10.1093/biomet/65.2.297
.
Kennedy, P. (1992). Forecasting with dynamic regression models: Alan Pankratz, 1991.
International Journal of Forecasting. 8(4), 647-648.
url: https://EconPapers.repec.org/RePEc:eee:intfor:v:8:y:1992:i:4:p:647-648
.
Hyndman, R. & Khandakar, Y. (2008). Automatic time series forecasting: the
forecast package for R
. Journal of Statistical Software. 26(3),
1-22.doi: 10.18637/jss.v027.i03
garch
, and set_prior
functions.
# Declare a multiplicative seasonal ARIMA model for the birth data.
model = Sarima(birth,order = c(0,1,2),seasonal = c(1,1,1))
model
#Declare an Dynamic Harmonic Regression model for the birth data.
model = Sarima(birth,order = c(1,0,1),xreg = fourier(birth,K = 2))
model
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.