Description Usage Arguments Value Note Author(s) Examples
Given a starting date, this helper function generates a set of future dates (excl.weekends) for use in forecasting and simulation when using external regressors.
1 | ForwardDates(Dates, n.ahead, date.format, periodicity = "days")
|
Dates |
A character vector of dates. The last date is used as the starting date for the forward date creation. |
n.ahead |
The number of dates to generate forward. |
date.format |
The format of the dates e.g. “%Y-%m-%d"” . |
periodicity |
Currently only days is supported. |
A POSIXct vector of future dates.
This is a helper function particularly useful when used with the weekday dummy variable for simulation and forecasting in light of weekday dummy external regressors in the mean or variance equation. For example, if fitting a GARCH model with a "Monday" dummy variable in the mean equation, then for simulation or forecasting, one needs a set of forward deterministic dummy variables for the Mondays going forward.
Alexios Ghalanos
1 2 3 4 5 6 | data(sp500ret)
Dates = rownames(sp500ret)
# generate the 100 forward non-weekend days
fwd100 = ForwardDates(Dates, n.ahead=100, date.format = "%Y-%m-%d", periodicity = "days")
# create a dummy vector for those forward days which are Mondays
fwdMonday = WeekDayDummy(as.character(fwd100), date.format = "%Y-%m-%d", weekday = "Monday")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.