# Basic call
# \donttest{
m <- seas(AirPassengers)
summary(m)
# }
# Graphical user interface
if (FALSE) {
view(m)
}
# \donttest{
# 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"
)
# }
Run the code above in your browser using DataLab