简体   繁体   中英

R: Generate a Seasonal ARIMA time-series model using parameters of existing data

I have a count time series data which I'm able to use to determine the parameters of the underlying stochastic process. For example say I have a SARIMA (p,d,q)(P,D,Q)[S] seasonal ARIMA model.

How do I use this to generate a new count time series data set?

Being even more specific: a SARIMA(1,0,1)(1,0,0)[12] - how can I generate a time series for a 10 year period for each month? (ie, 120 points to estimate the number of 'counts'.)

Use simulate.Arima() from the forecast package. It handles seasonal ARIMA models whereas arima.sim() does not.

However, ARIMA models are not suitable for count time series as they assume the process is defined on the whole real line.

Late comer to the party, but definitely an ideal solution for generating SARIMA (p,d,q)(P,D,Q)[S] models without conditioning on data as it lowers the threshold considerably. Recently, the SARIMA object was added to the gmwm package ( disclaimer: author of it.)

This feature is currently in the GitHub package build and, so, the syntax may change.

Example Generation Code:

# install.packages("devtools")

devtools::install_github("smac-group/gmwm")

# Set seed for reproducibility
set.seed(5532)

# Generate a SARIMA(1,0,1)(1,0,0)[12] 
mod = SARIMA(ar=.6, i = 0, ma=.3, sar = .5, si = 0, sma = 0, s = 12, sigma2 = 1)

# Generate the data
xt = gen_gts(1e3, mod)

# Try to recover parameters
arima(xt, order = c(1,0,1), seasonal = list(order = c(1,0,0), period = 12), include.mean = FALSE)

Output:

Call:
arima(x = xt, order = c(1, 0, 1), seasonal = list(order = c(1, 0, 0), period = 12), 
    include.mean = F)

Coefficients:
         ar1     ma1    sar1
      0.5728  0.3117  0.5035
s.e.  0.0335  0.0371  0.0274

sigma^2 estimated as 1.008:  log likelihood = -1424.89,  aic = 2857.78

Misc: Update this post on gmwm v3.0.0 release.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM