holiday: Specifying Holidays

holidayR Documentation

Specifying Holidays


Specify holidays for use with holiday state models.


                 month =,
                 days.before = 1,
                 days.after = 1)

                         month =,
                         day.of.week = weekday.names,
                         week.number = 1,
                         days.before = 1,
                         days.after = 1)

                          month =,
                          day.of.week = weekday.names,
                          days.before = 1,
                          days.after = 1)

NamedHoliday( = named.holidays,
             days.before = 1,
             days.after = 1)



A string that can be used to label the holiday in output.


A string naming the month in which the holiday occurs. Unambiguous partial matches are acceptable. Capitalize the first letter.


An integer specifying the day of the month on which the FixedDateHoliday occurs.


A string giving the day of the week on which the holiday occurs.


An integer specifying the week of the month on which the NthWeekdayInMonthHoliday occurs.


An integer giving the number of days of influence that the holiday exerts prior to the actual holiday.


An integer giving the number of days of influence that holiday exerts after the actual holiday.


A character vector containing one or more recognized holiday names.

A vector of starting dates for the holiday. Each instance of the holiday in the training data or the forecast period must be represented by an element in this vector. Thus if this is an annual holiday and, there are 10 years of training data, and a 1-year forecast is needed, then this will be a vector of length 11.

A vector of ending dates for the holiday. Each date must occur on or after the corresponding element of, and[i] must come before[i+1].


Each function returns a list containing the information from the function arguments, formatted as expected by the underlying C++ code. State models that focus on holidays, such as AddRandomWalkHoliday, AddRegressionHoliday, and AddHierarchicalRegressionHoliday, will expect one or more holiday objects as arguments.

  • FixedDateHoliday describes a holiday that occurs on the same date each year, like US independence day (July 4).

  • NthWeekdayInMonthHoliday describes a holiday that occurs a particular weekday of a particular week of a particular month. For example, US Labor Day is the first Monday in September.

  • LastWeekdayInMonthHoliday describes a holiday that occurs on the last instance of a particular weekday in a particular month. For example, US Memorial Day is the last Monday in May.

  • DateRangeHoliday describes an irregular holiday that might not follow a particular pattern. You can handle this type of holiday by manually specifying a range of dates for each instance of the holiday in your data set. NOTE: If you plan on using the model to forecast, be sure to include date ranges in the forecast period as well as the period covered by the training data.

  • NamedHoliday is a convenience class for describing several important holidays in the US.


Steven L. Scott

See Also

AddRandomWalkHoliday, AddRegressionHoliday, AddHierarchicalRegressionHoliday


july4 <- FixedDateHoliday("July4", "July", 4) <- LastWeekdayInMonthHoliday("MemorialDay", "May", "Monday") <- NthWeekdayInMonthHoliday("LaborDay", "September", "Monday", 1) <- NamedHoliday("MemorialDay")
easter <- NamedHoliday("Easter")
winter.olympics <- DateRangeHoliday("WinterOlympicsSince2000",
                     start = as.Date(c("2002-02-08",
                     end = as.Date(c("2002-02-24",

bsts documentation built on Nov. 10, 2022, 5:53 p.m.

Related to holiday in bsts...