I recently started playing around with the tsDyn package for R and successfully used it to estimate a bunch of VEC models and print their impulse responses (IRF) and error variance decompositions (FEVD). While I really like its intuitive and straightforward functions, one thing I have not been able to figure out is how to conduct diagnostic tests for a VEC model in tsDyn, specifically tests for serial correlation and ARCH effects?
I tried to convert a tsDyn-generated VEC model to a VAR in levels using the vec2var()
function to apply the serial.test()
and arch.test()
functions from the vars package, but this failed, presumably because vec2var()
doesn't know how to handle classes produced by tsDyn. Since I am unsure whether this is the correct approach in the first place, I was hoping someone here may be able to give advice on the issue.
Here is what I did after loading library(tsDyn)
and library(vars)
:
data(barry)
ve <- VECM(barry, lag=1, estim="ML")
serial.test(ve)
Error in serial.test(ve) :
Please provide an object of class 'varest', generated by 'var()', or an object of
class 'vec2var' generated by 'vec2var()'.
vec2var(ve)
Error in vec2var(ve) :
Please, provide object of class 'ca.jo' as 'z'.
In addition: Warning message:
In if (!(class(z) == "ca.jo")) { :
the condition has length > 1 and only the first element will be used
autocorrelation
andgarch
instead ofcointegration
; they might be more relevant. $\endgroup$