Learn R Programming

midasml (version 0.0.6)

mixed_freq_data_mhorizon: MIDAS data structure

Description

Creates a MIDAS data structure for a single high-frequency covariate and a single low-frequency dependent variable computed from high-frequency covariate (e.g. stock returns).

Usage

mixed_freq_data_mhorizon(data.x, data.xdate, x.lag, est.start, est.end,
  horizon, disp.flag = TRUE, ...)

Arguments

data.x

nm by 1 high-frequency time series data vector.

data.xdate

nm by 1 high-frequency time series date vector.

x.lag

number of high-frequency lags to construct in high-frequency time units.

est.start

estimation start date, taken as the first ... .

est.end

estimation end date, taken as the last ... . Remaining data after this date is dropped to out-of-sample evaluation data.

horizon

forecast horizon relative to data.ydate date in high-frequency time units.

disp.flag

display flag to indicate whether or not to display obtained MIDAS data structure in console.

...

an optional parameter aggregation specifying the aggregation method of high-frequency data to get low-frequency target (non-overlapping) sum - sum of high-frequency lags sum&abs - sum of high-frequency lags which after aggregation are taken in absolute value sum&sq - sum of high-frequency lags which after aggregation are taken in squares mean - average of high-frequency lags first_val - the most recent lag value of high-frequency lags.

Value

a list of midas data structure.

Examples

Run this code
# NOT RUN {
data(market_ret)
data.x <- market_ret$snp500ret
data.xdate <- market_ret$DATE
est.start <- as.Date("2005-01-01")
est.end <- as.Date("2017-12-31")
mixed_freq_data_mhorizon(data.x, data.xdate, x.lag = 5, est.start, est.end,
                         horizon = 1, disp.flag = FALSE, aggregation = "sum")
# }

Run the code above in your browser using DataLab