Ketty Attal-ToubertDominique Ladiray
Régina Soares
Specifications for TD&MH regressorsSA User’s Group – Luxembourg, April 2013
Luxembourg, April 2013Specifications for TD&MH Regressors
Outline
› A reminder–Basic models for TD effect detection and correction
–Why should we use contrasts?
› A very general model taking into account National calendars
› Specifications for TD effects› Moving holiday effects
–Examples: Easter, Ramadan
› Specifications for MH effects–Constant and linear models
Luxembourg, April 2013Specifications for TD&MH Regressors
Basic models for TD effects
› Fixed TD effect
› We take contrasts to avoid some problems (stability, saisonnality, global effect equal to 0)
› The Weekday model
titi
it NX
7
1
tttiti
it LYNNX
7
6
1
176
7
15432176 2
50 et
i
ii
tttt
i
iitt LYNNNX
76
5
11 2
5
Luxembourg, April 2013Specifications for TD&MH Regressors
Why should we use contrasts?
› Nit is seasonal (always more Mondays in January than in February)
› But in a 400-year cycle of the Gregorian calendar, there are the same number of Monday, Tuesday … per month.
SAt
SAit
mmiSA
ymSA
ymi
St
Sit
SAt
SAit
St
SAt
Sit
SAittit
NN
nnNN
NNNN
NNNNNN
7
,7,),(,7),(,
77
777
)()(
)()(
)()(
Luxembourg, April 2013Specifications for TD&MH Regressors
Spectrum of the Weekday Series
Luxembourg, April 2013Specifications for TD&MH Regressors
Spectrum of the centered Weekday Series
Luxembourg, April 2013Specifications for TD&MH Regressors
Why should we use contrasts?
› Open question: is there an easier way to seasonally adjust the regressors? Annual difference?
› Contrasts increase the stability of the model: (-1, 0 or 1) instead of (0 or 1)
–This is a very serious problem
› You assure that the sum of the coefficients is equal to 0: the reference day coefficients is derived as minus the sum of the 6 others.
Luxembourg, April 2013Specifications for TD&MH Regressors
A more general model
› We specify a 15-variable model introducing a difference between Monday off and Monday in.
› Where the Nit are the # of Mondays in, Tuesdays in, …, Sundays in, Mondays off, Tuesdays off, …., and Sundays off.
› Then you make hypothesis on the days.
)( avec 14
1
iititi
it LYNTD
Luxembourg, April 2013Specifications for TD&MH Regressors
An example
› All days off are equivalent to a Sunday.
› And we get the model
› But the contrasts do not remove seasonality anymore.–You have to SA the regressors removing the long-term
monthly averages you can compute using the 400-year periodicity of the Gregorian calendar.
1413987 ...
ti
ititi
it LYXXTD
14
7
6
1 8
1
Luxembourg, April 2013Specifications for TD&MH Regressors
Specifications (1)
› You must precise the reference day, usually the second day of the week-end: Tunisia vs Algeria. This day will be the core of the “reference group” for the contrasts.
› You have to specify which group a day belongs to–Monday in, Tuesday in, in Group 1
–Wednesday in, Thursday in, Friday in, in Group 2
–All other days (in or off) in Group 0 which will be the reference group
–In this case, you have 2 regressors: Group1 vs Group0 and Group2 vs Group0
Luxembourg, April 2013Specifications for TD&MH Regressors
Specifications (2)
› For each “fixed” or moving holiday, you have to specify–The date (day, month) or the calendar
–The type of holiday (fixed or moving)
–The “starting year”
–The “ending year”
–The weight
–If the holiday can be “reported” when it falls during a “week-end” (Canada, Serbia etc.)
› Warning: a moving holiday can fall on the same date than a “fixed” holiday. Avoid duplicates.
–Usually moving holidays are religious holidays which are considered more important.
Luxembourg, April 2013Specifications for TD&MH Regressors
Moving Holidays
› They are expressed in another calendar and therefore, they “move” in the Gregorian calendar
› Easter is linked to a lunar calendar–Easter Sunday is the first Sunday after the first full moon
after vernal equinox.
› BUT, its date is expressed:–In the Gregorian Calendar for Catholic and Protestant
churches
–In the Julian Calendar for Orthodox churches (Greece, Romania, Bulgaria, Cyprus etc.)
Luxembourg, April 2013Specifications for TD&MH Regressors
An algorithm to compute Easter dates
Luxembourg, April 2013Specifications for TD&MH Regressors
Holidays linked to Easter
› Easter is periodic of period 5 700 000 years in the Gregorian calendar.
Easter Monday Easter+1Shrove Monday Easter-48Shrove Tuesday Easter-47Ash Wednesday Easter-46Maundy Thursday Easter-3Good Friday Easter-2Ascension Day Easter+39 (Thursday)Pentecost Easter+50 (Monday)Corpus Christi Easter+60 (Thursday)
Luxembourg, April 2013Specifications for TD&MH Regressors
The Islamic Calendar (1)
› This is a Lunar calendar.› A year contains 12 months of 29 or 30 days. The length
of the year is 354 or 355 days (a day is added to the last month).
› The names of the 12 months that comprise the Islamic year are:
Luxembourg, April 2013Specifications for TD&MH Regressors
The Islamic Calendar (2)
› Each month starts when the lunar crescent is first seen (by a human being) after a new moon. And the length of a month can change across years.
› Thus, the Islamic calendar is not purely deterministic and can slightly varie from a country to another.
› Some approximative algorithms exist, useful to forecast the calendar.
› For example, the length of the year follows a 30-year cycle where « leap years » are the years {2, 5, 7, 10, 13, 16, 18, 21, 24, 26, or 29}
Luxembourg, April 2013Specifications for TD&MH Regressors
Important dates
› Ras El Am is the first day of the year› The Islamic calendar is periodic with period 5 400 000
years in the Gregorian calendar› Measuring the impact of the Ramadan
Ras El Am Ras El Am +0Achoura Ras El Am +9Mawlid Ras El Am +70Ramadan Ras El Am +236Aid El Fitr Ras El Am +265Aid El Adha Ras El Am + 334
Luxembourg, April 2013Specifications for TD&MH Regressors
A General Constant Effect Model
› The regressor for month m is the “% of days in the month m”
Period m-1 Period m Event
9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7
Luxembourg, April 2013Specifications for TD&MH Regressors
A General Linear Effect Model
Period m-1 Period m Event
9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8
Luxembourg, April 2013Specifications for TD&MH Regressors
Specifications
› You must specify–The date of the event
–The starting day of the effect before the event (8 days before)
–The ending day of the effect before the event
–The starting day of the effect after the event
–The ending day of the effect after the event
–The kind of effect (constant or linear)
› Warning: the seasonal adjustment of the effects› Examples
Feuille Microsoft Office Excel 97-2003