Title: | R Interface to X-13-ARIMA-SEATS |
---|---|
Description: | Easy-to-use interface to X-13-ARIMA-SEATS, the seasonal adjustment software by the US Census Bureau. It offers full access to almost all options and outputs of X-13, including X-11 and SEATS, automatic ARIMA model search, outlier detection and support for user defined holiday variables, such as Chinese New Year or Indian Diwali. A graphical user interface can be used through the 'seasonalview' package. Uses the X-13-binaries from the 'x13binary' package. |
Authors: | Christoph Sax [aut, cre] , Dirk Eddelbuettel [ctb] , Andrea Ranzato [ctb] |
Maintainer: | Christoph Sax <[email protected]> |
License: | GPL-3 |
Version: | 1.10.0 |
Built: | 2024-11-18 02:53:24 UTC |
Source: | https://github.com/christophsax/seasonal |
seasonal is an easy-to-use interface to X-13-ARIMA-SEATS, the seasonal adjustment software by the US Census Bureau. It offers full access to almost all options and outputs of X-13, including X-11 and SEATS, automatic ARIMA model search, outlier detection and support for user defined holiday variables, such as Chinese New Year or Indian Diwali. A graphical user interface can be used through the seasonalview package. Uses the X-13-binaries from the x13binary package.
The best way to start is to have a look at the vignette:
vignette("seas")
Seasonal depends on the x13binary package, which downloads and installs the X-13 binaries. To install both packages, simply type to the R console:
install.packages("seasonal")
A startup message is given if the path to X-13 is specified manually. To
suppress the message, use suppressPackageStartupMessages()
.
Sometimes, you either cannot or don't want to rely on the binaries provided by x13binary:
because you are on an unsupported system, like Solaris. If you manage to build X-13 on such a system, please let the developers of x13binary know.
because you cannot run executable files in your R library folders, due to corporate IT policy.
because you are using your own Fortran compilation of X-13ARIMA-SEATS.
Setting the path manually can be done as in previous versions of seasonal. In order to tell seasonal where to find the binary executables of X-13ARIMA- SEATS, the specific environmental variable X13_PATH needs to be set. This may be done during your active session in R:
Sys.setenv(X13_PATH = "YOUR_X13_DIRECTORY")
Exchange YOUR_X13_DIRECTORY
with the path to your installation of
X-13ARIMA- SEATS. You can always check your installation with:
checkX13()
If it works, you may want to set the environmental variable permanently, by
adding the Sys.setenv line to one of your .Rprofile
files. The easiest
is to use the one located in your home directory, which can be written
directly from R:
write('Sys.setenv(X13_PATH = "YOUR_X13_DIRECTORY")', file = "~/.Rprofile", append = TRUE)
If the file does not exist (by default), it will be created. Make sure that
you get the quotes right: double quotes around your directory, single quotes
around the whole Sys.setenv
line, such that R understands your string.
Check first that the the Sys.setenv
line works correctly; once it is
written you may have to edit .Rprofile
manually. (Or add a second,
overwriting line to it.) For other ways to set an environmental variable
permanently in R, see Startup()
.
Christoph Sax [email protected]
Sax C, Eddelbuettel D (2018). "Seasonal Adjustment by X-13ARIMA-SEATS in R." Journal of Statistical Software, 87(11), 1-17. doi:10.18637/jss.v087.i11.
seas()
for the core function and more information on
package usage.
data.frame
These methods coerce the output to a data.frame
. This is useful for
further processing. (This is a second attempt to do that; the first
experimental attempt in version 1.4 used an argument data.frame
in the
call to the functions, and is now obsolete. The present approach seems
cleaner and is likely to stay, but still consider it as
experimental.)
## S3 method for class 'seas' as.data.frame(x, ...) ## S3 method for class 'summary.seas' as.data.frame(x, ...)
## S3 method for class 'seas' as.data.frame(x, ...) ## S3 method for class 'summary.seas' as.data.frame(x, ...)
x |
an object of class |
... |
unused. |
The data.frames produced by these functions follow the naming conventions from the 'broom' package, but do not depend on it otherwise.
a data.frame
without row names.
m <- seas(AirPassengers, x11 = "") # a data.frame containing data as.data.frame(m) # a data.frame containing the summary information on the coefficients as.data.frame(summary(m))
m <- seas(AirPassengers, x11 = "") # a data.frame containing data as.data.frame(m) # a data.frame containing the summary information on the coefficients as.data.frame(summary(m))
Check the installation of the binary executables of X-13ARIMA-SEATS. See
seasonal()
for details on how to set X13_PATH
manually if
you intend to use your own binaries.
checkX13(fail = FALSE, fullcheck = TRUE, htmlcheck = TRUE)
checkX13(fail = FALSE, fullcheck = TRUE, htmlcheck = TRUE)
fail |
logical, whether an error should interrupt the process. If
|
fullcheck |
logical, whether a full test should be performed. Runs
|
htmlcheck |
logical, whether the presence of the the HTML version of X-13 should be checked. |
old.path <- Sys.getenv("X13_PATH") Sys.setenv(X13_PATH = "") # its broken now try(checkX13()) # fix it (provided it worked in the first place) if (old.path == "") { Sys.unsetenv("X13_PATH") } else { Sys.setenv(X13_PATH = old.path) } try(checkX13())
old.path <- Sys.getenv("X13_PATH") Sys.setenv(X13_PATH = "") # its broken now try(checkX13()) # fix it (provided it worked in the first place) if (old.path == "") { Sys.unsetenv("X13_PATH") } else { Sys.setenv(X13_PATH = old.path) } try(checkX13())
Monthly consumer price index of Switzerland. Base year is 1993.
Time series of class "ts"
.
Federal Statistical Office, Switzerland
data(seasonal) cpi
data(seasonal) cpi
Dates of Chinese New Year, Indian Diwali and Easter, suitable for the use in
genhol()
.
Objects of class "Date"
.
https://www2.census.gov/software/x-13arima-seats/win-genhol/download/
http://www.chinesenewyears.info/chinese-new-year-calendar.php
Ministry of Statistics and Programme Implementation, with help from Pinaki Mukherjee
data(holiday) cny diwali easter
data(holiday) cny diwali easter
Monthly exports and imports of China (July 1983 to December 2013).
Each time series is an object of class "ts"
.
In 100 mio U.S. Dollar.
China Customs
data(seasonal) imp exp
data(seasonal) imp exp
Functions to extract the main time series from a "seas"
object. For
universal import of X-13ARIMA-SEATS tables, use the series()
function.
final(object) original(object) trend(object) irregular(object) ## S3 method for class 'seas' residuals(object, ...)
final(object) original(object) trend(object) irregular(object) ## S3 method for class 'seas' residuals(object, ...)
object |
an object of class |
... |
not used. For compatibility with the generic. |
These functions support R default NA handling. If na.action = na.exclude
is specified in the call to seas
, the time series will
also contain NAs.
returns a "ts"
object, depending on the function.
Vignette with a more detailed description: http://www.seasonal.website/seasonal.html
Comprehensive list of R examples from the X-13ARIMA-SEATS manual: http://www.seasonal.website/examples.html
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
seas()
for the main function of seasonal.
series()
, for universal X-13 output extraction.
m <- seas(AirPassengers) final(m) original(m) irregular(m) trend(m) # NA handling AirPassengersNA <- window(AirPassengers, end = 1962, extend = TRUE) final(seas(AirPassengersNA, na.action = na.omit)) # no NA in final series final(seas(AirPassengersNA, na.action = na.exclude)) # NA in final series final(seas(AirPassengersNA, na.action = na.x13)) # NA filled by x13 # final(seas(AirPassengersNA, na.action = na.fail)) # fails
m <- seas(AirPassengers) final(m) original(m) irregular(m) trend(m) # NA handling AirPassengersNA <- window(AirPassengers, end = 1962, extend = TRUE) final(seas(AirPassengersNA, na.action = na.omit)) # no NA in final series final(seas(AirPassengersNA, na.action = na.exclude)) # NA in final series final(seas(AirPassengersNA, na.action = na.x13)) # NA filled by x13 # final(seas(AirPassengersNA, na.action = na.fail)) # fails
Returns the five best models as chosen by the BIC criterion. It needs the
automdl
spec to be activated (default). If it is not activated, the
function tries to re-evaluate the model with the automdl
spec
activated.
fivebestmdl(x)
fivebestmdl(x)
x |
object of class |
Vignette with a more detailed description: http://www.seasonal.website/seasonal.html
Comprehensive list of R examples from the X-13ARIMA-SEATS manual: http://www.seasonal.website/examples.html
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
seas()
for the main function.
series()
, for universal X-13 output extraction.
plot.seas()
, for diagnostical plots.
out()
, for accessing the full output of X-13ARIMA-SEATS.
m <- seas(AirPassengers) fivebestmdl(m)
m <- seas(AirPassengers) fivebestmdl(m)
A replacement for the genhol software by the U.S. Census Bureau, a utility that uses the same procedure as X-12-ARIMA to create regressors for the U. S. holidays of Easter, Labor Day, and Thanksgiving. This is a replacement written in R, the U.S. Census Bureau software is not needed.
genhol(x, start = 0, end = 0, frequency = 12, center = "none")
genhol(x, start = 0, end = 0, frequency = 12, center = "none")
x |
a vector of class |
start |
integer, shifts the start point of the holiday. Use negative
values if |
end |
integer, shifts end point of the holiday. Use negative values if
|
frequency |
integer, frequency of the resulting series |
center |
character string. Either |
The resulting time series can be used as a user defined variable in
seas()
. Usually, you want the holiday effect to be removed from
the final series, so you need to specify regression.usertype = "holiday"
. (The default is to include user defined variables in the final
series.)
an object of class "ts"
that can be used as a user defined
variable in seas()
.
seas()
for the main function of seasonal.
data(holiday) # dates of Chinese New Year, Indian Diwali and Easter ### use of genhol # 10 day before Easter day to one day after, quarterly data: genhol(easter, start = -10, end = 1, frequency = 4) genhol(easter, frequency = 2) # easter is always in the first half-year # centering for overall mean or monthly calendar means genhol(easter, center = "mean") genhol(easter, center = "calendar") ### replicating X-13's built-in Easter adjustment # built-in m1 <- seas(x = AirPassengers, regression.variables = c("td1coef", "easter[1]", "ao1951.May"), arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log", x11 = "") summary(m1) # user defined variable ea1 <- genhol(easter, start = -1, end = -1, center = "calendar") # regression.usertype = "holiday" ensures that the effect is removed from # the final series. m2 <- seas(x = AirPassengers, regression.variables = c("td1coef", "ao1951.May"), xreg = ea1, regression.usertype = "holiday", arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log", x11 = "") summary(m2) all.equal(final(m2), final(m1), tolerance = 1e-06) # with genhol, its possible to do sligtly better, by adjusting the length # of easter from Friday to Monday: ea2 <- genhol(easter, start = -2, end = +1, center = "calendar") m3 <- seas(x = AirPassengers, regression.variables = c("td1coef", "ao1951.May"), xreg = ea2, regression.usertype = "holiday", arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log", x11 = "") summary(m3) ### Chinese New Year data(seasonal) data(holiday) # dates of Chinese New Year, Indian Diwali and Easter # de facto holiday length: http://en.wikipedia.org/wiki/Chinese_New_Year cny.ts <- genhol(cny, start = 0, end = 6, center = "calendar") m1 <- seas(x = imp, xreg = cny.ts, regression.usertype = "holiday", x11 = "", regression.variables = c("td1coef", "ls1985.Jan", "ls2008.Nov"), arima.model = "(0 1 2)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log") summary(m1) # compare to identical no-CNY model m2 <- seas(x = imp, x11 = "", regression.variables = c("td1coef", "ls1985.Jan", "ls2008.Nov"), arima.model = "(0 1 2)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log") summary(m2) ts.plot(final(m1), final(m2), col = c("red", "black")) # modeling complex holiday effects in Chinese imports # - positive pre-CNY effect # - negative post-CNY effect pre_cny <- genhol(cny, start = -6, end = -1, frequency = 12, center = "calendar") post_cny <- genhol(cny, start = 0, end = 6, frequency = 12, center = "calendar") m3 <- seas(x = imp, x11 = "", xreg = cbind(pre_cny, post_cny), regression.usertype = "holiday", x11 = list()) summary(m3) ### Indian Diwali (thanks to Pinaki Mukherjee) # adjusting Indian industrial production m4 <- seas(iip, x11 = "", xreg = genhol(diwali, start = 0, end = 0, center = "calendar"), regression.usertype = "holiday" ) summary(m4) # without specification of 'regression.usertype', Diwali effects are added # back to the final series m5 <- seas(iip, x11 = "", xreg = genhol(diwali, start = 0, end = 0, center = "calendar") ) ts.plot(final(m4), final(m5), col = c("red", "black")) # plot the Diwali factor in Indian industrial production plot(series(m4, "regression.holiday")) ### Using genhol to replicate the regARIMA estimation in R # easter regressor ea <- genhol(easter, start = -1, end = -1, center = "calendar") ea <- window(ea, start = start(AirPassengers), end = end(AirPassengers)) # estimating ARIMA model in R base arima(log(AirPassengers), order = c(0,1,1), seasonal = c(0,1,1), xreg = ea) summary(seas(AirPassengers, regression.variables = c("easter[1]"), regression.aictest = NULL)) # Note that R defines the ARIMA model with negative signs before the MA term, # X-13 with a positive sign.
data(holiday) # dates of Chinese New Year, Indian Diwali and Easter ### use of genhol # 10 day before Easter day to one day after, quarterly data: genhol(easter, start = -10, end = 1, frequency = 4) genhol(easter, frequency = 2) # easter is always in the first half-year # centering for overall mean or monthly calendar means genhol(easter, center = "mean") genhol(easter, center = "calendar") ### replicating X-13's built-in Easter adjustment # built-in m1 <- seas(x = AirPassengers, regression.variables = c("td1coef", "easter[1]", "ao1951.May"), arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log", x11 = "") summary(m1) # user defined variable ea1 <- genhol(easter, start = -1, end = -1, center = "calendar") # regression.usertype = "holiday" ensures that the effect is removed from # the final series. m2 <- seas(x = AirPassengers, regression.variables = c("td1coef", "ao1951.May"), xreg = ea1, regression.usertype = "holiday", arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log", x11 = "") summary(m2) all.equal(final(m2), final(m1), tolerance = 1e-06) # with genhol, its possible to do sligtly better, by adjusting the length # of easter from Friday to Monday: ea2 <- genhol(easter, start = -2, end = +1, center = "calendar") m3 <- seas(x = AirPassengers, regression.variables = c("td1coef", "ao1951.May"), xreg = ea2, regression.usertype = "holiday", arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log", x11 = "") summary(m3) ### Chinese New Year data(seasonal) data(holiday) # dates of Chinese New Year, Indian Diwali and Easter # de facto holiday length: http://en.wikipedia.org/wiki/Chinese_New_Year cny.ts <- genhol(cny, start = 0, end = 6, center = "calendar") m1 <- seas(x = imp, xreg = cny.ts, regression.usertype = "holiday", x11 = "", regression.variables = c("td1coef", "ls1985.Jan", "ls2008.Nov"), arima.model = "(0 1 2)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log") summary(m1) # compare to identical no-CNY model m2 <- seas(x = imp, x11 = "", regression.variables = c("td1coef", "ls1985.Jan", "ls2008.Nov"), arima.model = "(0 1 2)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log") summary(m2) ts.plot(final(m1), final(m2), col = c("red", "black")) # modeling complex holiday effects in Chinese imports # - positive pre-CNY effect # - negative post-CNY effect pre_cny <- genhol(cny, start = -6, end = -1, frequency = 12, center = "calendar") post_cny <- genhol(cny, start = 0, end = 6, frequency = 12, center = "calendar") m3 <- seas(x = imp, x11 = "", xreg = cbind(pre_cny, post_cny), regression.usertype = "holiday", x11 = list()) summary(m3) ### Indian Diwali (thanks to Pinaki Mukherjee) # adjusting Indian industrial production m4 <- seas(iip, x11 = "", xreg = genhol(diwali, start = 0, end = 0, center = "calendar"), regression.usertype = "holiday" ) summary(m4) # without specification of 'regression.usertype', Diwali effects are added # back to the final series m5 <- seas(iip, x11 = "", xreg = genhol(diwali, start = 0, end = 0, center = "calendar") ) ts.plot(final(m4), final(m5), col = c("red", "black")) # plot the Diwali factor in Indian industrial production plot(series(m4, "regression.holiday")) ### Using genhol to replicate the regARIMA estimation in R # easter regressor ea <- genhol(easter, start = -1, end = -1, center = "calendar") ea <- window(ea, start = start(AirPassengers), end = end(AirPassengers)) # estimating ARIMA model in R base arima(log(AirPassengers), order = c(0,1,1), seasonal = c(0,1,1), xreg = ea) summary(seas(AirPassengers, regression.variables = c("easter[1]"), regression.aictest = NULL)) # Note that R defines the ARIMA model with negative signs before the MA term, # X-13 with a positive sign.
Select or deselect outliers by point and click. To quit and return the call, press ESC. Click several times to loop through different outlier types.
## S3 method for class 'seas' identify(x, type = c("ao", "tc", "ls"), ...)
## S3 method for class 'seas' identify(x, type = c("ao", "tc", "ls"), ...)
x |
an object of class |
type |
character vector, types of outlier to loop through. |
... |
unused, for compatibility with the generic function. |
an object of class "seas"
, containing the static call of the
selected model.
m <- seas(AirPassengers) identify(m)
m <- seas(AirPassengers) identify(m)
Industrial Production of India (IIP).
Time series of class "ts"
.
Index value. IIP is used for measuring the performance overall industrial sector of the Indian economy. IIP is compiled by using data from 16 source agencies.
Central Statistics Office of the Ministry of Statistics and Programme Implementation, with help from Pinaki Mukherjee
data(seasonal) iip
data(seasonal) iip
.spc
FilesUtility function to import .spc
files from X-13. It generates a list
of calls to seas
(and import.ts
) that can be run in R.
Evaluating these calls should perform the same X-13 procedure as the original
.spc
file. The print
method displays the calls in a way that
they can be copy-pasted into an R script.
import.spc(file, text = NULL) ## S3 method for class 'import.spc' print(x, ...)
import.spc(file, text = NULL) ## S3 method for class 'import.spc' print(x, ...)
file |
character, path to the X-13 |
text |
character, alternatively, the content of a |
x |
object of class |
... |
further arguments, not used |
returns an object of class import.spc
, which is a list with the following (optional) objects of class call
:
x |
the call to retrieve the data for the input series |
xtrans |
the call to retrieve the data for the |
xreg |
the call to retrieve the data for the |
seas |
the call to |
import.ts()
, for importing X-13 data files.
seas()
for the main function of seasonal.
# importing the orginal X-13 example file import.spc(text = ' series{ title="International Airline Passengers Data from Box and Jenkins" start=1949.01 data=( 112 118 132 129 121 135 148 148 136 119 104 118 115 126 141 135 125 149 170 170 158 133 114 140 145 150 178 163 172 178 199 199 184 162 146 166 171 180 193 181 183 218 230 242 209 191 172 194 196 196 236 235 229 243 264 272 237 211 180 201 204 188 235 227 234 264 302 293 259 229 203 229 242 233 267 269 270 315 364 347 312 274 237 278 284 277 317 313 318 374 413 405 355 306 271 306 315 301 356 348 355 422 465 467 404 347 305 336 340 318 362 348 363 435 491 505 404 359 310 337 360 342 406 396 420 472 548 559 463 407 362 405 417 391 419 461 472 535 622 606 508 461 390 432) span=(1952.01, ) } spectrum{ savelog=peaks } transform{ function=auto savelog=autotransform } regression{ aictest=(td easter) savelog=aictest } automdl{ savelog=automodel } outlier{ } x11{} ' ) ### reading .spc with multiple user regression and transformation series # running a complex seas call and save output in a temporary directory tdir <- tempdir() seas(x = AirPassengers, xreg = cbind(a = genhol(cny, start = 1, end = 4, center = "calendar"), b = genhol(cny, start = -3, end = 0, center = "calendar")), xtrans = cbind(sqrt(AirPassengers), AirPassengers^3), transform.function = "log", transform.type = "temporary", regression.aictest = "td", regression.usertype = "holiday", dir = tdir, out = TRUE) # importing the .spc file from the temporary location ll <- import.spc(file.path(tdir, "iofile.spc")) # ll is list containing four calls: # - 'll$x', 'll$xreg' and 'll$xtrans': calls to import.ts(), which read the # series from the X-13 data files # - 'll$seas': a call to seas() which performs the seasonal adjustment in R str(ll) # to replicate the original X-13 operation, run all four calls in a series. # You can either copy/paste and run the print() output: ll # or use eval() to evaluate the call(s). To evaluate the first call and # import the x variable: eval(ll$x) # to run all four calls in 'll', use lapply() and eval(): ee <- lapply(ll, eval, envir = globalenv()) ee$seas # the 'seas' object, produced by the final call to seas()
# importing the orginal X-13 example file import.spc(text = ' series{ title="International Airline Passengers Data from Box and Jenkins" start=1949.01 data=( 112 118 132 129 121 135 148 148 136 119 104 118 115 126 141 135 125 149 170 170 158 133 114 140 145 150 178 163 172 178 199 199 184 162 146 166 171 180 193 181 183 218 230 242 209 191 172 194 196 196 236 235 229 243 264 272 237 211 180 201 204 188 235 227 234 264 302 293 259 229 203 229 242 233 267 269 270 315 364 347 312 274 237 278 284 277 317 313 318 374 413 405 355 306 271 306 315 301 356 348 355 422 465 467 404 347 305 336 340 318 362 348 363 435 491 505 404 359 310 337 360 342 406 396 420 472 548 559 463 407 362 405 417 391 419 461 472 535 622 606 508 461 390 432) span=(1952.01, ) } spectrum{ savelog=peaks } transform{ function=auto savelog=autotransform } regression{ aictest=(td easter) savelog=aictest } automdl{ savelog=automodel } outlier{ } x11{} ' ) ### reading .spc with multiple user regression and transformation series # running a complex seas call and save output in a temporary directory tdir <- tempdir() seas(x = AirPassengers, xreg = cbind(a = genhol(cny, start = 1, end = 4, center = "calendar"), b = genhol(cny, start = -3, end = 0, center = "calendar")), xtrans = cbind(sqrt(AirPassengers), AirPassengers^3), transform.function = "log", transform.type = "temporary", regression.aictest = "td", regression.usertype = "holiday", dir = tdir, out = TRUE) # importing the .spc file from the temporary location ll <- import.spc(file.path(tdir, "iofile.spc")) # ll is list containing four calls: # - 'll$x', 'll$xreg' and 'll$xtrans': calls to import.ts(), which read the # series from the X-13 data files # - 'll$seas': a call to seas() which performs the seasonal adjustment in R str(ll) # to replicate the original X-13 operation, run all four calls in a series. # You can either copy/paste and run the print() output: ll # or use eval() to evaluate the call(s). To evaluate the first call and # import the x variable: eval(ll$x) # to run all four calls in 'll', use lapply() and eval(): ee <- lapply(ll, eval, envir = globalenv()) ee$seas # the 'seas' object, produced by the final call to seas()
Utility function to read time series from X-13 data files. A call to
import.ts
is constructed and included in the output of
import.spc()
.
import.ts( file, format = "datevalue", start = NULL, frequency = NULL, name = NULL )
import.ts( file, format = "datevalue", start = NULL, frequency = NULL, name = NULL )
file |
character, name of the X-13 file which the data are to be read from |
format |
a valid X-13 file format as described in 7.15 of the
X-13 manual: |
start |
vector of length 2, time of the first observation (only for
formats |
frequency |
the number of observations per unit of time (only for
formats |
name |
(X-11 formats only) name of the series, to select from a file with multiple time series. Omit if you want to read all time series from an X-11 format file. |
an object of class ts
or mts
import.spc()
, for importing X-13 .spc
files.
seas()
for the main function of seasonal.
tdir <- tempdir() seas(x = AirPassengers, dir = tdir) import.ts(file.path(tdir, "iofile.dta")) import.ts(file.path(tdir, "iofile.rsd"), format = "x13save")
tdir <- tempdir() seas(x = AirPassengers, dir = tdir) import.ts(file.path(tdir, "iofile.dta")) import.ts(file.path(tdir, "iofile.rsd"), format = "x13save")
Utility function to substitute NA values by -99999. Useful as a value for the
na.action
argument in seas()
.
na.x13(x)
na.x13(x)
x |
an object of class |
a time series, with NA values substituted by -99999.
AirPassengersNA <- AirPassengers AirPassengersNA[20] <- NA na.x13(AirPassengersNA) seas(AirPassengersNA, na.action = na.x13)
AirPassengersNA <- AirPassengers AirPassengersNA[20] <- NA na.x13(AirPassengersNA) seas(AirPassengersNA, na.action = na.x13)
The out
function shows the full content of the X-13ARIMA-SEATS output
in the browser. If you want to use a specific statistic in R, the
udg()
function is preferable.
out(x, browser = getOption("browser"), ...)
out(x, browser = getOption("browser"), ...)
x |
an object of class |
browser |
browser to be used, passed on to
|
... |
additional spec-arguments options sent to X-13ARIMA-SEATS during
re-evaluation, passed to |
To keep the size of "seas"
objects small, seas
does not save
the output by default. Instead, out
re-evaluates the model.
displays the output as a side effect.
Vignette with a more detailed description: http://www.seasonal.website/seasonal.html
Comprehensive list of R examples from the X-13ARIMA-SEATS manual: http://www.seasonal.website/examples.html
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
seas()
for the main function of seasonal.
## Not run: m <- seas(AirPassengers) out(m) # customizing the output with additional elements out(m, automdl.print = "autochoicemdl") ## End(Not run)
## Not run: m <- seas(AirPassengers) out(m) # customizing the output with additional elements out(m, automdl.print = "autochoicemdl") ## End(Not run)
Returns an object of class "ts"
that contains the names of the
outliers.
outlier(x, full = FALSE)
outlier(x, full = FALSE)
x |
an object of class |
full |
logical, should the full label of the outlier be shown? If
|
character string time series with outliers.
x <- seas(AirPassengers) outlier(x)
x <- seas(AirPassengers) outlier(x)
Functions to graphically analyze a "seas"
object.
## S3 method for class 'seas' plot( x, outliers = TRUE, trend = FALSE, main = "Original and Adjusted Series", xlab = "Time", ylab = "", transform = c("none", "PC", "PCY"), ... ) residplot( x, outliers = TRUE, main = "residuals of regARIMA", xlab = "Time", ylab = "", ... ) ## S3 method for class 'seas' monthplot(x, choice = c("seasonal", "irregular"), main, ...)
## S3 method for class 'seas' plot( x, outliers = TRUE, trend = FALSE, main = "Original and Adjusted Series", xlab = "Time", ylab = "", transform = c("none", "PC", "PCY"), ... ) residplot( x, outliers = TRUE, main = "residuals of regARIMA", xlab = "Time", ylab = "", ... ) ## S3 method for class 'seas' monthplot(x, choice = c("seasonal", "irregular"), main, ...)
x |
an object of class |
outliers |
logical, should the outliers be drawn. |
trend |
logical, should the trend be drawn. |
main |
character string, title of the graph. |
xlab |
character string, title for the x axis. |
ylab |
character string, title for the y axis. |
transform |
character string, optionally transform the data to period to period |
... |
further arguments passed to the plotting functions. |
choice |
character string, |
plot
calls the plot method for class "seas"
. It plots the
adjusted and unadjusted series, as well as the outliers. Optionally draws the
trend series.
residplot
plots the residuals and the outliers.
monthplot
calls the monthplot method for class "seas"
. It plot
the seasonal and SI component periodwise. Despite its name, monthplot
can be used for series of all frequencies.
All plot functions return a plot as their side effect.
Vignette with a more detailed description: http://www.seasonal.website/seasonal.html
Comprehensive list of R examples from the X-13ARIMA-SEATS manual: http://www.seasonal.website/examples.html
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
seas()
, for the main function.
udg()
, for diagnostical statistics.
m <- seas(AirPassengers) plot(m) plot(m, outliers = FALSE) plot(m, trend = TRUE) residplot(m) residplot(m, outliers = FALSE) monthplot(m) # use standard R functions to analyze "seas" models pacf(resid(m)) spectrum(diff(resid(m))) plot(density(resid(m))) qqnorm(resid(m))
m <- seas(AirPassengers) plot(m) plot(m, outliers = FALSE) plot(m, trend = TRUE) residplot(m) residplot(m, outliers = FALSE) monthplot(m) # use standard R functions to analyze "seas" models pacf(resid(m)) spectrum(diff(resid(m))) plot(density(resid(m))) qqnorm(resid(m))
Returns the seasonally adjusted series of an
(optionally re-evaluated) model of class "seas"
. Without further
arguments, this is equivalent to a call to the final()
function.
## S3 method for class 'seas' predict(object, newdata, ...)
## S3 method for class 'seas' predict(object, newdata, ...)
object |
an object of class |
newdata |
an object of class |
... |
further arguments, passed to |
With the newdata
argument supplied, the "seas"
object is re-
evaluated, using the original model call. This is equivalent of calling
final(update(m, x = newdata))
.
Object of class "ts"
.
# Using data from Dec. 59 to estimate a model ap.short <- window(AirPassengers, end = c(1959, 12)) m <- seas(ap.short) predict(m) final(m) # equivalent # Use Dec. 59 model specification to estimate data up to Dec. 60 predict(m, AirPassengers)
# Using data from Dec. 59 to estimate a model ap.short <- window(AirPassengers, end = c(1959, 12)) m <- seas(ap.short) predict(m) final(m) # equivalent # Use Dec. 59 model specification to estimate data up to Dec. 60 predict(m, AirPassengers)
Main function of the seasonal package. With the default options,
seas
calls the automatic procedures of X-13ARIMA-SEATS to perform a
seasonal adjustment that works well in most circumstances. Via the ...
argument, it is possible to invoke almost all options that are available in
X-13ARIMA-SEATS (see details). The default options of seas
are listed
as explicit arguments and are discussed in the arguments section. A
full-featured graphical user interface can be accessed by the
view()
function.
seas( x = NULL, xreg = NULL, xtrans = NULL, seats.noadmiss = "yes", transform.function = "auto", regression.aictest = c("td", "easter"), outlier = "", automdl = "", composite = NULL, na.action = na.omit, out = FALSE, dir = NULL, multimode = c("x13", "R"), ..., list = NULL )
seas( x = NULL, xreg = NULL, xtrans = NULL, seats.noadmiss = "yes", transform.function = "auto", regression.aictest = c("td", "easter"), outlier = "", automdl = "", composite = NULL, na.action = na.omit, out = FALSE, dir = NULL, multimode = c("x13", "R"), ..., list = NULL )
x |
object of class |
xreg |
(optional) object of class |
xtrans |
(optional) object of class |
seats.noadmiss |
spec 'seats' with argument |
transform.function |
spec |
regression.aictest |
spec |
outlier |
spec |
automdl |
spec |
composite |
spec |
na.action |
a function which indicates what should happen when the data
contain NAs. |
out |
logical. Should the X-13ARIMA-SEATS standard output be saved in
the |
dir |
character string with a user defined file path. If specified, the X-13ARIMA-SEATS output files are copied to this folder. Useful for debugging. |
multimode |
one of |
... |
additional spec-arguments options sent to X-13ARIMA-SEATS (see details). |
list |
a named list with additional spec-arguments options. This is an
alternative to the |
It is possible to use the almost complete syntax of X-13ARIMA-SEAT via the
...
argument. The syntax of X-13ARIMA-SEATS uses specs and
arguments, and each spec optionally contains some arguments. In
seas
, an additional spec-argument can be added by separating spec and
argument by a dot (.
) (see examples). Alternatively, spec-argument
combinations can be supplied as a named list, which is useful for
programming.
Similarly, the series()
function can be used to read almost all
series from X-13ARIMA-SEATS. The udg()
function provides access
to a large number of diagnostical statistics.
For a more extensive description, consider vignette("seas")
or the wiki page,
which contains replications of almost all examples from the official
X-13ARIMA-SEATS manual.
returns an object of class "seas"
, essentially a list with the
following components:
series |
a list containing the output tables of X-13. To be accessed
by the |
data |
seasonally adjusted data, the raw data, the trend component, the irregular component and the seasonal component (deprecated). |
err |
warning messages from X-13ARIMA-SEATS |
udg |
content of the |
est |
content of the |
model |
list with the model specification,
similar to |
fivebestmdl |
Best Five ARIMA Models (unparsed) |
x |
input series |
spc |
object of class |
call |
function call |
wdir |
temporary directory in which X-13ARIMA-SEATS has been run |
The final
function returns the final adjusted series, the
plot
method shows a plot with the unadjusted and the adjusted
series. summary
gives an overview of the regARIMA model. The
udg()
function returns diagnostical statistics.
Sax C, Eddelbuettel D (2018). "Seasonal Adjustment by X-13ARIMA-SEATS in R." Journal of Statistical Software, 87(11), 1-17. doi:10.18637/jss.v087.i11.
On-Line Interface to seasonal http://www.seasonal.website
Comprehensive list of R examples from the X-13ARIMA-SEATS manual: http://www.seasonal.website/examples.html
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
view()
, for accessing the graphical user interface.
update.seas()
, to update an existing "seas"
model.
static()
, to return the 'static' call, with automated
procedures substituted by their choices.
series()
, for universal X-13 table series import.
out()
, to view the full X-13 diagnostical output.
# Basic call m <- seas(AirPassengers) summary(m) # Graphical user interface ## Not run: view(m) ## End(Not run) # invoke X-13ARIMA-SEATS options as 'spec.argument' through the ... argument # (consult the X-13ARIMA-SEATS manual for many more options and the list of # R examples for more examples) seas(AirPassengers, regression.aictest = c("td")) # no easter testing seas(AirPassengers, force.type = "denton") # force equality of annual values seas(AirPassengers, x11 = "") # use x11, overrides the 'seats' spec # 'spec.argument' combinations can also be supplied as a named list, which is # useful for programming seas(AirPassengers, list = list(regression.aictest = c("td"), outlier = NULL)) # constructing the list step by step ll <- list() ll[["x"]] <- AirPassengers ll[["regression.aictest"]] <- "td" ll["outlier"] <- list(NULL) # assigning NULL to a list using single brackets seas(list = ll) # options can be entered as vectors seas(AirPassengers, regression.variables = c("td1coef", "easter[1]")) seas(AirPassengers, arima.model = c(0, 1, 1, 0, 1, 1)) seas(AirPassengers, arima.model = "(0 1 1)(0 1 1)") # equivalent # turn off the automatic procedures seas(AirPassengers, regression.variables = c("td1coef", "easter[1]", "ao1951.May"), arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log") # static replication of 'm <- seas(AirPassengers)' static(m) # this also tests the equivalence of the static call static(m, test = FALSE) # no testing (much faster) static(m, coef = TRUE) # also fixes the coefficients # updating an existing model update(m, x11 = "") # specific extractor functions final(m) predict(m) # equivalent original(m) resid(m) coef(m) fivebestmdl(m) spc(m) # the .spc input file to X-13 (for debugging) # universal extractor function for any X-13ARIMA-SEATS output (see ?series) series(m, "forecast.forecasts") # user defined regressors (see ?genhol for more examples) # a temporary level shift in R base tls <- ts(0, start = 1949, end = 1965, freq = 12) window(tls, start = c(1955, 1), end = c(1957, 12)) <- 1 seas(AirPassengers, xreg = tls, outlier = NULL) # identical to a X-13ARIMA-SEATS specification of the the level shift seas(AirPassengers, regression.variables = c("tl1955.01-1957.12"), outlier = NULL) # forecasting an annual series without seasonal adjustment m <- seas(airmiles, seats = NULL, regression.aictest = NULL) series(m, "forecast.forecasts") # NA handling AirPassengersNA <- window(AirPassengers, end = 1962, extend = TRUE) final(seas(AirPassengersNA, na.action = na.omit)) # no NA in final series final(seas(AirPassengersNA, na.action = na.exclude)) # NA in final series # final(seas(AirPassengersNA, na.action = na.fail)) # fails # NA handling by X-13 (works with internal NAs) AirPassengersNA[20] <- NA final(seas(AirPassengersNA, na.action = na.x13)) ## performing 'composite' adjustment seas( cbind(mdeaths, fdeaths), composite = list(), series.comptype = "add" )
# Basic call m <- seas(AirPassengers) summary(m) # Graphical user interface ## Not run: view(m) ## End(Not run) # invoke X-13ARIMA-SEATS options as 'spec.argument' through the ... argument # (consult the X-13ARIMA-SEATS manual for many more options and the list of # R examples for more examples) seas(AirPassengers, regression.aictest = c("td")) # no easter testing seas(AirPassengers, force.type = "denton") # force equality of annual values seas(AirPassengers, x11 = "") # use x11, overrides the 'seats' spec # 'spec.argument' combinations can also be supplied as a named list, which is # useful for programming seas(AirPassengers, list = list(regression.aictest = c("td"), outlier = NULL)) # constructing the list step by step ll <- list() ll[["x"]] <- AirPassengers ll[["regression.aictest"]] <- "td" ll["outlier"] <- list(NULL) # assigning NULL to a list using single brackets seas(list = ll) # options can be entered as vectors seas(AirPassengers, regression.variables = c("td1coef", "easter[1]")) seas(AirPassengers, arima.model = c(0, 1, 1, 0, 1, 1)) seas(AirPassengers, arima.model = "(0 1 1)(0 1 1)") # equivalent # turn off the automatic procedures seas(AirPassengers, regression.variables = c("td1coef", "easter[1]", "ao1951.May"), arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL, outlier = NULL, transform.function = "log") # static replication of 'm <- seas(AirPassengers)' static(m) # this also tests the equivalence of the static call static(m, test = FALSE) # no testing (much faster) static(m, coef = TRUE) # also fixes the coefficients # updating an existing model update(m, x11 = "") # specific extractor functions final(m) predict(m) # equivalent original(m) resid(m) coef(m) fivebestmdl(m) spc(m) # the .spc input file to X-13 (for debugging) # universal extractor function for any X-13ARIMA-SEATS output (see ?series) series(m, "forecast.forecasts") # user defined regressors (see ?genhol for more examples) # a temporary level shift in R base tls <- ts(0, start = 1949, end = 1965, freq = 12) window(tls, start = c(1955, 1), end = c(1957, 12)) <- 1 seas(AirPassengers, xreg = tls, outlier = NULL) # identical to a X-13ARIMA-SEATS specification of the the level shift seas(AirPassengers, regression.variables = c("tl1955.01-1957.12"), outlier = NULL) # forecasting an annual series without seasonal adjustment m <- seas(airmiles, seats = NULL, regression.aictest = NULL) series(m, "forecast.forecasts") # NA handling AirPassengersNA <- window(AirPassengers, end = 1962, extend = TRUE) final(seas(AirPassengersNA, na.action = na.omit)) # no NA in final series final(seas(AirPassengersNA, na.action = na.exclude)) # NA in final series # final(seas(AirPassengersNA, na.action = na.fail)) # fails # NA handling by X-13 (works with internal NAs) AirPassengersNA[20] <- NA final(seas(AirPassengersNA, na.action = na.x13)) ## performing 'composite' adjustment seas( cbind(mdeaths, fdeaths), composite = list(), series.comptype = "add" )
The series
function imports all tables that can be saved in
X-13ARIMA-SEATS.
series(x, series, reeval = TRUE, verbose = TRUE)
series(x, series, reeval = TRUE, verbose = TRUE)
x |
an object of class |
series |
character vector, short or long names of an X-13ARIMA-SEATS table. If a long name is specified, it needs to be combined with the spec name and separated by a dot (it is not unique, otherwise. See list below.). More than one series can be specified (see examples). |
reeval |
logical, if |
verbose |
logical, if |
If the save argument is not specified in the model call, series
re-evaluates the call with the corresponding specs enabled (also returning a
message). Note that re-evaluation doubles the overall computational time. If
you want to accelerate the procedure, you have to be explicit about the
output in the model call (see examples).
List of all importable tables from X-13ARIMA-SEATS:
spec | long name | short name | description |
check | check.acf | acf | autocorrelation function of residuals with standard errors and Ljung-Box Q-statistics computed through each lag |
check | check.acfsquared | ac2 | autocorrelation function of squared residuals with standard errors and Ljung-Box Q-statistics computed through each lag |
check | check.pacf | pcf | partial autocorrelation function of residuals with standard errors |
composite | composite.adjcompositesrs | b1 | aggregated time series data, prior adjusted, with associated dates |
composite | composite.calendaradjcomposite | cac | aggregated time series data, adjusted for regARIMA calendar effects. |
composite | composite.compositesrs | cms | aggregated time series data, with associated dates |
composite | composite.indadjsatot | iaa | final indirect seasonally adjusted series, with yearly totals adjusted to match the original series |
composite | composite.indadjustfac | iaf | final combined adjustment factors for the indirect seasonal adjustment |
composite | composite.indaoutlier | iao | final indirect AO outliers |
composite | composite.indcalendar | ica | final calendar factors for the indirect seasonal adjustment |
composite | composite.indirregular | iir | final irregular component for the indirect adjustment |
composite | composite.indlevelshift | ils | final indirect LS outliers |
composite | composite.indmcdmovavg | if1 | MCD moving average of the final indirect seasonally adjusted series |
composite | composite.indmodirr | ie3 | irregular component modified for extreme values from the indirect seasonal adjustment |
composite | composite.indmodoriginal | ie1 | original series modified for extreme values from the indirect seasonal adjustment |
composite | composite.indmodsadj | ie2 | seasonally adjusted series modified for extreme values from the indirect seasonal adjustment |
composite | composite.indreplacsi | id9 | final replacement values for extreme SI-ratios (differences) for the indirect adjustment |
composite | composite.indrevsachanges | i6a | percent changes for indirect seasonally adjusted series with revised yearly totals |
composite | composite.indrndsachanges | i6r | percent changes (differences) in the rounded indirect seasonally adjusted series |
composite | composite.indrobustsa | iee | final indirect seasonally adjusted series modified for extreme values |
composite | composite.indsachanges | ie6 | percent changes (differences) in the indirect seasonally adjusted series |
composite | composite.indsadjround | irn | rounded indirect seasonally adjusted series |
composite | composite.indseasadj | isa | final indirect seasonally adjusted series |
composite | composite.indseasonal | isf | final seasonal factors for the indirect seasonal adjustment |
composite | composite.indseasonaldiff | isd | final seasonal difference for the indirect seasonal adjustment (only for pseudo-additive seasonal adjustment) |
composite | composite.indtotaladjustment | ita | total indirect adjustment factors (only produced if the original series contains values that are <= 0) |
composite | composite.indtrend | itn | final trend-cycle for the indirect adjustment |
composite | composite.indtrendchanges | ie7 | percent changes (differences) in the indirect final trend component |
composite | composite.indunmodsi | id8 | final unmodified SI-ratios (differences) for the indirect adjustment |
composite | composite.origchanges | ie5 | percent changes (differences) in the original series |
composite | composite.outlieradjcomposite | oac | aggregated time series data, adjusted for outliers. |
composite | composite.prioradjcomposite | ia3 | composite series adjusted for user-defined prior adjustments applied at the component level |
estimate | estimate.armacmatrix | acm | correlation matrix of ARMA parameter estimates if used with the print argument; covariance matrix of same if used with the save argument |
estimate | estimate.iterations | itr | detailed output for estimation iterations, including log-likelihood values and parameters, and counts of function evaluations and iterations |
estimate | estimate.regcmatrix | rcm | correlation matrix of regression parameter estimates if used with the print argument; covariance matrix of same if used with the save argument |
estimate | estimate.regressioneffects | ref | Xb matrix of regression variables multiplied by the vector of estimated regression coefficients |
estimate | estimate.residuals | rsd | model residuals with associated dates or observation numbers |
estimate | estimate.roots | rts | roots of the autoregressive and moving average operators in the estimated model |
force | force.forcefactor | ffc | factors applied to get seasonally adjusted series with constrained yearly totals (if type = regress or type = denton) |
force | force.revsachanges | e6a | percent changes (differences) in seasonally adjusted series with revised yearly totals |
force | force.revsachangespct | p6a | percent changes in seasonally adjusted series with forced yearly totals |
force | force.rndsachanges | e6r | percent changes (differences) in rounded seasonally adjusted series |
force | force.rndsachangespct | p6r | percent changes in rounded seasonally adjusted series |
force | force.saround | rnd | rounded final seasonally adjusted series (if round = yes) or the rounded final seasonally adjusted series with constrained yearly totals (if type = regress or type = denton) |
force | force.seasadjtot | saa | final seasonally adjusted series with constrained yearly totals (if type = regress or type = denton) |
forecast | forecast.backcasts | bct | point backcasts on the original scale, along with upper and lower prediction interval limits |
forecast | forecast.forecasts | fct | point forecasts on the original scale, along with upper and lower prediction interval limits |
forecast | forecast.transformed | ftr | forecasts on the transformed scale, with corresponding forecast standard errors |
forecast | forecast.transformedbcst | btr | backcasts on the transformed scale, with corresponding forecast standard errors |
forecast | forecast.variances | fvr | forecast error variances on the transformed scale, showing the contributions of the error assuming the model is completely known (stochastic variance) and the error due to estimating any regression parameters (error in estimating AR and MA parameters is ignored) |
history | history.armahistory | amh | history of estimated AR and MA coefficients from the regARIMA model |
history | history.chngestimates | che | concurrent and most recent estimate of the month-tomonth (or quarter-to-quarter) changes in the seasonally adjusted data |
history | history.chngrevisions | chr | revision from concurrent to most recent estimate of the month-to-month (or quarter-to-quarter) changes in the seasonally adjusted data |
history | history.fcsterrors | fce | revision history of the accumulated sum of squared forecast errors |
history | history.fcsthistory | fch | listing of the forecast and forecast errors used to generate accumulated sum of squared forecast errors |
history | history.indsaestimates | iae | concurrent and most recent estimate of the indirect seasonally adjusted data |
history | history.indsarevisions | iar | revision from concurrent to most recent estimate of the indirect seasonally adjusted series |
history | history.lkhdhistory | lkh | history of AICC and likelihood values |
history | history.outlierhistory | rot | record of outliers removed and kept for the revisions history (printed only if automatic outlier identification is used) |
history | history.saestimates | sae | concurrent and most recent estimate of the seasonally adjusted data |
history | history.sarevisions | sar | revision from concurrent to most recent estimate of the seasonally adjusted data |
history | history.seatsmdlhistory | smh | SEATS ARIMA model history |
history | history.sfestimates | sfe | concurrent and most recent estimate of the seasonal factors and projected seasonal factors |
history | history.sfilterhistory | sfh | record of seasonal filter selection for each observation in the revisions history (printed only if automatic seasonal filter selection is used) |
history | history.sfrevisions | sfr | revision from concurrent to most recent estimate of the seasonal factor, as well as projected seasonal factors |
history | history.tdhistory | tdh | history of estimated trading day regression coefficients from the regARIMA model |
history | history.trendchngestimates | tce | concurrent and most recent estimate of the month-tomonth (or quarter-to-quarter) changes in the trend component |
history | history.trendchngrevisions | tcr | revision from concurrent to most recent estimate of the month-to-month (or quarter-to-quarter) changes in the trend component |
history | history.trendestimates | tre | concurrent and most recent estimate of the trend component |
history | history.trendrevisions | trr | revision from concurrent to most recent estimate of the trend component |
identify | identify.acf | iac | sample autocorrelation function(s), with standard errors and Ljung-Box Q-statistics for each lag |
identify | identify.pacf | ipc | sample partial autocorrelation function(s) with standard errors for each lag |
outlier | outlier.finaltests | fts | t-statistics for every time point and outlier type generated during the final outlier detection iteration (not saved when automdl/pickmdl is used) |
outlier | outlier.iterations | oit | detailed results for each iteration of outlier detection including outliers detected, outliers deleted, model parameter estimates, and robust and nonrobust estimates of the residual standard deviation |
regression | regression.aoutlier | ao | regARIMA additive (or point) outlier factors (table A8.AO) |
regression | regression.holiday | hol | regARIMA holiday factors (table A7) |
regression | regression.levelshift | ls | regARIMA level shift, temporary level shift and ramp outlier factors (table A8.LS) |
regression | regression.outlier | otl | combined regARIMA outlier factors (table A8) |
regression | regression.regressionmatrix | rmx | values of regression variables with associated dates |
regression | regression.regseasonal | a10 | regARIMA user-defined seasonal factors (table A10) |
regression | regression.seasonaloutlier | so | regARIMA seasonal outlier factors (table A8.SO) |
regression | regression.temporarychange | tc | regARIMA temporary change outlier factors (table A8.TC) |
regression | regression.tradingday | td | regARIMA trading day factors (table A6) |
regression | regression.transitory | a13 | regARIMA transitory component factors from userdefined regressors (table A13) |
regression | regression.userdef | usr | factors from user-defined regression variables (table A9) |
seats | seats.adjustfac | s16 | final SEATS combined adjustment factors |
seats | seats.adjustfacpct | psa | combined adjustment factors, expressed as percentages if appropriate |
seats | seats.adjustmentratio | s18 | final SEATS adjustment ratio |
seats | seats.componentmodels | mdc | models for the components |
seats | seats.cycle | cyc | cycle component |
seats | seats.difforiginal | dor | fully differenced transformed original series |
seats | seats.diffseasonaladj | dsa | fully differenced transformed SEATS seasonal adjustment |
seats | seats.difftrend | dtr | fully differenced transformed SEATS trend |
seats | seats.filtersaconc | fac | concurrent finite seasonal adjustment filter |
seats | seats.filtersasym | faf | symmetric finite seasonal adjustment filter |
seats | seats.filtertrendconc | ftc | concurrent finite trend filter |
seats | seats.filtertrendsym | ftf | symmetric finite trend filter |
seats | seats.irregular | s13 | final SEATS irregular component |
seats | seats.irregularoutlieradj | se3 | final SEATS irregular component, outlier adjusted |
seats | seats.irregularpct | psi | final irregular component, expressed as percentages if appropriate |
seats | seats.longtermtrend | ltt | long term trend |
seats | seats.pseudoinnovsadj | pia | pseudo-innovations of the final SEATS seasonal adjustment |
seats | seats.pseudoinnovseasonal | pis | pseudo-innovations of the seasonal component |
seats | seats.pseudoinnovtransitory | pit | pseudo-innovations of the transitory component |
seats | seats.pseudoinnovtrend | pic | pseudo-innovations of the trend component |
seats | seats.seasadjconst | sec | final SEATS seasonal adjustment with constant term included |
seats | seats.seasonal | s10 | final SEATS seasonal component |
seats | seats.seasonaladj | s11 | final SEATS seasonal adjustment |
seats | seats.seasonaladjfcstdecomp | afd | forecast of the final SEATS seasonal adjustment |
seats | seats.seasonaladjoutlieradj | se2 | final SEATS seasonal adjustment, outlier adjusted |
seats | seats.seasonaladjse | ase | standard error of final seasonally adjusted series |
seats | seats.seasonalfcstdecomp | sfd | forecast of the seasonal component |
seats | seats.seasonalpct | pss | final seasonal factors, expressed as percentages if appropriate |
seats | seats.seasonalse | sse | standard error of final steasonal component |
seats | seats.seasonalsum | ssm | seasonal-period-length sums of final SEATS seasonal component |
seats | seats.seriesfcstdecomp | ofd | forecast of the series component |
seats | seats.squaredgainsaconc | gac | squared gain for finite concurrent seasonal adjustment filter |
seats | seats.squaredgainsasym | gaf | squared gain for finite symmetric seasonal adjustment filter |
seats | seats.squaredgaintrendconc | gtc | squared gain for finite concurrent trend filter |
seats | seats.squaredgaintrendsym | gtf | squared gain for finite symmetric trend filter |
seats | seats.timeshiftsaconc | tac | time shift for finite concurrent seasonal adjustment filter |
seats | seats.timeshifttrendconc | ttc | time shift for finite concurrent trend filter |
seats | seats.totaladjustment | sta | total adjustment factors for SEATS seasonal adjustment |
seats | seats.transitory | s14 | final SEATS transitory component |
seats | seats.transitoryfcstdecomp | yfd | forecast of the transitory component |
seats | seats.transitorypct | psc | final transitory component, expressed as percentages if appropriate |
seats | seats.transitoryse | cse | standard error of final transitory component |
seats | seats.trend | s12 | final SEATS trend component |
seats | seats.trendadjls | stl | level shift adjusted trend |
seats | seats.trendconst | stc | final SEATS trend component with constant term included |
seats | seats.trendfcstdecomp | tfd | forecast of the trend component |
seats | seats.trendse | tse | standard error of final trend component |
seats | seats.wkendfilter | wkf | end filters of the semi-infinite Wiener-Kolmogorov filter |
series | series.adjoriginal | b1 | original series, adjusted for prior effects and forecast extended |
series | series.calendaradjorig | a18 | original series adjusted for regARIMA calendar effects |
series | series.outlieradjorig | a19 | original series adjusted for regARIMA outliers |
series | series.seriesmvadj | mv | original series with missing values replaced by regARIMA estimates |
series | series.span | a1 | time series data, with associated dates (if the span argument is present, data are printed and/or saved only for the specified span) |
slidingspans | slidingspans.chngspans | chs | month-to-month (or quarter-to-quarter) changes from all sliding spans |
slidingspans | slidingspans.indchngspans | cis | indirect month-to-month (or quarter-to-quarter) changes from all sliding spans |
slidingspans | slidingspans.indsaspans | ais | indirect seasonally adjusted series from all sliding spans |
slidingspans | slidingspans.indsfspans | sis | indirect seasonal factors from all sliding spans |
slidingspans | slidingspans.indychngspans | yis | indirect year-to-year changes from all sliding spans |
slidingspans | slidingspans.sfspans | sfs | seasonal factors from all sliding spans |
slidingspans | slidingspans.tdspans | tds | trading day factors from all sliding spans |
slidingspans | slidingspans.ychngspans | ycs | year-to-year changes from all sliding spans |
spectrum | spectrum.speccomposite | is0 | spectral plot of first-differenced aggregate series |
spectrum | spectrum.specextresiduals | ser | spectrum of the extended residuals |
spectrum | spectrum.specindirr | is2 | spectral plot of outlier-modified irregular series from the indirect seasonal adjustment |
spectrum | spectrum.specindsa | is1 | spectral plot of the first-differenced indirect seasonally adjusted series |
spectrum | spectrum.specirr | sp2 | spectral plot of outlier-modified X-11 irregular series |
spectrum | spectrum.specorig | sp0 | spectral plot of the first-differenced original series |
spectrum | spectrum.specresidual | spr | spectral plot of the regARIMA model residuals |
spectrum | spectrum.specsa | sp1 | spectral plot of differenced, X-11 seasonally adjusted series (or of the logged seasonally adjusted series if mode = logadd or mode = mult) |
spectrum | spectrum.specseatsirr | s2s | spectrum of the final SEATS irregular |
spectrum | spectrum.specseatssa | s1s | spectrum of the differenced final SEATS seasonal adjustment |
spectrum | spectrum.spectukeycomposite | it0 | Tukey spectrum of the first-differenced aggregate series |
spectrum | spectrum.spectukeyextresiduals | ter | Tukey spectrum of the extended residuals |
spectrum | spectrum.spectukeyindirr | it2 | Tukey spectrum of the outlier-modified irregular series from the indirect seasonal adjustment |
spectrum | spectrum.spectukeyindsa | it1 | Tukey spectrum of the first-differenced indirect seasonally adjusted series |
spectrum | spectrum.spectukeyirr | st2 | Tukey spectrum of the outlier-modified X-11 irregular series |
spectrum | spectrum.spectukeyorig | st0 | Tukey spectrum of the first-differenced original series |
spectrum | spectrum.spectukeyresidual | str | Tukey spectrum of the regARIMA model residuals |
spectrum | spectrum.spectukeysa | st1 | Tukey spectrum of the differenced, X-11 seasonally adjusted series (or of the logged seasonally adjusted series if mode = logadd or mode = mult) |
spectrum | spectrum.spectukeyseatsirr | t2s | Tukey spectrum of the final SEATS irregular |
spectrum | spectrum.spectukeyseatssa | t1s | Tukey spectrum of the differenced final SEATS seasonal adjustment |
transform | transform.permprior | a2p | permanent prior adjustment factors, with associated dates |
transform | transform.permprioradjusted | a3p | prior adjusted series using only permanent prior factors, with associated dates |
transform | transform.permprioradjustedptd | a4p | prior adjusted series using only permanent prior factors and prior trading day adjustments, with associated dates |
transform | transform.prior | a2 | prior adjustment factors, with associated dates |
transform | transform.prioradjusted | a3 | prior adjusted series, with associated dates |
transform | transform.prioradjustedptd | a4d | prior adjusted series (including prior trading day adjustments), with associated dates |
transform | transform.seriesconstant | a1c | original series with value from the constant argument added to the series |
transform | transform.tempprior | a2t | temporary prior adjustment factors, with associated dates |
transform | transform.transformed | trn | prior adjusted and transformed data, with associated dates |
x11 | x11.adjoriginalc | c1 | original series modified for outliers, trading day and prior factors, C iteration |
x11 | x11.adjoriginald | d1 | original series modified for outliers, trading day and prior factors, D iteration |
x11 | x11.adjustdiff | fad | final adjustment difference (only for pseudo-additive seasonal adjustment) |
x11 | x11.adjustfac | d16 | combined seasonal and trading day factors |
x11 | x11.adjustfacpct | paf | combined adjustment factors, expressed as percentages if appropriate |
x11 | x11.adjustmentratio | e18 | final adjustment ratios (original series/seasonally adjusted series) |
x11 | x11.biasfactor | bcf | bias correction factors |
x11 | x11.calendar | d18 | combined holiday and trading day factors |
x11 | x11.calendaradjchanges | e8 | percent changes (differences) in original series adjusted for calendar effects |
x11 | x11.calendaradjchangespct | pe8 | percent changes in original series adjusted for calendar factors |
x11 | x11.combholiday | chl | combined holiday prior adjustment factors, A16 table |
x11 | x11.extreme | c20 | extreme values, C iteration |
x11 | x11.extremeb | b20 | extreme values, B iteration |
x11 | x11.irregular | d13 | final irregular component |
x11 | x11.irregularadjao | ira | final irregular component adjusted for point outliers |
x11 | x11.irregularb | b13 | irregular component, B iteration |
x11 | x11.irregularc | c13 | irregular component, C iteration |
x11 | x11.irregularpct | pir | final irregular component, expressed as percentages if appropriate |
x11 | x11.irrwt | c17 | final weights for the irregular component |
x11 | x11.irrwtb | b17 | preliminary weights for the irregular component |
x11 | x11.mcdmovavg | f1 | MCD moving average of the final seasonally adjusted series |
x11 | x11.modirregular | e3 | irregular component modified for zero-weighted extreme values |
x11 | x11.modoriginal | e1 | original series modified for zero-weighted extreme values |
x11 | x11.modseasadj | e2 | seasonally adjusted series modified for zero-weighted extreme values |
x11 | x11.modsic4 | c4 | modified SI-ratios (differences), C iteration |
x11 | x11.modsid4 | d4 | modified SI-ratios (differences), D iteration |
x11 | x11.origchanges | e5 | percent changes (differences) in original series |
x11 | x11.origchangespct | pe5 | percent changes in the original series |
x11 | x11.replacsi | d9 | final replacement values for extreme SI-ratios (differences), D iteration |
x11 | x11.replacsic9 | c9 | modified SI-ratios (differences), C iteration |
x11 | x11.robustsa | e11 | robust final seasonally adjusted series |
x11 | x11.sachanges | e6 | percent changes (differences) in seasonally adjusted series |
x11 | x11.sachangespct | pe6 | percent changes in seasonally adjusted series |
x11 | x11.seasadj | d11 | final seasonally adjusted series |
x11 | x11.seasadjb11 | b11 | seasonally adjusted series, B iteration |
x11 | x11.seasadjb6 | b6 | preliminary seasonally adjusted series, B iteration |
x11 | x11.seasadjc11 | c11 | seasonally adjusted series, C iteration |
x11 | x11.seasadjc6 | c6 | preliminary seasonally adjusted series, C iteration |
x11 | x11.seasadjconst | sac | final seasonally adjusted series with constant from transform spec included |
x11 | x11.seasadjd6 | d6 | preliminary seasonally adjusted series, D iteration |
x11 | x11.seasonal | d10 | final seasonal factors |
x11 | x11.seasonaladjregsea | ars | seasonal factors adjusted for user-defined seasonal regARIMA component |
x11 | x11.seasonalb10 | b10 | seasonal factors, B iteration |
x11 | x11.seasonalb5 | b5 | preliminary seasonal factors, B iteration |
x11 | x11.seasonalc10 | c10 | preliminary seasonal factors, C iteration |
x11 | x11.seasonalc5 | c5 | preliminary seasonal factors, C iteration |
x11 | x11.seasonald5 | d5 | preliminary seasonal factors, D iteration |
x11 | x11.seasonaldiff | fsd | final seasonal difference (only for pseudo-additive seasonal adjustment) |
x11 | x11.seasonalpct | psf | final seasonal factors, expressed as percentages if appropriate |
x11 | x11.sib3 | b3 | preliminary unmodified SI-ratios (differences) |
x11 | x11.sib8 | b8 | unmodified SI-ratios (differences) |
x11 | x11.tdadjorig | c19 | original series adjusted for final trading day |
x11 | x11.tdadjorigb | b19 | original series adjusted for preliminary trading day |
x11 | x11.totaladjustment | tad | total adjustment factors (only printed out if the original series contains values that are <= 0) |
x11 | x11.trend | d12 | final trend-cycle |
x11 | x11.trendadjls | tal | final trend-cycle adjusted for level shift outliers |
x11 | x11.trendb2 | b2 | preliminary trend-cycle, B iteration |
x11 | x11.trendb7 | b7 | preliminary trend-cycle, B iteration |
x11 | x11.trendc2 | c2 | preliminary trend-cycle, C iteration |
x11 | x11.trendc7 | c7 | preliminary trend-cycle, C iteration |
x11 | x11.trendchanges | e7 | percent changes (differences) in final trend component series |
x11 | x11.trendchangespct | pe7 | percent changes in final trend cycle |
x11 | x11.trendconst | tac | final trend component with constant from transform spec included |
x11 | x11.trendd2 | d2 | preliminary trend-cycle, D iteration |
x11 | x11.trendd7 | d7 | preliminary trend-cycle, D iteration |
x11 | x11.unmodsi | d8 | final unmodified SI-ratios (differences) |
x11 | x11.unmodsiox | d8b | final unmodified SI-ratios, with labels for outliers and extreme values |
x11 | x11.yrtotals | e4 | ratio of yearly totals of original and seasonally adjusted series |
x11regression | x11regression.calendar | xca | final calendar factors (trading day and holiday) |
x11regression | x11regression.calendarb | bxc | preliminary calendar factors |
x11regression | x11regression.combcalendar | xcc | final calendar factors from combined daily weights |
x11regression | x11regression.combcalendarb | bcc | preliminary calendar factors from combined daily weights |
x11regression | x11regression.combtradingday | c18 | final trading day factors from combined daily weights |
x11regression | x11regression.combtradingdayb | b18 | preliminary trading day factors from combined daily weights |
x11regression | x11regression.extremeval | c14 | irregulars excluded from the irregular regression, C iteration |
x11regression | x11regression.extremevalb | b14 | irregulars excluded from the irregular regression, B iteration |
x11regression | x11regression.holiday | xhl | final holiday factors |
x11regression | x11regression.holidayb | bxh | preliminary holiday factors |
x11regression | x11regression.outlieriter | xoi | detailed results for each iteration of outlier detection including outliers detected, outliers deleted, model parameter estimates, and robust and non-robust estimates of the residual standard deviation |
x11regression | x11regression.priortd | a4 | prior trading day weights and factors |
x11regression | x11regression.tradingday | c16 | final trading day factors and weights |
x11regression | x11regression.tradingdayb | b16 | preliminary trading day factors and weights |
x11regression | x11regression.x11reg | c15 | final irregular regression coefficients and diagnostics |
x11regression | x11regression.x11regb | b15 | preliminary irregular regression coefficients and diagnostics |
x11regression | x11regression.xregressioncmatrix | xrc | correlation matrix of irregular regression parameter estimates if used with the print argument; covariance matrix of same if used with the save argument |
x11regression | x11regression.xregressionmatrix | xrm | values of irregular regression variables with associated dates |
depending on the table, either an object of class "ts"
or
"data.frame"
.
Vignette with a more detailed description: http://www.seasonal.website/seasonal.html
Comprehensive list of R examples from the X-13ARIMA-SEATS manual: http://www.seasonal.website/examples.html
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
seas()
for the main function.
m <- seas(AirPassengers) series(m, "fct") # re-evaluate with the forecast spec activated # more than one series series(m, c("rsd", "fct")) m <- seas(AirPassengers, forecast.save = "fct") series(m, "fct") # no re-evaluation (much faster!) # using long names series(m, "forecast.forecasts") # history spec series(m, "history.trendestimates") series(m, "history.sfestimates") series(m, "history.saestimates") series(m, c("history.sfestimates", "history.trendestimates")) # slidingspans spec series(m, "slidingspans.sfspans") series(m, "slidingspans.ychngspans") # fundamental identities of seasonal adjustment # Y = T * I * (S * TD) all.equal(AirPassengers, series(m, "seats.trend") * series(m, "seats.irregular") * series(m, "seats.adjustfac")) # Y_sa = Y / (S * TD) all.equal(final(m), AirPassengers / series(m, "seats.adjustfac")) ### Some X-13ARIMA-SEATS functions can be replicated in R: # X-13ARIMA-SEATS spectrum plot(series(m, "spectrum.specorig")[,-1], t = "l") # R equivalent: spectrum from stats spectrum(diff(log(AirPassengers)), method = "ar") # X-13ARIMA-SEATS pacf x13.pacf <- series(m, "identify.pacf") plot(x13.pacf[,1], t = "h") lines(x13.pacf[,2]) lines(-x13.pacf[,2]) # R equivalent: pacf from stats pacf(AirPassengers, lag.max = 35) # use with composite (see vignette("multiple", "seasonal")) m_composite <- seas( cbind(mdeaths, fdeaths), composite = list(), series.comptype = "add" ) series(m_composite, "composite.indseasadj")
m <- seas(AirPassengers) series(m, "fct") # re-evaluate with the forecast spec activated # more than one series series(m, c("rsd", "fct")) m <- seas(AirPassengers, forecast.save = "fct") series(m, "fct") # no re-evaluation (much faster!) # using long names series(m, "forecast.forecasts") # history spec series(m, "history.trendestimates") series(m, "history.sfestimates") series(m, "history.saestimates") series(m, c("history.sfestimates", "history.trendestimates")) # slidingspans spec series(m, "slidingspans.sfspans") series(m, "slidingspans.ychngspans") # fundamental identities of seasonal adjustment # Y = T * I * (S * TD) all.equal(AirPassengers, series(m, "seats.trend") * series(m, "seats.irregular") * series(m, "seats.adjustfac")) # Y_sa = Y / (S * TD) all.equal(final(m), AirPassengers / series(m, "seats.adjustfac")) ### Some X-13ARIMA-SEATS functions can be replicated in R: # X-13ARIMA-SEATS spectrum plot(series(m, "spectrum.specorig")[,-1], t = "l") # R equivalent: spectrum from stats spectrum(diff(log(AirPassengers)), method = "ar") # X-13ARIMA-SEATS pacf x13.pacf <- series(m, "identify.pacf") plot(x13.pacf[,1], t = "h") lines(x13.pacf[,2]) lines(-x13.pacf[,2]) # R equivalent: pacf from stats pacf(AirPassengers, lag.max = 35) # use with composite (see vignette("multiple", "seasonal")) m_composite <- seas( cbind(mdeaths, fdeaths), composite = list(), series.comptype = "add" ) series(m_composite, "composite.indseasadj")
.spc
File ContentAccess the content of the .spc
file that governs the behavior of
X-13ARIMA-SEATS.
spc(x)
spc(x)
x |
object of class |
returns an object of class "spclist"
, essentially a list that
contains the information that is sent to X-13ARIMA-SEATS. The corresponding
print
method displays the content of the list as written to the
.spc
file.
Vignette with a more detailed description: http://www.seasonal.website/seasonal.html
Comprehensive list of R examples from the X-13ARIMA-SEATS manual: http://www.seasonal.website/examples.html
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
seas()
for the main function.
series()
, for universal X-13 output extraction.
plot.seas()
, for diagnostical plots.
out()
, for accessing the full output of X-13ARIMA-SEATS.
m <- seas(AirPassengers) spc(m)
m <- seas(AirPassengers) spc(m)
The data is used by several functions as a look-up table. Users
should consider the table in series()
or in the official manual.
An object of class "data.frame"
United States Census Bureau
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
In a 'static' call, the default automatic procedures in the model call are substituted by the choices they made.
static( x, coef = FALSE, x11.filter = FALSE, test = TRUE, fail = FALSE, evaluate = FALSE )
static( x, coef = FALSE, x11.filter = FALSE, test = TRUE, fail = FALSE, evaluate = FALSE )
x |
an object of class |
coef |
logical. If |
x11.filter |
logical. X-11 only. if |
test |
logical. By default the static call is executed and compared to
the input call. If the final series is not identical, a message is
returned. If |
fail |
logical. If |
evaluate |
logical. If |
If evaluate = TRUE
, the call is evaluated. The call can be copy/pasted
to a script and used for further manipulations or future evaluation of the
same model.
By default, the static call is tested. It is executed and compared to the input call. If the final series is not identical, a message is returned.
If coef = TRUE
, the coefficients are fixed as well. If
x11.filter = TRUE
, the X-11 moving averages are fixed as well.
Object of class "call"
. Or an object of class "seas"
if evaluate = TRUE
.
Vignette with a more detailed description: http://www.seasonal.website/seasonal.html
Comprehensive list of R examples from the X-13ARIMA-SEATS manual: http://www.seasonal.website/examples.html
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
stats::getCall()
to extract the actual call.
seas()
for the main function of seasonal.
m <- seas(AirPassengers) getCall(m) # default call static(m) # static call static(m, test = FALSE) # much faster static(m, evaluate = TRUE) # returns an object of class "seas" m <- seas(AirPassengers, x11 = "") static(m, x11.filter = TRUE) # also fixes the X-11 filter (with a warning) static(m, coef = TRUE) # also fixes the coefficients
m <- seas(AirPassengers) getCall(m) # default call static(m) # static call static(m, test = FALSE) # much faster static(m, evaluate = TRUE) # returns an object of class "seas" m <- seas(AirPassengers, x11 = "") static(m, x11.filter = TRUE) # also fixes the X-11 filter (with a warning) static(m, coef = TRUE) # also fixes the coefficients
Like the corresponding method for "lm"
objects, the method for
"seas"
objects returns the estimated coefficients, its standard errors,
z-statistics and corresponding (two-sided) p-values. Coefficients are returned
both for the exogenous regressors and the coefficients of the ARIMA model.
## S3 method for class 'seas' summary(object, stats = getOption("seas.stats"), ...) ## S3 method for class 'summary.seas' print( x, digits = max(3, getOption("digits") - 3), signif.stars = getOption("show.signif.stars"), ... )
## S3 method for class 'seas' summary(object, stats = getOption("seas.stats"), ...) ## S3 method for class 'summary.seas' print( x, digits = max(3, getOption("digits") - 3), signif.stars = getOption("show.signif.stars"), ... )
object |
an object of class |
stats |
(experimental) character vector, additional stat to be shown in the |
... |
further arguments passed to or from other methods. |
x |
an object of class |
digits |
the number of significant digits to use when printing. |
signif.stars |
logical. If |
The lower part of the output shows additional information on the estimation:
use of SEATS or X11
structure of the seasonal ARIMA model
number of observations
prior transformation
value of the information criterion (lower is better)
test for seasonality in the final series; null hypothesis: no
seasonality in final; signif. codes are shown if the null hypothesis is
rejected. QS statistics for more series (e.g., the original series) can be
extracted with qs()
.
test for residual autocorrelation; null hypothesis: no
autocorrelation in residuals; signif. codes are shown if the null hypothesis
is rejected. The test statistic is the result of
Box.test(resid(m), lag = 24, type = "Ljung")
test for normality of the residuals; null hypothesis: normal
distribution of the residuals; signif. codes are shown if the null
hypothesis is rejected. The test statistic is the result of
shapiro.test(resid(m))
summary.seas
returns a list containing the summary statistics
included in object
, and computes the following additional
statistics:
coefficients |
a named matrix containing coefficients, standard deviations, t-values and p-values |
transform |
character string with the type of initial transformation |
The print
method prints the summary output in a similar way as the
method for "lm"
.
m <- seas(AirPassengers) summary(m) ### user defined stats from the udg function # (experimental, see ?udg) # also show some M quality statistics for X11 in summary options(seas.stats = c("f3.m01", "f3.m02", "f3.m03", "f3.m04")) summary(seas(AirPassengers, x11 = "")) # this does not affect the SEATS output summary(seas(AirPassengers)) # reset to default options(seas.stats = NULL)
m <- seas(AirPassengers) summary(m) ### user defined stats from the udg function # (experimental, see ?udg) # also show some M quality statistics for X11 in summary options(seas.stats = c("f3.m01", "f3.m02", "f3.m03", "f3.m04")) summary(seas(AirPassengers, x11 = "")) # this does not affect the SEATS output summary(seas(AirPassengers)) # reset to default options(seas.stats = NULL)
Returns the transform function that has been applied.
transformfunction(x)
transformfunction(x)
x |
object of class |
Vignette with a more detailed description: http://www.seasonal.website/seasonal.html
Comprehensive list of R examples from the X-13ARIMA-SEATS manual: http://www.seasonal.website/examples.html
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
seas()
for the main function.
series()
, for universal X-13 output extraction.
plot.seas()
, for diagnostical plots.
out()
, for accessing the full output of X-13ARIMA-SEATS.
m <- seas(AirPassengers) transformfunction(m)
m <- seas(AirPassengers) transformfunction(m)
The udg
function provides access to a large number of diagnostical
statistics. The qs
function and the AIC
, BIC
and
logLik
methods are wrappers that use udg
to access some
specific diagnostical statistics.
udg(x, stats = NULL, simplify = TRUE, fail = TRUE) qs(x) ## S3 method for class 'seas' AIC(object, ...) ## S3 method for class 'seas' BIC(object, ...) ## S3 method for class 'seas' nobs(object, ...) ## S3 method for class 'seas' logLik(object, ...)
udg(x, stats = NULL, simplify = TRUE, fail = TRUE) qs(x) ## S3 method for class 'seas' AIC(object, ...) ## S3 method for class 'seas' BIC(object, ...) ## S3 method for class 'seas' nobs(object, ...) ## S3 method for class 'seas' logLik(object, ...)
x , object
|
an object of class |
stats |
character vector; if specified, only a subset of the available stats are returned. This speeds up the call, as only a subset needs to be type converted. Should be used for programming. |
simplify |
logical; should the result be simplified to a vector or matrix, if possible? |
fail |
logical; if |
... |
further arguments (not used) |
qs
returns the QS statistics for seasonality of input and
output series and the corresponding p-values.
AIC
, BIC
, nobs
and logLik
return the
corresponding statistics.
Vignette with a more detailed description: http://www.seasonal.website/seasonal.html
Comprehensive list of R examples from the X-13ARIMA-SEATS manual: http://www.seasonal.website/examples.html
Official X-13ARIMA-SEATS manual: https://www2.census.gov/software/x-13arima-seats/x13as/windows/documentation/docx13as.pdf
seas()
for the main function.
series()
, for universal X-13 output extraction.
plot.seas()
, for diagnostical plots.
out()
, for accessing the full output of X-13ARIMA-SEATS.
m <- seas(AirPassengers, x11 = "") qs(m) AIC(m) BIC(m) nobs(m) logLik(m) # a list with all entries from udg udg(m) # extracting a few selected stats from udg udg(m, c("f3.m02", "f3.m05", "qsori")) # returns a list udg(m, c("f3.m02", "f3.m05")) # returns a vector # faster than: udg(m)[c("f3.m01", "f3.m02", "qsori")]
m <- seas(AirPassengers, x11 = "") qs(m) AIC(m) BIC(m) nobs(m) logLik(m) # a list with all entries from udg udg(m) # extracting a few selected stats from udg udg(m, c("f3.m02", "f3.m05", "qsori")) # returns a list udg(m, c("f3.m02", "f3.m05")) # returns a vector # faster than: udg(m)[c("f3.m01", "f3.m02", "qsori")]
Thousands of Persons
Each time series is an object of class "ts"
.
U.S. Bureau of Labor Statistics, retrieved from FRED, Federal Reserve Bank of St. Louis; https://fred.stlouisfed.org/series/LNU03000000, December 14, 2016.
data(seasonal) unemp
data(seasonal) unemp
Method to update and re-evaluate an object of class "seas"
.
## S3 method for class 'seas' update(object, ..., evaluate = TRUE)
## S3 method for class 'seas' update(object, ..., evaluate = TRUE)
object |
an object of class |
... |
spec-argument options sent to X-13 (with the same
syntax as in |
evaluate |
logical. If |
Contrary to the default method of update()
, the "seas"
method uses the evaluated call, rather than the actual call for re-
evaluation. This means you can savely use it in other functions, which
is useful with lapply()
and friends (see examples.)
Object of class "seas"
. Or an object of class "call"
if evaluate = FALSE
.
seas()
for the main function.
static()
, to return the (optionally evaluated) static
call of a "seas"
object.
# updating the call m <- seas(AirPassengers) update(m, x11 = "") update(m, x = sqrt(AirPassengers), x11 = "") # 'update' can be also used with lapply (or mapply) # a list of time series dta <- list(fdeaths = fdeaths, mdeaths = mdeaths) # use 'seas' via lapply ll <- lapply(dta, seas, x11 = "") # use 'update' via lapply lapply(ll, update, arima.model = c(0, 1, 1, 0, 1, 1))
# updating the call m <- seas(AirPassengers) update(m, x11 = "") update(m, x = sqrt(AirPassengers), x11 = "") # 'update' can be also used with lapply (or mapply) # a list of time series dta <- list(fdeaths = fdeaths, mdeaths = mdeaths) # use 'seas' via lapply ll <- lapply(dta, seas, x11 = "") # use 'update' via lapply lapply(ll, update, arima.model = c(0, 1, 1, 0, 1, 1))
Interactively modify a "seas"
object. The goal of view
is
to summarize all relevant options, plots and statistics of a
seasonal adjustment model. The view
function in the seasonal
package imports the identical seasonalview::view()
function from
the seasonalview package, so there is no need to explicitly load the
seasonalview package.
view(x = NULL, story = NULL, quiet = TRUE, ...)
view(x = NULL, story = NULL, quiet = TRUE, ...)
x |
an object of class |
story |
character, local file path or URL to an |
quiet |
logical, if |
... |
arguments passed to |
Frequently used options can be modified using the drop down selectors in the upper left box. Each change will result in a re-estimation of the seasonal adjustment model. The R-call, the X-13 call, the graphical output and the summary are updated accordingly.
Alternatively, the R call can be modified manually in the lower left box.
Click 'Run Call' to re-estimate the model and to adjust the option selectors,
the graphical output, and the summary. With the 'To console' button,
the GUI is closed and the call is imported to R. The 'Static' button
substitutes automatic procedures by the automatically chosen
spec-argument options, in the same way as the static()
function.
If you are familiar with the X-13 spec syntax, you can modify the X-13 call, with the same consequences as when modifying the R call.
The lower right panel shows the summary, as described in the help page of
summary.seas()
. The 'X-13 output' button opens the complete
output of X-13 in a separate tab or window.
If you have the x13story package installed (not yet on CRAN, see references),
you can call the function with the story
argument. This will render
an R Markdown document and produce a story on seasonal adjustment that
can be manipulated interactively.
view
returns an object of class "seas"
, the modified
model; or NULL
, if the story
argument is supplied.
Seasonal vignette with a more detailed description: http://www.seasonal.website/seasonal.html
Development version of the x13story package: https://github.com/christophsax/x13story
## Not run: m <- seas(AirPassengers) view(m) # store the model after closing the GUI, for further processing in R m.upd <- view(m) ## End(Not run)
## Not run: m <- seas(AirPassengers) view(m) # store the model after closing the GUI, for further processing in R m.upd <- view(m) ## End(Not run)