This model allows each active day in a holiday window to move according to a random walk relative to the day's value the last time the holiday occurred.
AddFixedDateHoliday(state.specification = NULL,
holiday.name,
month,
day,
y,
sigma.prior = NULL,
initial.state.prior = NULL,
sdy = sd(as.numeric(y), na.rm = TRUE),
time0 = NULL,
days.before = 1,
days.after = 1)AddNthWeekdayInMonthHoliday(state.specification = NULL,
holiday.name,
month,
day.of.week,
which.week,
y,
sigma.prior = NULL,
initial.state.prior = NULL,
sdy = sd(as.numeric(y), na.rm = TRUE),
time0 = NULL,
days.before = 1,
days.after = 1)
AddLastWeekdayInMonthHoliday(state.specification = NULL,
holiday.name,
month,
day.of.week,
y,
sigma.prior = NULL,
initial.state.prior = NULL,
sdy = sd(as.numeric(y), na.rm = TRUE),
time0 = NULL,
days.before = 1,
days.after = 1)
NamedHolidays(except = NULL)
AddNamedHolidays(state.specification = NULL,
named.holidays = NamedHolidays(),
y,
sigma.prior = NULL,
initial.state.prior = NULL,
sdy = sd(as.numeric(y), na.rm = TRUE),
time0 = NULL,
days.before = 1,
days.after = 1)
xts
. This state model assumes y
contains daily data.SdPrior
describing the prior distribution for the standard deviation of the
random walk increments.NormalPrior
, describing the prior distribution
of the the initial state vector (at time 1).y
is provided, or if all the required
prior distributions are supplied directly.FixedDateHoliday
occurs.NthWeekdayInMonthHoliday
occurs.NthWeekdayInMonthHoliday
occurs. If which.week <= 0<="" code=""> then the holiday is assumed to occur on the last
day.of.week
in month
.=>
NULL
then all named holidays are returned. If
except is a character vector containing partial matches to holiday
names, the matched names will be omitted from the returned list.NamedHolidays
returns a character vector with the names of the
recognized holiday.The other functions return state.specification
, after adding the
requested state components.
AddNthWeekdayInMonthHoliday
, AddLastWeekdayInMonthHoliday
,
and AddFixedDateHoliday
can each add one holiday at a time.
AddNamedHolidays
will add several holidays at once, if
named.holidays
is a vector.
Durbin and Koopman (2001), "Time series analysis by state space methods", Oxford University Press.
bsts
.
SdPrior
NormalPrior
## TODO(stevescott): add examples
Run the code above in your browser using DataLab