Learn R Programming

midasr (version 0.2)

midas_r: Restricted MIDAS regression

Description

Estimate restricted MIDAS regression using non-linear least squares.

Usage

midas_r(x, ...)

## S3 method for class 'default': midas_r(x, data, start, Ofunction = "optim", user.gradient = FALSE, ...)

Arguments

x
either formula for restricted MIDAS regression or midas_r object. Formula must include fmls function
data
a named list containing data with mixed frequencies
start
the starting values for optimisation. Must be a list with named elements.
Ofunction
the list with information which R function to use for optimisation. The list must have element named Ofunction which contains character string of chosen R function. Other elements of the list are the arguments passed to this function.
user.gradient
the default value is FALSE, which means that the numeric approximation of weight function gradient is calculated. If TRUE it is assumed that the R function for weight function gradient has the name of the weight function appended with .gradi
...
additional arguments supplied to optimisation function

Value

  • a midas_r object which is the list with the following elements:
  • coefficientsthe estimates of parameters of restrictions
  • midas.coefficientasthe estimates of restricted coefficients of MIDAS regression
  • modelmodel data
  • weightsthe MIDAS weights used in estimation.
  • unrestrictedunrestricted regression estimated using midas_u
  • param.mapparameter map for optimisation function
  • fn0optimisation function for non-linear least squares problem solved in restricted MIDAS regression
  • rhsthe function which evaluates the right-hand side of the MIDAS regression
  • allcoefthe function which evaluates the restricted coefficients of MIDAS regression
  • optthe output of optimisation procedure
  • argmap.optthe list containing the name of optimisation function together with arguments for optimisation function
  • start.optthe starting values used in optimisation
  • callthe call to the function
  • termsterms object
  • gradientgradient of NLS objective function
  • hessianhessian of NLS objective function
  • Zenvthe environment in which data is placed
  • user.gradientthe value of supplied argument user.gradient

Details

Given MIDAS regression:

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

estimate the parameters of the restriction

$$\theta_h=g(h,\lambda),$$ where $h=0,...,(k+1)m$, together with coefficients $\beta$ corresponding to additional low frequency regressors.

MIDAS regression involves times series with different frequencies.

MIDAS-AR* (a model with a common factor, see (Clements and Galvao, 2008)) can be estimated by specifying additional argument, see an example.

The restriction function must return the restricted coefficients of the MIDAS regression.

References

Clements, M. and Galvao, A., Macroeconomic Forecasting With Mixed-Frequency Data: Forecasting Output Growth in the United States, Journal of Business and Economic Statistics, Vol.26 (No.4), (2008) 546-554

See Also

midas_r.midas_r

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)

##Remove unnecessary history of x
x <- window(x,start=start(y))

##Fit restricted model
mr <- midas_r(y~fmls(x,4*12-1,12,theta.h0)-1,
              list(y=y,x=x),
              start=list(x=c(-0.1,10,-10,-10)))

##Include intercept and trend in regression
mr.it <- midas_r(y~fmls(x,4*12-1,12,theta.h0)+trend,
                 list(data.frame(y=y,trend=1:500),x=x),
                 start=list(x=c(-0.1,10,-10,-10)))

data("USrealgdp")
data("USunempr")

y.ar <- diff(log(USrealgdp))
xx <- window(diff(USunempr), start = 1949)
trend <- 1:length(y.ar)

##Fit AR(1) model
mr.ar <- midas_r(y.ar ~ trend + mls(y.ar, 1, 1) +
                 fmls(xx, 11, 12, nealmon),
                 start = list(xx = rep(0, 3)))

##First order MIDAS-AR* restricted model
mr.arstar <-  midas_r(y.ar ~ trend + mls(y.ar, 1, 1, "*")
                     + fmls(xx, 11, 12, nealmon),
                     start = list(xx = rep(0, 3)))

Run the code above in your browser using DataLab