Learn R Programming

midasr (version 0.3)

midas.sim: Simulate MIDAS regression response variable

Description

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

Usage

midas.sim(n, theta, x, eps.sd)

Arguments

n
The sample size
theta
a vector with MIDAS regression coefficients
x
a ts object with MIDAS regression predictor variable
eps.sd
the standard error of the regression disturbances, which are assumed to be independent normal zero mean random variables

Value

  • a ts object

Details

MIDAS regression has the following form:

$$y_t=\sum_{j=0}^k\sum_{i=0}^{m-1}\theta_{jm+i} x_{(t-j)m-i}+u_t$$

or alternatively

$$y_t=\sum_{h=0}^{(k+1)m}\theta_hx_{tm-h}+u_t,$$ where $m$ is the frequency ratio and $k$ is the number of 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.

Examples

Run this code
##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
x <- simplearma.sim(list(ar=0.6),1500*12,1,12)

##Simulate the response variable
y <- midas.sim(500,theta0,x,1)

Run the code above in your browser using DataLab