Learn R Programming

midasr (version 0.3)

hAh.test: Test restrictions on coefficients of MIDAS regression

Description

Perform a test whether the restriction on MIDAS regression coefficients holds.

Usage

hAh.test(x)

Arguments

x
MIDAS regression model with restricted coefficients, estimated with midas_r

Value

  • a htest object

Details

Given MIDAS regression:

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

test the null hypothesis that the following restriction holds:

$$\theta_h=g(h,\lambda),$$ where $h=0,...,(k+1)m$.

References

Kvedaras V., Zemlys, V. Testing the functional constraints on parameters in regressions with variables of different frequency Economics Letters 116 (2012) 250-254

See Also

hAhr.test

Examples

Run this code
##The parameter function
theta.h0 <- function(p, dk, ...) {
   i <- (1:dk-1)
   (p[1] + p[2]*i)*exp(p[3]*i + p[4]*i^2)
}

##Generate coefficients
theta0 <- theta.h0(c(-0.1,0.1,-0.1,-0.001),4*12)

##Plot the coefficients
plot(theta0)

##Generate the predictor variable
set.seed(13)
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,0.1,-0.1,-0.001)))

##Perform test (the expected result should be the acceptance of null)

hAh.test(mr)

##Fit using gradient function

##The gradient function
theta.h0.gradient<-function(p, dk,...) {
   i <- (1:dk-1)
   a <- exp(p[3]*i + p[4]*i^2)
   cbind(a, a*i, a*i*(p[1]+p[2]*i), a*i^2*(p[1]+p[2]*i))
}

mr <- midas_r(y~fmls(x,4*12-1,12,theta.h0)-1,list(y=y,x=x),
              start=list(x=c(-0.1,0.1,-0.1,-0.001)),
              user.gradient=TRUE)

##The test will use an user supplied gradient of weight function. See the
##help of midas_r on how to supply the gradient.

hAh.test(mr)

Run the code above in your browser using DataLab