linearHypothesis from VECM in R

46 Views Asked by At

I wanna run linearHypothesis() for coefficients from VECM in R. For coefficients from lm(), I have coefficient vector, so test like "linearHypothesis(model, "beta1 = 0")" is known. But it seems that R cannot do linearHypothesis() for coefficients matrix, such as VECM. If not, please let me know.

For 4x6 coefficient matrix from 4 variable-VECM, with six columns of ECT, Intercept, variable 1, variable 2, variable 3, variable 4, I tried;

  1. > wald_test <- linearHypothesis(model, hypothesis.matrix = unrestricted, rhs = restricted, test = "Chisq")

          ** restricted; 6x6 matrix, unrestricted; 6x6 matrix
    

    Error in L %*% b : non-conformable arguments

  2. After creating "beta=coef(model)", (beta is then 4x6 matrix)

`> H0 <- c("beta[2,1] = 0", "beta[1,4] = 0")

H1 <- c("beta[2,1] != 0", "beta[1,4] != 0") linearHypothesis(model, H0, H1)`

Error in makeHypothesis(names(b), hypothesis.matrix, rhs) : The hypothesis "names[1] = 0" is not well formed: contains a = sign although rhs was specified.

Anybody with experience?

0

There are 0 best solutions below