Description Usage Arguments Details Value Examples
Use X-13ARIMA-SEATS program by US Census Bureau to perform seasonal adjustment in time series. The function uses the seasonal package and applies its routine to a csv/xlsx file with multiple series simultaneously. The function also performs an automatic correction routine so that the results are properly diagnosed (residuals without autocorrelation and seasonality).
1 |
x |
output from readX13 function |
autoCorrection |
a vector naming the time series should be auto corrected. See Details. |
userCorrection |
a vector naming the time series should be corrected by user especifications. See Details. |
autoCorrection
can assume ""
or NULL
, or a vector naming the time series which should be corrected. If autoCorrection = ""
, all time series will be corrected automatically (the final especification should be a model with no autocorrelated residuals, significant parameters at 5 percent and smaller BIC between a list of 48 possibles models). Default is NULL
(no auto correction, automatic seasonal adjustment will be executed).
userCorrection
modify the model especification for series chosen by the user. autoCorrection
and userCorrection
can not be executed at the same time. See Examples.
A list
containing the following elements:
xSA |
seasonally adjusted time series |
seasonalFactors |
seasonal factors for each series |
calendarFactors |
calendar effects for each series |
totalFactors |
seasonal plus calendar factors for each series |
espec |
model especifications for each series |
model |
output from seas function (package seasonal) for each series |
read |
output items from readX13 function |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## Not run:
### Automatic seasonal adjustment and results
# load and read data example
data(serviceSurvey)
data <- readX13(serviceSurvey)
# auto seasonal adjustment
auto <- seasX13(data)
# some results: model especifications
auto$espec
# some results: SARIMA model (first series)
summary(auto$model$ICS)
# some results: plot (second series)
ts.plot(data$xts[,"IES"],auto$xSA[,"IES"], col = 1:2, lwd = 1:2)
legend("topright", legend = c("original", "seas. adjusted"), col = 1:2, lwd = 1:2, bty = "n")
### correct automatic seasonal adjustment: autoCorrection
# all series (be patient, 48 models will be executed for each series)
correct1 <- seasX13(auto, autoCorrection = "")
# correct just one series
correct2 <- seasX13(auto, autoCorrection = c("ISAS"))
### correct automatic seasonal adjustment: userCorrection
# edit the especification of output object from function seasX13
auto$espec["IES","arima.model"] <- "(0 1 1)(0 1 1)"
auto$espec["IES","calendar.effects"] <- "td, carnival"
# run seasonal adjustment with userCorrection option
correct3 <- seasX13(auto, userCorrection = c("IES"))
correct3$espec
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.