Learn R Programming

midasr (version 0.2)

midas.auto.sim: Simulate autoregressive MIDAS model

Description

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

Usage

midas.auto.sim(n, theta, alpha, x, eps.sd, n.start = NA)

Arguments

n
sample size
theta
a vector with MIDAS weights for predictor variable
alpha
autoregressive coefficients
x
a high frequency predictor variable
eps.sd
the standard error of the regression disturbances, which are assumed to be independent normal zero mean random variables
n.start
number of observations to omit for the burn.in

Value

  • a ts object

Examples

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

y <- midas.auto.sim(500,theta0,c(0.5),xx,1,n.start=100)
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)))

Run the code above in your browser using DataLab