Description Usage Arguments Value Examples
Generates regressors from a named list of Events
1 2 | events_to_regressors(events, dates, h = NULL, seasonal = T,
time_series = NULL, K = 3)
|
events |
List of Event objects like the output from table_to_events(). |
dates |
Sequence of Date objects one for each row of the regressor table. |
h |
Optional days to forecast for generating forecast regressors. |
seasonal |
If true this will generate a single seasonal component with forecast::fourier(time_series, K=K) or forecast::fourierf(time_series, K=K, h=h) if h was specified. |
time_series |
ts object that is the data you are trying to forecast. |
K |
input to forecast::fourier() and forecast::fourierf() |
Returns an xreg data.frame groups by event name.
1 2 3 4 5 6 7 8 | regs_table <- data.frame(event=c("christmas", "christmas", "promotion"),
start=c("2014-12-25", "2015-12-25", "2015-11-27"),
end=c("2014-12-25", "2015-12-25", "2015-11-30"),
time_function= c("none","none","inverse"),
stringsAsFactors=FALSE)
events_to_regressors(table_to_events(regs_table),
seq(as.Date("2015-11-01"), as.Date("2016-01-01"), by = 1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.