# Create a calendar with rjd3toolkit
# Define a national calendar
<- national_calendar(days = list(
frenchCalendar fixed_day(7, 14), # Bastille Day
fixed_day(5, 8, validity = list(start = "1982-05-08")), # Victory Day
special_day("NEWYEAR"),
special_day("CHRISTMAS"),
special_day("MAYDAY"),
special_day("EASTERMONDAY"),
special_day("ASCENSION"),
special_day("WHITMONDAY"),
special_day("ASSUMPTION"),
special_day("ALLSAINTSDAY"),
special_day("ARMISTICE")
))# Generrate calendar regressors
<- holidays(
q calendar = frenchCalendar,
start = "1968-01-01",
length = length(df_daily$births),
type = "All",
nonworking = 7L
)
# Argument type = All : taking all holidays into account
# Argument type = Skip : taking into account only the holidays falling on a week day
SA of high-frequency data
In this chapter
The sections below provide guidance on seasonal adjustment of infra-monthly, or high-frequency (HF), time-series data with JDemetra+ tailored algorithms.
Currently available topics:
description of HF data specificities
R functions for pre-treatment, extended X-11 and extended Seats
Up coming content:
Graphical User Interface 3.x functionalities for HF data
STL functions
State space framework
Data specificities
HF data often display multiple seasonal patterns with potentially non-integer periodicities which cannot be modeled with classical SA algorithms. JD+ provides tailored versions of these algorithms.
Data | Day | Week | Month | Quarter | Year |
---|---|---|---|---|---|
quarterly | 4 | ||||
monthly | 3 | 12 | |||
weekly | 4.3481 | 13.0443 | 52.1775 | ||
daily | 7 | 30.4368 | 91.3106 | 365.2425 | |
hourly | 24 | 168 | 730.485 | 2191.4550 | 8765.82 |
Tailored algorithms in JDemetra+
Col1 | Algorithm | GUI v 3.x | R package |
---|---|---|---|
Pre-treatment | Extended Airline Model | ✔️ | rjd3highfreq |
Decomposition | Extended SEATS Extended Airline Model | ✔️ | rjd3highfreq |
Extended X-11 | ✔️ | rjd3x11plus | |
Extended STL | ✖ | rjd3stl | |
One-Step | SSF Framework | ✖ | rjd3sts |
SA algorithms extended for high-frequency data
All algorithms are available via an R package and will be available in GUI (in target v 3.x version)
Extended Airline estimation, reg-Arima like (
rjd3highfreq
and GUI )Extended Airline Decomposition, Seats like (
rjd3highfreq
and GUI )MX12+ (
rjd3x11plus
, GUI upcoming)MSTL+ (
rjd3stl
and in GUI)MSTS (
rjd3sts
, GUI upcoming)
Data frequencies and seasonal patterns
In the Graphical User Interface (display constraints)
Input data: daily, weekly
Seasonal patterns: weekly (
In corresponding R packages:
no constraint on data input as no TS structure (numeric vector)
any seasonal patters, positive numbers
Unobserved Components
Raw series decomposition
Multiple seasonal patterns
HF data often contain multiple seasonal patterns. For example, daily economic time series often display strong infra-weekly and infra-yearly seasonality. An infra-monthly seasonal pattern may also be present, but its strength is usually less pronounced in practice. In theory, the full decomposition of the seasonal component in daily data is given by:
The decomposition is done iteratively periodicity by periodicity starting with the smallest one (highest frequency) as:
highest frequencies usually display the biggest and most stable variations
cycles of highest frequencies can mix up with lower ones
Identifying seasonal patterns
JDemetra+ provides the Canova-Hansen test in the rjd3toolkit package.
Pre-adjustment
In classical X13-ARIMA and TRAMO-SEATS, a pre-adjustment step is performed to remove deterministic effects, such as outliers and calendar effects, with a Reg-Arima model. In the extended version for HF data, it is also the case with an extended Airline model.
A general Reg-ARIMA model is written as follows:
These models contain seasonal backshift operators
For HF data, the potentially non-integer periodicity
Taylor series development around
Approximation of
Example for a daily series displaying infra-weekly (
with
Calendar correction
Calendar regressors can be defined with the rjd3toolkit package and added to pre-treatment function as a matrix.
Outliers and intervention variables
Outliers detection is available in the pre-treatment function. Detected outliers are AO, LS and WO. Critical value can be computed by the algorithm or user-defined.
Linearization
Example using rjd3highfreq::fractionalAirlineEstimation function:
<- rjd3highfreq::fractionalAirlineEstimation(y_raw,
pre_adjustment x = q, # q = daily calendar regressors
periods = c(7, 365.25),
ndiff = 2, ar = FALSE, mean = FALSE,
outliers = c("ao", "ls", "wo"),
criticalValue = 0, # computed in the algorithm
precision = 1e-9, approximateHessian = TRUE
)
“pre_adjustment” R object is a list of lists in which the user can retrieve input series, parameters and output series. For more details see chapter on R packages and rjd3highfreq help pages R, where all parameters are listed.
Decomposition
Extended X-11
X-11 is the decomposition module of X-13-Arima, the linearized series from the pre-adjustment step is split into seasonal (
Modification of the first trend filter for removing seasonality
The first trend estimation is thanks to a generalization of the centred and symmetrical moving averages with an order equal to the periodicity
filter length
: smallest odd integer greater thanexamples:
, , ,central coefficients
(1/12,1/7, 1/365.25)end-point coefficients
example for
: ( and ) (we fall back on of the monthly caseexample for
: ( and )
Modification of seasonality extraction filters
Computation is done on a given period
Example
if
if
Modification of final trend estimation filter
As seasonality has been removed in the first step, there is no non-integer periodicity issue in the final trend estimation, but extended X-11 offers additional features vs classic X-11, in which final trend is estimated with Henderson filters and Musgrave asymmetrical surrogates. In extended X-11, a generalization of this method with local polynomial approximation is available.
Example of decomposition
Here the raw series is daily and displays two periodicities
# extraction of day-of-the-week pattern (dow)
<- rjd3x11plus::x11plus(y_linearized,
x11.dow period = 7, # DOW pattern
mul = TRUE,
trend.horizon = 9, # 1/2 Filter length : not too long vs p
trend.degree = 3, # Polynomial degree
trend.kernel = "Henderson", # Kernel function
trend.asymmetric = "CutAndNormalize", # Truncation method
seas.s0 = "S3X9", seas.s1 = "S3X9", # Seasonal filters
extreme.lsig = 1.5, extreme.usig = 2.5
# Sigma-limits
)
# extraction of day-of-the-week pattern (doy)
<- rjd3x11plus::x11plus(x11.dow$decomposition$sa, # previous sa
x11.doy period = 365.2425, # DOY pattern
mul = TRUE,
trend.horizon = 371, # 1/2 final filter length
trend.degree = 3,
trend.kernel = "Henderson",
trend.asymmetric = "CutAndNormalize",
seas.s0 = "S3X15", seas.s1 = "S3X5",
extreme.lsig = 1.5, extreme.usig = 2.5
)
Arima Model Based (AMB) Decomposition (Extended Seats)
Example
# extracting DOY pattern
<- rjd3highfreq::fractionalAirlineDecomposition(
amb.doy $decomposition$sa, # DOW-adjusted linearised data
amb.dowperiod = 365.2425, # DOY pattern
sn = FALSE, # Signal (SA)-noise decomposition
stde = FALSE, # Calculate standard deviations
nbcasts = 0, nfcasts = 0
# Numbers of back- and forecasts )
Summary of the process
For the time being, seasonal adjustment processing in rjd3highfreq cannot be encompassed by one function like for lower frequency, e.g rjd3x13::x13(y_raw)
The user has to run the steps one by one, here is an example with
computation of the linearized series
computation of the calendar corrected series
computation of
by decomposition of the linearized seriescomputation of
by decomposition of the seasonally adjusted series withfinally adjusted series
(if multiplicative model)
STL decomposition
Not currently available. Under construction.
State Space framework
Not currently available. Under construction.
Quality assessment
Residual seasonality
JDemetra+ provides the Canova-Hansen test in rjd3toolkit package which allows to check for any remaining seasonal pattern in the final SA data.