library(tsDyn)
data(zeroyld)
data = zeroyld
rdmVar = rnorm(nrow(data));
#Fit a VECM with Johansen MLE estimator
vecm.jo.exogen = VECM(zeroyld, lag=2, estim="ML", exogen = rdmVar);
IRF.exogen = irf(vecm.jo.exogen, boot=F, ortho=F);
#> Matrix B badly specified: should have 5 columns, but has 6
#> ECT L{x1}{1} L{x2}{1} L{x1}{2} L{x2}{2}
#> Equ x1 NA NA NA NA NA
#> Equ x2 NA NA NA NA NA
#> Error in TVECM.gen(B = B, beta = beta, n = n, lag = lag, include = include, :
See below:
Created on 2021-03-16 by the reprex package (v1.0.0)