Learn R Programming

rugarch (version 1.0-3)

ForwardDates-methods: function: Generate Future Dates

Description

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.

Usage

ForwardDates(Dates, n.ahead, date.format, periodicity = "days")

Arguments

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.

Value

  • A POSIXct vector of future dates.

Examples

Run this code
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")

Run the code above in your browser using DataLab