MatthieuStigler / tsDyn

tsDyn
tsdyn.googlecode.com
34 stars 20 forks source link

coefA does not work with ca.jo containing ecdet terms #3

Open MatthieuStigler opened 7 years ago

MatthieuStigler commented 7 years ago

ca.jo can contain deterministic components in cointegration, see parameter ecdet. This will fail now the results:

library(urca)
library(tsDyn)
example(ca.jo)
coefA(sjd.vecm, r=2)

Maybe adding something like this would solve:

C <- rbind(C1, C2)
# New
if(object@ecdet=="const") C <- rbind(C,0)
alpha <- alpha %*% t(beta)  %*% C

Although needs also to look at if contains trend/both?

MatthieuStigler commented 3 years ago

reprex:

library(urca)
library(tsDyn)
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
packageVersion("tsDyn")
#> [1] '11.0.0'
example(ca.jo, echo=FALSE)
coefA(sjd.vecm, r=2)
#> Error in alpha %*% t(beta) %*% C: non-conformable arguments

Created on 2020-12-05 by the reprex package (v0.3.0)