Description Usage Arguments Details Value Examples
This function creates regressor variables for trading day, Easter and leap year effects over the sample period where the input time series is sampled.
1 2 | calendar.effects(x, trading.day = TRUE, easter = 6,
leap.year = FALSE, holidays = NULL, easter.date = FALSE)
|
x |
a monthly time series. |
trading.day |
logical. If |
easter |
numeric. The number of days before Easter over which the Easter effect spans. If it is set to zero Easter variable is not returned. |
leap.year |
logical. If |
holidays |
an optional numeric vector of the same length as |
easter.date |
logical indicating whether the date of Easter should be returned. |
Let wd be the number of working days in a given month and nwd the number of non-working days. The trading day variable at time t is built as follows:
wd = wd - holidays
nwd = nwd + holidays
td_t = wd - (5/2) x nwd
By default, working days are the days from Monday to Friday and
non-working days are Saturdays and Sundays. If there are additional
non-working days they can be defined in argument holidays
.
For example, if the 1st of February is a local holiday, the user can define
a variable containing zeros for all periods except for the periods related
to February where the 1st of February falls within a working day (Monday to Friday);
these data are set to one so that they are considered as non working days.
Easter effect is defined as the proportion of days before Easter
(by default easter = 6
) that lie in March and April,
respectively for each month. It contains zeros for the remaining months.
The leap year is a vector of zeros for all months except February, where the variable takes on the value 0.75 if the year is a leap year and -0.25 otherwise.
A mts
matrix containing the selected calendar effects by columns.
If easter.date
is TRUE
a list is returned containing the
mts
matrix of calendar effects as well as the dates of Easter for
each year of the sample.
1 2 3 4 5 6 7 8 9 10 | # display calendar effects for a sample span period
# no data are actually necessary in the input series
# since calendar effects are concerned only with the dates
# at which the data are sampled
x <- ts(frequency = 12, start = c(1980, 1), end = c(2000, 12))
ce <- calendar.effects(x, leap.year = TRUE)
colnames(ce)
plot(ce, main = "calendar effects")
# Easter days for each year
calendar.effects(x, easter.date = TRUE)$easter
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.