statable Statistics for study and research

How do I remove the season from a series? (seasonal adjustment with X-13, R code to take along)

In brief

How do I remove the season from a monthly or quarterly series? X-13 does not run in the browser, so Statable does not calculate the seasonal adjustment itself. It creates the series as a CSV file and an R script to take along, run in R with the package seasonal.

How it works in Statable

  1. In the time series analysis open the section "Seasonal adjustment with X-13 (in R on your own computer)".
  2. Choose the method: SEATS (default) or X-11.
  3. "Save the series as CSV" and "Save the R script".
  4. Put both files in one folder and run the script in R. It writes a second CSV with the adjusted series.

Not the same as the classical decomposition

The decomposition in the time series analysis (trend, season, remainder) is not a seasonal adjustment with X-13 and is not called that. It stays as it is.

When it is offered

All steps in detail

  1. Choose the method: SEATS (default, the standard of the package seasonal) or X-11.
  2. "Save the series as CSV" and "Save the R script".
  3. Put both files in the same folder and run the script in R. For this R needs the package seasonal (with x13binary).
  4. The script writes a second CSV file with the adjusted series. It can be opened in Statable again.

The CSV file contains the point in time and the value, with a point as decimal sign, in UTF-8. With "View the R script" the script can be read before saving.

Warnings

Typical examples

For specialists

library(seasonal)
d <- read.csv("reihe.csv")
y <- ts(d$wert, start = c(1949, 1), frequency = 12)   # 12 bei Monaten, 4 bei Quartalen
m <- seas(y)                                           # bei X-11: seas(y, x11 = "")
summary(m)
plot(m)
bereinigt <- final(m)

As a check, seas(AirPassengers) gives the model (0 1 1)(0 1 1); the first adjusted values are 122.713, 124.766 and 125.073.

Related

Open in Statable