seasonal is an easy-to-use and full-featured R-interface to X-13ARIMA-SEATS, the seasonal adjustment software developed by the United States Census Bureau. The latest CRAN version of seasonal makes it much easier to adjust multiple time series.
seas is the core function of the seasonal package. By default,
the automatic procedures of X-13ARIMA-SEATS to perform a seasonal adjustment
that works well in most circumstances:
For a more detailed introduction, read our article in the Journal of Statistical Software.
In the latest CRAN version 1.8, it is now possible to seasonally adjust multiple series in a single call to
This is done by using the built-in batch mode of X-13. It removes the need for loops or
lapply() in such cases, and finally brings one missing feature of X-13 to seasonal – the composite spec.
Multiple adjustments can be performed by supplying multiple time series as an
library(seasonal) m <- seas(cbind(fdeaths, mdeaths), x11 = "") final(m)
This will perform two seasonal adjustments, one for
fdeaths and one for
mdeaths. X-13 spec-argument combinations can be applied in the usual way, such
x11 = "". Note that if entered that way, they will apply to both series. The vignette on multiple adjustments describes how to specify options for individual series.
X-13 ships with a batch mode that allows multiple adjustments in a single call
to X-13. This is now the default in seasonal (
multimode = "x13").
Alternatively, X-13 can be called for each series (
multimode = "R").
The results should be usually the same, but switching to
multimode = "R" may be useful for debugging:
seas(cbind(fdeaths, mdeaths), multimode = "x13") seas(cbind(fdeaths, mdeaths), multimode = "R")
multimode = "x13" is faster. The following comparison on a MacBook Pro shows
a modest speed gain, but bigger differences have been observed on other systems:
many <- rep(list(fdeaths), 100) system.time(seas(many, multimode = "x13")) # user system elapsed # 9.415 0.653 10.079 system.time(seas(many, multimode = "R")) # user system elapsed # 11.130 1.039 12.324
Support for the X-13 batch mode makes it finally possible to use the composite spec – the one feature of X-13 that was missing in seasonal. Sometimes, one has to decide whether seasonal adjustment should be performed on a granular level or on an aggregated level. The composite spec helps you to analyze the problem and to compare the direct and the indirect adjustment.
composite argument is a list with an X-13 specification that is applied on
the aggregated series. Specification works identical as for other series in
seas(), including the application of the defaults. If you provide an empty
list, the usual defaults of
seas() are used.
A minimal composite call looks like this:
seas( cbind(mdeaths, fdeaths), composite = list(), series.comptype = "add" )
You can verify that the composite refers to the total of
fdeaths by running:
ldeaths is the sum of
Patrick Schratz, Kirill Müllergfortran support for R on macOS
Patrick SchratzSeasonal Adjustment of Multiple Series
Christoph SaxDynamic build matrix in GitHub Actions
Kirill MüllerSetting up a load-balanced Jitsi Meet instance
Patrick SchratzDevOps Expert (f/m/d, 60-100%)
cynkra teamMaintaining multiple identities with Git
Kirill MüllerRelational data models in R
Angel D'az, Kirill Müllertempdisagg: converting quarterly time series to daily
Christoph Saxtsbox 0.2: supporting additional time series classes
Christoph SaxDevOps System Engineer (40-60%)
cynkra teamIntroducing dm: easy juggling of tables and relations
Balthasar Sagertsbox 0.1: class-agnostic time series
Christoph SaxData Scientist/Engineer (40-100%)
cynkra teamTime series of the world, unite!
Christoph SaxDone “Establishing DBI”!?