# midas_sim: Simulate simple MIDAS regression response variable In midasr: Mixed Data Sampling Regression

## Description

Given the predictor variable and the coefficients simulate MIDAS regression response variable.

## Usage

 `1` ```midas_sim(n, x, theta, rand_gen = rnorm, innov = rand_gen(n, ...), ...) ```

## Arguments

 `n` The sample size `x` a `ts` object with MIDAS regression predictor variable `theta` a vector with MIDAS regression coefficients `rand_gen` the function which generates the sample of innovations, the default is `rnorm` `innov` the vector with innovations, the default is NULL, i.e. innovations are generated using argument `rand_gen` `...` additional arguments to `rand_gen`.

## Details

MIDAS regression with one predictor variable has the following form:

y_t=∑_{j=0}^{h}θ_jx_{tm-j}+u_t,

where m is the frequency ratio and h is the number of high frequency lags included in the regression.

MIDAS regression involves times series with different frequencies. In R the frequency property is set when creating time series objects `ts`. Hence the frequency ratio m which figures in MIDAS regression is calculated from frequency property of time series objects supplied.

## Value

a `ts` object

## Author(s)

Virmantas Kvedaras, Vaidotas Zemlys

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```##The parameter function theta_h0 <- function(p, dk) { i <- (1:dk-1)/100 pol <- p[3]*i + p[4]*i^2 (p[1] + p[2]*i)*exp(pol) } ##Generate coefficients theta0 <- theta_h0(c(-0.1,10,-10,-10),4*12) ##Plot the coefficients plot(theta0) ##Generate the predictor variable, leave 4 low frequency lags of data for burn-in. xx <- ts(arima.sim(model = list(ar = 0.6), 600 * 12), frequency = 12) ##Simulate the response variable y <- midas_sim(500, xx, theta0) x <- window(xx, start=start(y)) midas_r(y ~ mls(y, 1, 1) + fmls(x, 4*12-1, 12, theta_h0), start = list(x = c(-0.1, 10, -10, -10))) ```

midasr documentation built on May 29, 2017, 4:12 p.m.