# midas_auto_sim: Simulate simple autoregressive MIDAS model In midasr: Mixed Data Sampling Regression

## Description

Given the predictor variable, the weights and autoregressive coefficients, simulate MIDAS regression response variable.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10``` ```midas_auto_sim( n, alpha, x, theta, rand_gen = rnorm, innov = rand_gen(n, ...), n_start = NA, ... ) ```

## Arguments

 `n` sample size. `alpha` autoregressive coefficients. `x` a high frequency predictor variable. `theta` a vector with MIDAS weights for predictor variable. `rand_gen` a function to generate the innovations, default is the normal distribution. `innov` an optional time series of innovations. `n_start` number of observations to omit for the burn.in. `...` additional arguments to function `rand_gen`.

## 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``` ```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) ##Generate the predictor variable xx <- ts(arima.sim(model = list(ar = 0.6), 1000 * 12), frequency = 12) y <- midas_auto_sim(500, 0.5, xx, theta0, n_start = 200) 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))) ```

### Example output

```Loading required package: sandwich

Attaching package: 'SparseM'

The following object is masked from 'package:base':

backsolve

MIDAS regression model with "ts" data:
Start = 504, End = 1000
model: y ~ mls(y, 1, 1) + fmls(x, 4 * 12 - 1, 12, theta_h0)
(Intercept)           y          x1          x2          x3          x4
-0.004993    0.487545   -0.046211    8.165974   -8.315616  -12.032461

Function optim was used for fitting
```

midasr documentation built on Feb. 23, 2021, 5:11 p.m.