Running '00SetarAndFriends.R' [5s/5s]
  Comparing '00SetarAndFriends.Rout' to '00SetarAndFriends.Rout.save' ... OK
  Running 'TVAR.R' [8s/9s]
  Running 'TVECM.sim.R' [8s/8s]
  Running 'TVECM_HSTEST.R' [6s/7s]
  Comparing 'TVECM_HSTEST.Rout' to 'TVECM_HSTEST.Rout.save' ... OK
  Running 'VAR.R' [8s/8s]
  Running 'VECM.R' [8s/9s]
  Running 'compare_tsDyn_vars.R' [7s/8s]
  Comparing 'compare_tsDyn_vars.Rout' to 'compare_tsDyn_vars.Rout.save' ... OK
  Running 'lstar.R' [11s/12s]
  Running 'nlVar-methods.R' [9s/11s]
  Running 'nlar-methods.R' [6s/6s]
  Comparing 'nlar-methods.Rout' to 'nlar-methods.Rout.save' ... OK
  Running 'regime.R' [5s/7s]
  Comparing 'regime.Rout' to 'regime.Rout.save' ... OK
  Running 'toMlm.R' [4s/5s]
  Comparing 'toMlm.Rout' to 'toMlm.Rout.save' ... OK
Running the tests in 'tests/TVAR.R' failed.
Complete output:
  > library(tsDyn)
  > 
  > data(zeroyld)
  > 
  > ###TVAR
  > tvar<-TVAR(zeroyld[1:100,], lag=2, nthresh=2,thDelay=1,trim=0.1, plot=FALSE, include="const")
  Best unique threshold 3.173 
  Second best: 2.987 (conditionnal on th= 3.173 and Delay= 1 ) 	 SSR/AIC: 5.513542
  Second best: 3.173 (conditionnal on th= 2.987 and Delay= 1 ) 	 SSR/AIC: 5.513542
  
  Second step best thresholds 3.091 3.405 		 SSR: 5.359576 
  > class(tvar)
  [1] "TVAR"  "nlVar"
  > tvar
  Model TVAR with  2  thresholds
  
  $Bdown
                     Intercept short.run -1 long.run -1 short.run -2 long.run -2
  Equation short.run 0.2588048    1.0010115 -0.03033653   -0.1216495  0.07488954
  Equation long.run  0.2537710    0.4796473  1.10618520   -0.5610622 -0.11992734
  
  $Bmiddle
                     Intercept short.run -1 long.run -1 short.run -2 long.run -2
  Equation short.run  5.184416    -1.034966   0.5343629    0.6156229  -0.6789873
  Equation long.run   7.327257    -3.071481   1.9817578    1.4851627  -1.6385701
  
  $Bup
                     Intercept short.run -1  long.run -1 short.run -2 long.run -2
  Equation short.run  1.705713  0.379160720 -0.008943793    0.3090020 -0.13887286
  Equation long.run   1.890135 -0.008113763  0.633504924   -0.1262766 -0.01764579
  
  
  Threshold value[1] "3.091 3.405"
  > print(tvar)
  Model TVAR with  2  thresholds
  
  $Bdown
                     Intercept short.run -1 long.run -1 short.run -2 long.run -2
  Equation short.run 0.2588048    1.0010115 -0.03033653   -0.1216495  0.07488954
  Equation long.run  0.2537710    0.4796473  1.10618520   -0.5610622 -0.11992734
  
  $Bmiddle
                     Intercept short.run -1 long.run -1 short.run -2 long.run -2
  Equation short.run  5.184416    -1.034966   0.5343629    0.6156229  -0.6789873
  Equation long.run   7.327257    -3.071481   1.9817578    1.4851627  -1.6385701
  
  $Bup
                     Intercept short.run -1  long.run -1 short.run -2 long.run -2
  Equation short.run  1.705713  0.379160720 -0.008943793    0.3090020 -0.13887286
  Equation long.run   1.890135 -0.008113763  0.633504924   -0.1262766 -0.01764579
  
  
  Threshold value[1] "3.091 3.405"
  > coefficients(tvar)
  $Bdown
                     Intercept short.run -1 long.run -1 short.run -2 long.run -2
  Equation short.run 0.2588048    1.0010115 -0.03033653   -0.1216495  0.07488954
  Equation long.run  0.2537710    0.4796473  1.10618520   -0.5610622 -0.11992734
  
  $Bmiddle
                     Intercept short.run -1 long.run -1 short.run -2 long.run -2
  Equation short.run  5.184416    -1.034966   0.5343629    0.6156229  -0.6789873
  Equation long.run   7.327257    -3.071481   1.9817578    1.4851627  -1.6385701
  
  $Bup
                     Intercept short.run -1  long.run -1 short.run -2 long.run -2
  Equation short.run  1.705713  0.379160720 -0.008943793    0.3090020 -0.13887286
  Equation long.run   1.890135 -0.008113763  0.633504924   -0.1262766 -0.01764579
  
  > 
  > ##FIXME ?
  > summary(tvar)$VAR
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  tsDyn
   --- call from context --- 
  asListIfMat(VarCovB)
   --- call from argument --- 
  if (class(x) == "matrix") return(list(x)) else return(x)
   --- R stacktrace ---
  where 1: asListIfMat(VarCovB)
  where 2: summary.TVAR(tvar)
  where 3: summary(tvar)
  
   --- value of length: 2 type: logical ---
  [1]  TRUE FALSE
   --- function from context --- 
  function (x) 
  {
      if (class(x) == "matrix") 
          return(list(x))
      else return(x)
  }
  <bytecode: 0x5b61b18>
  <environment: namespace:tsDyn>
   --- function search by body ---
  Function asListIfMat in namespace tsDyn has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Error in if (class(x) == "matrix") return(list(x)) else return(x) : 
    the condition has length > 1
  Calls: summary -> summary.TVAR -> asListIfMat
  Execution halted
Running the tests in 'tests/TVECM.sim.R' failed.
Complete output:
  > library(tsDyn)
  > library(mnormt)
  > 
  > ################################################################
  > ######### From man file:
  > ################################################################
  > #see that:
  > a<-matrix(c(-0.2, 0.2), ncol=1)
  > b<-matrix(c(1,-1), nrow=1)
  > a%*%b
       [,1] [,2]
  [1,] -0.2  0.2
  [2,]  0.2 -0.2
  > 
  > set.seed(123)
  > innov<-rmnorm(100, varcov=diag(2))
  > vecm1<-TVECM.sim(B=rbind(c(-0.2, 0,0), c(0.2, 0,0)), nthresh=0, beta=1,n=100, lag=1,include="none", innov=innov)
  > ECT<-vecm1[,1]-vecm1[,2]
  > ECT[1:5]
  [1]  0.0000  0.0000 -0.3303  1.2900 -0.8117
  > 
  > #add an intercept as in panel B
  > B2 <- rbind(c(-0.2, 0.1,0,0), c(0.2,0.4, 0,0))
  > b<- TVECM.sim(B=B2, nthresh=0, n=100,beta=1, lag=1,include="const", innov=innov, show.parMat=TRUE)
           ECT Const Trend L{x1}{1} L{x2}{1}
  Equ x1: -0.2   0.1     0        0        0
  Equ x2:  0.2   0.4     0        0        0
  > b_2 <- VECM.sim(B=B2,  n=100,beta=1, lag=1,include="const", innov=innov, show.parMat=TRUE)
           ECT Const Trend L{x1}{1} L{x2}{1}
  Equ x1: -0.2   0.1     0        0        0
  Equ x2:  0.2   0.4     0        0        0
  > b[1:5,]
          [,1]   [,2]
  [1,]  0.0000 0.0000
  [2,]  0.0000 0.0000
  [3,] -0.4605 0.1698
  [4,]  1.3243 0.5143
  [5,]  1.3916 2.7913
  > all.equal(b, b_2)
  [1] TRUE
  > 
  > ## other ways to input beta:
  > b_beta_vec <- TVECM.sim(B=B2, nthresh=0, n=100,beta=c(1,-1), lag=1,include="const", innov=innov, show.parMat=TRUE)
           ECT Const Trend L{x1}{1} L{x2}{1}
  Equ x1: -0.2   0.1     0        0        0
  Equ x2:  0.2   0.4     0        0        0
  > b_beta_vec_2 <- VECM.sim(B=B2, n=100,beta=c(1,-1), lag=1,include="const", innov=innov, show.parMat=TRUE)
           ECT Const Trend L{x1}{1} L{x2}{1}
  Equ x1: -0.2   0.1     0        0        0
  Equ x2:  0.2   0.4     0        0        0
  > b_beta_vec[1:5,]
          [,1]   [,2]
  [1,]  0.0000 0.0000
  [2,]  0.0000 0.0000
  [3,] -0.4605 0.1698
  [4,]  1.3243 0.5143
  [5,]  1.3916 2.7913
  > all.equal(b,b_beta_vec)
  [1] TRUE
  > all.equal(b_beta_vec, b_beta_vec_2)
  [1] TRUE
  > 
  > beta_mat <- matrix(c(1,-1), ncol=1)
  > b_beta_mat <- TVECM.sim(B=B2, nthresh=0, n=100,beta=beta_mat, lag=1,include="const", innov=innov, show.parMat=TRUE)
           ECT Const Trend L{x1}{1} L{x2}{1}
  Equ x1: -0.2   0.1     0        0        0
  Equ x2:  0.2   0.4     0        0        0
  > b_beta_mat[1:5,]
          [,1]   [,2]
  [1,]  0.0000 0.0000
  [2,]  0.0000 0.0000
  [3,] -0.4605 0.1698
  [4,]  1.3243 0.5143
  [5,]  1.3916 2.7913
  > all.equal(b,b_beta_mat)
  [1] TRUE
  > 
  > 
  > ########################
  > ######## TVECM
  > ########################
  > 
  > ##Bootstrap a TVECM with 1 threshold (two regimes)
  > data(zeroyld)
  > dat<-zeroyld
  > TVECMobject<-TVECM(dat, nthresh=1, lag=1, ngridBeta=20, th1=list(exact=-1.195), plot=FALSE)
  > tv_1_boot <-TVECM.sim(TVECMobject=TVECMobject,type="boot", seed=123, show.parMat=TRUE)
                           ECT     Const Trend short.run t -1 long.run t -1
  Equation short.run 0.2025264 0.4857667     0      0.2252923   -0.09926611
  Equation long.run  0.9575983 1.5929831     0      0.8703592    0.02252604
                             ECT        Const Trend short.run t -1 long.run t -1
  Equation short.run 0.001291099  0.004290751     0    -0.02328976    0.06741675
  Equation long.run  0.058816293 -0.007954949     0     0.16032265    0.14668443
  > head(tv_1_boot)
        [,1]  [,2]
  [1,] 2.183 1.575
  [2,] 2.246 1.545
  [3,] 2.325 1.573
  [4,] 2.332 1.628
  [5,] 2.393 1.536
  [6,] 2.303 1.612
  > 
  > ##Check the bootstrap
  > all.equal(TVECM.sim(TVECMobject=TVECMobject,type="check"), as.matrix(dat), check.attributes=FALSE)
  [1] TRUE
  > 
  > ## check correspondance bootstrap/simul:
  > tv_1_sim <-TVECM.sim(B=tsDyn:::coefMat.nlVar(TVECMobject),type="simul", beta=TVECMobject$model.specific$beta,
  +                         Thresh=getTh(TVECMobject), show.parMat=TRUE, seed=123, innov=matrix(0,200,2))
            ECT_low Const_low Trend_low L{x1}{1}_low L{x2}{1}_low     ECT_upr
  Equ x1: 0.2025264 0.4857667         0    0.2252923  -0.09926611 0.001291099
  Equ x2: 0.9575983 1.5929831         0    0.8703592   0.02252604 0.058816293
             Const_upr Trend_upr L{x1}{1}_upr L{x2}{1}_upr
  Equ x1:  0.004290751         0  -0.02328976   0.06741675
  Equ x2: -0.007954949         0   0.16032265   0.14668443
  > head(tv_1_boot)
        [,1]  [,2]
  [1,] 2.183 1.575
  [2,] 2.246 1.545
  [3,] 2.325 1.573
  [4,] 2.332 1.628
  [5,] 2.393 1.536
  [6,] 2.303 1.612
  > 
  > tv_1_sim <-TVECM.sim(B=tsDyn:::coefMat.nlVar(TVECMobject),type="simul", 
  +                      beta=TVECMobject$model.specific$beta,
  +                      Thresh=getTh(TVECMobject), show.parMat=TRUE, seed=123)
            ECT_low Const_low Trend_low L{x1}{1}_low L{x2}{1}_low     ECT_upr
  Equ x1: 0.2025264 0.4857667         0    0.2252923  -0.09926611 0.001291099
  Equ x2: 0.9575983 1.5929831         0    0.8703592   0.02252604 0.058816293
             Const_upr Trend_upr L{x1}{1}_upr L{x2}{1}_upr
  Equ x1:  0.004290751         0  -0.02328976   0.06741675
  Equ x2: -0.007954949         0   0.16032265   0.14668443
  > head(tv_1_boot)
        [,1]  [,2]
  [1,] 2.183 1.575
  [2,] 2.246 1.545
  [3,] 2.325 1.573
  [4,] 2.332 1.628
  [5,] 2.393 1.536
  [6,] 2.303 1.612
  > 
  > ##Bootstrap a TVAR with two threshold (three regimes)
  > tv_2_const <- TVECM(dat, lag=1, nthresh=2, plot=FALSE, trace=FALSE, th1=list(exact=-1.312),
  +                    th2=list(exact=0.774))
  > tv_2_none <- TVECM(dat, lag=1, nthresh=2, plot=FALSE, trace=FALSE, th1=list(exact=-1.312),
  +                 th2=list(exact=0.774), include="none")
  > tv_2_trend <- TVECM(dat, lag=1, nthresh=2, plot=FALSE, trace=FALSE, th1=list(exact=-1.312),
  +                    th2=list(exact=0.774), include="trend")
  > tv_2_both <- TVECM(dat, lag=1, nthresh=2, plot=FALSE, trace=FALSE, th1=list(exact=-1.312),
  +                     th2=list(exact=0.774), ngridBeta=5, include="both")
  > 
  > tv_2_const_common <- TVECM(dat, lag=1, nthresh=2, plot=FALSE, trace=FALSE, th1=list(exact=-1.451),
  +                     th2=list(exact=0.754), include="const", common="only_ECT")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  tsDyn
   --- call from context --- 
  TVECM(dat, lag = 1, nthresh = 2, plot = FALSE, trace = FALSE, 
      th1 = list(exact = -1.451), th2 = list(exact = 0.754), include = "const", 
      common = "only_ECT")
   --- call from argument --- 
  if (class(Blist) == "list") c(sapply(Blist, colnames)) else colnames(Blist)
   --- R stacktrace ---
  where 1: TVECM(dat, lag = 1, nthresh = 2, plot = FALSE, trace = FALSE, 
      th1 = list(exact = -1.451), th2 = list(exact = 0.754), include = "const", 
      common = "only_ECT")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (data, lag = 1, nthresh = 1, trim = 0.05, ngridBeta = 50, 
      ngridTh = 50, plot = TRUE, th1 = list(exact = NULL, int = c("from", 
          "to"), around = "val"), th2 = list(exact = NULL, int = c("from", 
          "to"), around = "val"), beta = list(exact = NULL, int = c("from", 
          "to"), around = c("val", "by")), restr = c("none", "equal", 
          "signOp"), common = c("All", "only_ECT"), include = c("const", 
          "trend", "none", "both"), dummyToBothRegimes = TRUE, 
      beta0 = 0, methodMapply = FALSE, trace = TRUE) 
  {
      include <- match.arg(include)
      model <- match.arg(common)
      restr <- match.arg(restr)
      if (restr == "equal") 
          stop("Sorry, restriction 'equal' not yet fully implemented")
      bn <- ngridBeta
      ngridG <- ngridTh
      gamma1 <- th1
      gamma2 <- th2
      if (!missing(gamma1) && !is.list(gamma1)) 
          gamma1 <- list(exact = gamma1)
      if (!missing(gamma2) && !is.list(gamma2)) 
          gamma2 <- list(exact = gamma2)
      y <- as.matrix(data)
      T <- nrow(y)
      p <- lag
      t <- T - p - 1
      k <- ncol(y)
      if (k > 2 & is.null(beta$exact)) 
          stop("Sorry, the search is only possible with 2 variables. If more, please provide pre-specified beta values")
      if (is.null(colnames(data))) 
          colnames(data) <- paste("Var", c(1:k), sep = "")
      ndig <- getndp(y)
      ysmall <- y[(p + 1):T, ]
      DeltaY <- diff(y)[(p + 1):(T - 1), ]
      Xminus1 <- embed(y, p + 2)[, (k + 1):(k + k)]
      DeltaX <- embed(diff(y), p + 1)[, -(1:k)]
      if (include == "const") 
          DeltaX <- cbind(rep(1, t), DeltaX)
      else if (include == "trend") 
          DeltaX <- cbind(seq_len(t), DeltaX)
      else if (include == "both") 
          DeltaX <- cbind(rep(1, t), seq_len(t), DeltaX)
      beta0 <- as.matrix(beta0)
      if (is.null(beta$exact)) {
          if (beta0[1] != 0) {
              if (nrow(beta0) != nrow(y)) 
                  stop("Length of beta0 should be ", nrow(y), "\n")
              coint <- lm(y[, 1] ~ y[, 2] + beta0 - 1)
              beta0 <- (beta0 %*% coint$coef[-1])[-c(1:p, T), ]
          }
          else {
              coint <- lm(y[, 1] ~ y[, 2] - 1)
              beta0 <- rep(0, t)
          }
          betaLT <- coint$coef[1]
          betaLT_std <- sqrt(diag(summary(coint)$sigma * summary(coint)$cov))[1]
      }
      else {
          betaLT <- beta$exact
          if (length(betaLT) != k - 1) 
              warning("beta$exact should be of length ncol(data) -1, cointegrating vector will be c(1,-beta) \n")
          if (beta0[1] != 0) {
              stop("Sorry, use of beta0 and beta$exact currently not supported simultaneously\n")
          }
          else {
              beta0 <- rep(0, t)
          }
      }
      ECT <- y %*% c(1, -betaLT)
      ECT <- round(ECT, ndig)
      ECTminus1 <- round(Xminus1 %*% c(1, -betaLT), ndig)
      Z <- cbind(ECTminus1 - beta0, DeltaX)
      Y <- DeltaY
      B <- t(Y) %*% Z %*% solve(t(Z) %*% Z)
      npar <- ncol(B)
      allpar <- ncol(B) * nrow(B)
      rownames(B) <- paste("Equation", colnames(data))
      LagNames <- c(paste(rep(colnames(data), p), -rep(seq_len(p), 
          each = k)))
      colnames(B) <- switch(include, const = c("ECT", "Intercept", 
          LagNames), trend = c("ECT", "Trend", LagNames), both = c("ECT", 
          "Intercept", "Trend", LagNames), none = c("ECT", LagNames))
      res <- Y - Z %*% t(B)
      Sigma <- matrix(1/t * crossprod(res), ncol = k, dimnames = list(colnames(data), 
          colnames(data)))
      VarCov <- solve(crossprod(Z)) %x% Sigma
      StDev <- matrix(diag(VarCov)^0.5, nrow = k)
      Tvalue <- B/StDev
      Pval <- pt(abs(Tvalue), df = (t - ncol(Z)), lower.tail = FALSE) + 
          pt(-abs(Tvalue), df = (t - ncol(Z)), lower.tail = TRUE)
      colnames(Pval) <- colnames(B)
      allgammas <- sort(unique(ECTminus1 - beta0))
      ng <- length(allgammas)
      gammas <- allgammas[round(seq(from = trim, to = 1 - trim, 
          length.out = ngridG) * ng)]
      if (is.null(gamma1$exact) == FALSE) {
          if (any(allgammas == gamma1$exact) == FALSE) 
              warning("The value you gave for gamma does not correspond to an existing value. This causes problems currently")
          gammas <- gamma1$exact
          ngridG <- 1
      }
      if (is.numeric(gamma1$int)) {
          intDown <- which.min(abs(allgammas - gamma1$int[1]))
          intUp <- which.min(abs(allgammas - gamma1$int[2]))
          gammas <- allgammas[seq(from = intDown, to = intUp, length.out = min(ngridG, 
              intUp - intDown))]
      }
      if (is.numeric(gamma1$around)) 
          gammas <- aroundGrid(gamma$around, allvalues = allgammas, 
              ngridG, trim, trace = trace)
      gammas <- round(gammas, ndig)
      if (!is.null(beta$exact)) {
          betas <- matrix(beta$exact, nrow = 1)
          bn <- 1
      }
      else if (is.numeric(beta$int)) {
          betas <- matrix(seq(from = beta$int[1], to = beta$int[2], 
              length.out = bn), ncol = 1)
      }
      else if (is.numeric(beta$around)) {
          by <- beta$around[2]
          betas <- matrix(seq(from = beta$around[1] - bn * by/2, 
              to = beta$around[1] + bn * by/2, by = by), ncol = 1)
      }
      else {
          betas <- matrix(seq(from = betaLT - 2 * betaLT_std, to = betaLT + 
              2 * betaLT_std, length.out = bn), ncol = 1)
      }
      oneSearch <- function(betas, gammas) {
          if (dummyToBothRegimes == TRUE) {
              "%a%" <- function(matrix, dummy) matrix * dummy
          }
          else {
              "%a%" <- function(matrix, dummy) matrix
          }
          oneThresh <- function(betai, gam, Y, Xminus1, DeltaX) {
              ECTi <- Xminus1 %*% c(1, -betai) - beta0
              zi <- cbind(ECTi, DeltaX)
              d1 <- ifelse(ECTi <= gam, 1, 0)
              n1 <- mean(d1)
              if (is.na(n1) == TRUE) 
                  n1 <- 0
              if (min(n1, 1 - n1) > trim) {
                  zigamma <- c(d1) * zi
                  zi <- zi %a% c(1 - d1)
                  Z <- cbind(zigamma, zi)
                  LS <- try(crossprod(c(Y - tcrossprod(Z, crossprod(Y, 
                    Z) %*% solve(crossprod(Z))))), silent = TRUE)
                  if (inherits(LS, "try-error")) {
                    warning("Error when solving for value: gamma=", 
                      gam, "and beta=", betai)
                    LS <- NA
                  }
              }
              else LS <- NA
              return(LS)
          }
          one_partial_Thresh <- function(betai, gam, Y, Xminus1, 
              DeltaX) {
              ECTi <- Xminus1 %*% c(1, -betai) - beta0
              d1 <- ifelse(ECTi <= gam, 1, 0)
              n1 <- mean(d1)
              if (min(n1, 1 - n1) > trim) {
                  Z <- cbind(ECTi * d1, ECTi * (1 - d1), DeltaX)
                  LS <- try(crossprod(c(Y - tcrossprod(Z, crossprod(Y, 
                    Z) %*% solve(crossprod(Z))))), silent = TRUE)
                  if (inherits(LS, "try-error")) {
                    warning("Error when solving for value: gamma=", 
                      gam, "and beta=", betai)
                    LS <- NA
                  }
              }
              else LS <- NA
              return(LS)
          }
          func_onethresh <- switch(model, All = oneThresh, only_ECT = one_partial_Thresh)
          if (methodMapply == FALSE) {
              store <- matrix(NA, nrow = length(gammas), ncol = nrow(betas), 
                  dimnames = list(round(gammas, 3), betas[, 1]))
              for (i in seq_len(length(gammas))) {
                  gam <- gammas[i]
                  for (j in seq_len(nrow(betas))) {
                    betai <- betas[j, ]
                    store[i, j] <- func_onethresh(betai = betai, 
                      gam = gam, DeltaX = DeltaX, Xminus1 = Xminus1, 
                      Y = Y)
                  }
              }
              na <- sum(ifelse(is.na(store), 1, 0))
              if (na > 0) {
                  if (trace) {
                    cat(na, " (", percent(na/(nrow(store) * ncol(store)), 
                      3, by100 = TRUE), ") points of the grid lead to regimes with percentage of observations < trim and were not computed\n", 
                      sep = "")
                  }
              }
              pos <- which(store == min(store, na.rm = TRUE), arr.ind = TRUE)
              if (nrow(pos) > 1) {
                  if (trace) {
                    cat("There were ", nrow(pos), " thresholds/cointegrating combinations (", 
                      paste(gammas[pos[, 1]], "/", betas[pos[, 
                        2], ], ", "), ") \nwhich minimize the SSR in the first search, the first one ", 
                      round(gammas[pos[1, 1]], ndig), " ", round(betas[pos[1, 
                        2], ], ndig), " was taken\n")
                  }
                  pos <- pos[1, ]
              }
              bestGamma1 <- gammas[pos[1]]
              beta_grid <- betas[pos[2], ]
          }
          if (methodMapply == TRUE) {
              if (ncol(betas) > 1) {
                  stop("Method mapply does not work when there are more than 2 variables")
              }
              grid <- expand.grid(betas, gammas)
              oneThreshTemp <- function(betai, gam) func_onethresh(betai = betai, 
                  gam = gam, DeltaX = DeltaX, Xminus1 = Xminus1, 
                  Y = Y)
              storemap <- mapply(oneThreshTemp, betai = grid[, 
                  1], gam = grid[, 2])
              bests <- which(storemap == min(storemap, na.rm = TRUE))
              if (length(bests) > 1) {
                  if (trace) {
                    cat("There were ", length(bests), " thresholds values which minimize the SSR in the first search, the first one was taken\n")
                  }
                  bests <- bests[1]
              }
              beta_grid <- grid[bests, 1]
              bestGamma1 <- grid[bests, 2]
          }
          if (is.null(gamma1$exact) == FALSE & is.null(beta$exact) == 
              FALSE) {
              plot <- FALSE
          }
          if (plot) {
              if (!is.null(beta$exact) & is.null(gamma1$exact)) {
                  plot(gammas, store, type = "l", xlab = "Threshold parameter gamma", 
                    ylab = "Residual Sum of Squares", main = "Grid Search")
                  points(x = bestGamma1, y = min(store, na.rm = TRUE), 
                    col = 2, cex = 2)
              }
              if (is.null(beta$exact) & !is.null(gamma1$exact)) {
                  plot(betas, store, type = "l", xlab = "Cointegrating parameter beta", 
                    ylab = "Residual Sum of Squares", main = "Grid Search")
                  points(x = beta_grid, y = min(store, na.rm = TRUE), 
                    col = 2, cex = 2)
              }
              if (is.null(beta$exact) & is.null(gamma1$exact)) {
                  options(warn = -1)
                  betaRSS <- apply(store, 2, FUN = min, na.rm = TRUE)
                  gammaRSS <- apply(store, 1, FUN = min, na.rm = TRUE)
                  options(warn = 0)
                  gammaRSS[is.infinite(gammaRSS)] <- NA
                  betaRSS[is.infinite(betaRSS)] <- NA
                  layout(c(1, 2))
                  plot(gammas, gammaRSS, type = "l", xlab = "Threshold parameter gamma", 
                    ylab = "Residual Sum of Squares", main = "Grid Search")
                  points(x = bestGamma1, y = min(store, na.rm = TRUE), 
                    col = 2, cex = 2)
                  plot(betas, betaRSS, type = "l", xlab = "Cointegrating parameter beta", 
                    ylab = "Residual Sum of Squares")
                  abline(v = betaLT, lty = 3)
                  points(x = beta_grid, y = min(store, na.rm = TRUE), 
                    col = 2, cex = 2)
                  legend("topright", "OLS estimate from linear VECM", 
                    lty = 3, bg = "white")
              }
          }
          list(beta = beta_grid, gamma = bestGamma1)
      }
      if (nthresh == 1) {
          results <- oneSearch(betas, gammas)
          bestBeta <- results$beta
          bestThresh <- results$gamma
      }
      if (nthresh == 2) {
          two_Thresh <- function(betai, gam1, gam2) {
              ECTi <- Xminus1 %*% c(1, -betai) - beta0
              zi <- cbind(ECTi, DeltaX)
              d1 <- ifelse(ECTi <= gam1, 1, 0)
              n1 <- mean(d1)
              d2 <- ifelse(ECTi > gam2, 1, 0)
              n2 <- mean(d2)
              if (is.na(n1)) 
                  n1 <- n2 <- 0
              if (min(n1, n2, 1 - n1 - n2) > trim) {
                  ziUnder <- c(d1) * zi
                  ziOver <- c(d2) * zi
                  ziMiddle <- c(1 - d1 - d2) * zi
                  Z <- cbind(ziUnder, ziMiddle, ziOver)
                  LS <- try(crossprod(c(Y - tcrossprod(Z, crossprod(Y, 
                    Z) %*% solve(crossprod(Z))))), silent = TRUE)
                  if (inherits(LS, "try-error")) {
                    warning("Error when solving for value: gammas=", 
                      gam1, gam2, "and beta=", betai)
                    LS <- NA
                  }
              }
              else LS <- NA
              return(LS)
          }
          two_partial_Thresh <- function(betai, gam1, gam2) {
              ECTi <- Xminus1 %*% c(1, -betai) - beta0
              d1 <- ifelse(ECTi <= gam1, 1, 0)
              n1 <- mean(d1)
              d2 <- ifelse(ECTi > gam2, 1, 0)
              n2 <- mean(d2)
              if (is.na(n1)) {
                  n1 <- 0
                  n2 <- 0
              }
              if (min(n1, n2, 1 - n1 - n2) > trim) {
                  ectUnder <- c(d1) * ECTi
                  ectOver <- c(d2) * ECTi
                  Z <- cbind(ectUnder, ectOver, DeltaX)
                  result <- try(crossprod(c(Y - tcrossprod(Z, crossprod(Y, 
                    Z) %*% solve(crossprod(Z))))), silent = TRUE)
                  if (inherits(result, "try-error")) {
                    warning("Error when solving for value: gammas=", 
                      gam1, gam2, "and beta=", betai)
                    result <- NA
                  }
              }
              else result <- NA
              return(result)
          }
          bestone <- oneSearch(betas, gammas)
          bestThresh <- bestone$gamma
          bestBeta <- bestone$beta
          func <- switch(model, All = two_Thresh, only_ECT = two_partial_Thresh)
          if (trace) {
              cat("Best threshold from first search", bestThresh, 
                  "\n")
              cat("Best cointegrating value", bestBeta, "\n")
          }
          if (!is.null(gamma2$exact)) 
              secondBestThresh <- gamma2$exact
          if (is.null(gamma2$exact) & !is.numeric(gamma2$around)) {
              wh.thresh <- which.min(abs(allgammas - bestThresh))
              ninter <- round(trim * nrow(Xminus1))
              if (restr == "none") {
                  if (wh.thresh > 2 * ninter) {
                    gammaMinus <- allgammas[seq(from = ninter, 
                      to = wh.thresh - ninter)]
                    if (k > 2) {
                      storeMinus <- mapply(func, gam1 = gammaMinus, 
                        gam2 = bestThresh, MoreArgs = list(betai = bestBeta))
                    }
                    else {
                      storeMinus <- mapply(func, betai = bestBeta, 
                        gam1 = gammaMinus, gam2 = bestThresh)
                    }
                  }
                  else storeMinus <- NA
                  if (length(wh.thresh < length(allgammas) - 2 * 
                    ninter)) {
                    gammaPlus <- allgammas[seq(from = wh.thresh + 
                      ninter, to = length(allgammas) - ninter)]
                    storePlus <- mapply(func, gam2 = gammaPlus, 
                      MoreArgs = list(betai = bestBeta, gam1 = bestThresh))
                  }
                  else storePlus <- NA
              }
              else if (restr == "signOp") {
                  zero <- which.min(abs(allgammas))
                  if (sign(bestThresh) > 0) {
                    gammaMinus <- allgammas[seq(from = ninter, 
                      to = min(wh.thresh - ninter, zero))]
                    if (k > 2) {
                      storeMinus <- mapply(func, gam1 = gammaMinus, 
                        gam2 = bestThresh, MoreArgs = list(betai = bestBeta))
                    }
                    else {
                      storeMinus <- mapply(func, betai = bestBeta, 
                        gam1 = gammaMinus, gam2 = bestThresh)
                    }
                    storePlus <- NA
                  }
                  else {
                    gammaPlus <- allgammas[seq(from = max(wh.thresh + 
                      ninter, zero), to = length(allgammas) - ninter)]
                    if (k > 2) {
                      storePlus <- mapply(func, gam1 = bestThresh, 
                        gam2 = gammaPlus, MoreArgs = list(betai = bestBeta))
                    }
                    else {
                      storePlus <- mapply(func, betai = bestBeta, 
                        gam1 = bestThresh, gam2 = gammaPlus)
                    }
                    storeMinus <- NA
                  }
              }
              store2 <- c(storeMinus, storePlus)
              positionSecond <- which(store2 == min(store2, na.rm = TRUE))
              if (length(positionSecond) > 1) {
                  if (trace) 
                    cat("There were ", length(positionSecond), 
                      " thresholds values which minimize the SSR in the conditional step, the first one was taken\n")
              }
              positionSecond <- positionSecond[1]
              if (positionSecond <= length(storeMinus)) {
                  secondBestThresh <- gammaMinus[positionSecond]
              }
              else {
                  secondBestThresh <- gammaPlus[positionSecond - 
                    length(storeMinus)]
              }
              if (trace) 
                  cat("Second best (conditionnal on the first one)", 
                    c(bestThresh, secondBestThresh), "\t SSR", 
                    min(store2, na.rm = TRUE), "\n")
          }
          bestThresh <- bestThresh
          secondBestThresh <- secondBestThresh
          if (is.numeric(gamma2$around)) 
              secondBestThresh <- gamma2$around
          smallThresh <- min(bestThresh, secondBestThresh)
          gammasDown <- aroundGrid(around = smallThresh, allgammas, 
              ngrid = 30, trim = trim, trace = trace)
          bigThresh <- max(bestThresh, secondBestThresh)
          gammasUp <- aroundGrid(around = bigThresh, allgammas, 
              ngrid = 30, trim = trim, trace = trace)
          if (!is.null(gamma2$exact)) {
              if (gamma2$exact < bestThresh) 
                  gammasDown <- gamma2$exact
              if (gamma2$exact > bestThresh) 
                  gammasUp <- gamma2$exact
          }
          if (!is.null(gamma1$exact)) {
              if (gamma1$exact < secondBestThresh) 
                  gammasDown <- gamma1$exact
              if (gamma1$exact > secondBestThresh) 
                  gammasUp <- gamma1$exact
          }
          storeIter <- matrix(NA, ncol = length(gammasUp), nrow = length(gammasDown))
          for (i in seq_along(gammasDown)) {
              gam1 <- gammasDown[i]
              for (j in seq_along(gammasUp)) {
                  gam2 <- gammasUp[j]
                  storeIter[i, j] <- func(gam1 = gam1, gam2 = gam2, 
                    beta = bestBeta)
              }
          }
          positionIter <- which(storeIter == min(storeIter, na.rm = TRUE), 
              arr.ind = TRUE)
          if (nrow(positionIter) > 1) {
              if (trace) {
                  cat("There were ", length(positionIter), " thresholds values which minimize the SSR in the iterative step, the first one was taken\n")
                  positionIter <- positionIter[1, ]
              }
          }
          rIter <- positionIter[1]
          cIter <- positionIter[2]
          bestThresh1Iter <- gammasDown[rIter]
          bestThresh2Iter <- gammasUp[cIter]
          bestThresh <- c(bestThresh1Iter, bestThresh2Iter)
          if (trace) 
              cat("Second step best thresholds", bestThresh, "\t\t\t SSR", 
                  min(storeIter, na.rm = TRUE), "\n")
      }
      if (nthresh == 1) {
          ECT_best <- Xminus1 %*% c(1, -bestBeta) - beta0
          Z_temp <- cbind(ECT_best, DeltaX)
          d1 <- ifelse(ECT_best <= bestThresh, 1, 0)
          ndown <- mean(d1)
          nup <- 1 - ndown
          if (model == "All") {
              Zunder <- c(d1) * Z_temp
              if (dummyToBothRegimes == TRUE) {
                  Zover <- c(1 - d1) * Z_temp
              }
              else Zover <- Z_temp
              Zbest <- cbind(Zunder, Zover)
          }
          else {
              Zbest <- cbind(d1 * ECT_best, (1 - d1) * ECT_best, 
                  DeltaX)
          }
      }
      if (nthresh == 2) {
          ECT_best <- Xminus1 %*% c(1, -bestBeta) - beta0
          d1 <- ifelse(ECT_best <= bestThresh1Iter, 1, 0)
          ndown <- mean(d1)
          d2 <- ifelse(ECT_best > bestThresh2Iter, 1, 0)
          nup <- mean(d2)
          if (model == "All") {
              Z_temp <- cbind(ECT_best, DeltaX)
              Zunder <- c(d1) * Z_temp
              Zover <- c(d2) * Z_temp
              Zmiddle <- (1 - c(d1) - c(d2)) * Z_temp
              Zbest <- cbind(Zunder, Zmiddle, Zover)
          }
          else if (model == "only_ECT") {
              Zunder <- c(d1) * ECT_best
              Zover <- c(d2) * ECT_best
              Zbest <- cbind(Zunder, Zover, DeltaX)
          }
      }
      reg <- if (nthresh == 1) 
          d1 + 2 * (1 - d1)
      else d1 + 2 * (1 - d1 - d2) + 3 * d2
      regime <- c(rep(NA, T - t), reg)
      Bbest <- t(Y) %*% Zbest %*% solve(t(Zbest) %*% Zbest)
      allpar <- ncol(Bbest) * nrow(Bbest)
      fitted <- Zbest %*% t(Bbest)
      resbest <- Y - fitted
      rownames(Bbest) <- paste("Equation", colnames(data))
      DeltaXnames <- c(paste(rep(colnames(data), p), "t", -rep(1:p, 
          each = k)))
      Bcolnames <- c("ECT", switch(include, const = "Const", trend = "Trend", 
          both = c("Const", "Trend"), none = NULL), DeltaXnames)
      Blist <- nameB(Bbest, commonInter = ifelse(model == "All", 
          FALSE, TRUE), Bnames = Bcolnames, nthresh = nthresh, 
          npar = npar, model = "TVECM", TVECMmodel = model)
      BnamesVec <- if (class(Blist) == "list") 
          c(sapply(Blist, colnames))
      else colnames(Blist)
      colnames(Bbest) <- BnamesVec
      naX <- rbind(matrix(NA, ncol = ncol(Zbest), nrow = p + 1), 
          Zbest)
      YnaX <- cbind(data, naX)
      BlistMod <- nameB(Bbest, commonInter = ifelse(model == "All", 
          FALSE, TRUE), Bnames = Bcolnames, nthresh = nthresh, 
          npar = npar, model = "TVECM", TVECMmodel = model, sameName = FALSE)
      BnamesVecMod <- if (class(BlistMod) == "list") 
          c(sapply(BlistMod, colnames))
      else colnames(BlistMod)
      colnames(YnaX) <- c(colnames(data), BnamesVecMod)
      if (nthresh == 1) 
          nobs <- c(ndown = ndown, nup = nup)
      else if (nthresh == 2) 
          nobs <- c(ndown = ndown, nmiddle = 1 - nup - ndown, nup = nup)
      specific <- list()
      specific$Thresh <- bestThresh
      specific$threshEstim <- ifelse(is.null(gamma1), TRUE, FALSE)
      specific$nthresh <- nthresh
      specific$nreg <- nthresh + 1
      specific$beta <- bestBeta
      specific$coint <- matrix(c(1, -bestBeta), nrow = k, dimnames = list(colnames(data), 
          "r1"))
      specific$nrowB <- npar
      specific$nobs <- nobs
      specific$model <- model
      specific$oneMatrix <- ifelse(model == "only_ECT", TRUE, FALSE)
      specific$Bnames <- Bcolnames
      specific$regime <- regime
      specific$timeAttributes <- attributes(data[, 1])
      specific$LRinclude <- "none"
      specific$r <- 1
      z <- list(coefficients = Blist, residuals = resbest, model = YnaX, 
          coeffmat = Bbest, nobs_regimes = nobs, k = k, t = t, 
          T = T, nparB = allpar, fitted.values = fitted, lag = lag, 
          include = include, model.specific = specific)
      class(z) <- c("TVECM", "nlVar")
      attr(z, "varsLevel") <- "diff"
      attr(z, "model") <- model
      return(z)
  }
  <bytecode: 0x88c3ea0>
  <environment: namespace:tsDyn>
   --- function search by body ---
  Function TVECM in namespace tsDyn has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Error in if (class(Blist) == "list") c(sapply(Blist, colnames)) else colnames(Blist) : 
    the condition has length > 1
  Calls: TVECM
  Execution halted
Running the tests in 'tests/VAR.R' failed.
Complete output:
  > library(tsDyn)
  > 
  > 
  > data(zeroyld)
  > data(barry)
  > 
  > 
  > 
  > 
  > ## Test a few VAR models
  > var_l1_co <-lineVar(barry, lag=1, include="const")
  > var_l1_tr <-lineVar(barry, lag=1, include="trend")
  > var_l1_bo <-lineVar(barry, lag=1, include="both")
  > var_l1_no <-lineVar(barry, lag=1, include="none")
  > var_l1_coAsExo <-lineVar(barry, lag=1, include="none", exogen=rep(1, nrow(barry)))
  > 
  > var_l0_co <-lineVar(barry, lag=0, include="const")
  Warning message:
  In lineVar(barry, lag = 0, include = "const") :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > var_l0_tr <-lineVar(barry, lag=0, include="trend")
  Warning message:
  In lineVar(barry, lag = 0, include = "trend") :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > var_l0_bo <-lineVar(barry, lag=0, include="both")
  Warning message:
  In lineVar(barry, lag = 0, include = "both") :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > var_l0_coAsExo <-lineVar(barry, lag=0, include="trend", exogen=rep(1, nrow(barry)))
  Warning message:
  In lineVar(barry, lag = 0, include = "trend", exogen = rep(1, nrow(barry))) :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > 
  > var_l3_co <-lineVar(barry, lag=3, include="const")
  > var_l3_tr <-lineVar(barry, lag=3, include="trend")
  > var_l3_bo <-lineVar(barry, lag=3, include="both")
  > var_l3_no <-lineVar(barry, lag=3, include="none")
  > var_l3_coAsExo <-lineVar(barry, lag=3, include="none", exogen=rep(1, nrow(barry)))
  > 
  > var_l2_diff_co <-lineVar(barry, lag=2, include="const", I="diff")
  > var_l2_diff_tr <-lineVar(barry, lag=2, include="trend", I="diff")
  > var_l2_diff_bo <-lineVar(barry, lag=2, include="both", I="diff")
  > var_l2_diff_no <-lineVar(barry, lag=2, include="none", I="diff")
  > var_l2_diff_coAsExo <-lineVar(barry, lag=2, include="none", I="diff", exogen=rep(1, nrow(barry)))
  > 
  > var_l2_adf_co <-lineVar(barry, lag=2, include="const", I="ADF")
  > var_l2_adf_tr <-lineVar(barry, lag=2, include="trend", I="ADF")
  > var_l2_adf_bo <-lineVar(barry, lag=2, include="both", I="ADF")
  > var_l2_adf_no <-lineVar(barry, lag=2, include="none", I="ADF")
  > var_l2_adf_coAsExo <-lineVar(barry, lag=2, include="none", I="ADF", exogen=rep(1, nrow(barry)))
  > 
  > 
  > var_all <- list(
  + 		var_l1_co, var_l1_tr, var_l1_bo, var_l1_no, var_l1_coAsExo,
  + 		var_l0_co, var_l0_tr, var_l0_bo, var_l0_coAsExo,
  + 		var_l3_co, var_l3_tr, var_l3_bo, var_l3_no, var_l3_coAsExo,
  + 		var_l2_diff_co, var_l2_diff_tr, var_l2_diff_bo, var_l2_diff_no, var_l2_diff_coAsExo,
  + 		var_l2_adf_co, var_l2_adf_tr, var_l2_adf_bo, var_l2_adf_no, var_l2_adf_coAsExo)
  > 
  > 
  > names(var_all) <-c(
  + 		"var_l1_co", "var_l1_tr", "var_l1_bo", "var_l1_no", "var_l1_coAsExo",
  + 		"var_l0_co", "var_l0_tr", "var_l0_bo",  "var_l0_coAsExo",
  + 		"var_l3_co", "var_l3_tr", "var_l3_bo", "var_l3_no", "var_l3_coAsExo",
  + 		"var_l2_diff_co", "var_l2_diff_tr", "var_l2_diff_bo", "var_l2_diff_no", "var_l2_diff_coAsExo",
  + 		"var_l2_adf_co", "var_l2_adf_tr", "var_l2_adf_bo", "var_l2_adf_no","var_l2_adf_coAsExo")
  > 
  > 
  > ## Check methods:
  > lapply(var_all, print)
                   Intercept   dolcan -1     cpiUSA -1     cpiCAN -1
  Equation dolcan 0.01606226  0.98184934  0.0006535181 -0.0005441472
  Equation cpiUSA 0.47682275 -0.17515457  1.0034816358 -0.0035567095
  Equation cpiCAN 0.33858157  0.07511337 -0.0023545869  0.9998414195
                          Trend  dolcan -1   cpiUSA -1     cpiCAN -1
  Equation dolcan -0.0001267674  0.9842553 0.001245808 -0.0006663591
  Equation cpiUSA -0.0031568297 -0.0330855 1.017304394 -0.0060219580
  Equation cpiCAN -0.0049290069 -0.1371091 0.024124244  0.9929378172
                     Intercept         Trend   dolcan -1   cpiUSA -1
  Equation dolcan  0.007388597 -8.622274e-05  0.98107844 0.001083529
  Equation cpiUSA  0.355501243 -1.206028e-03 -0.18593743 1.009496344
  Equation cpiCAN -0.351032771 -6.855288e-03  0.01382157 0.031834151
                      cpiCAN -1
  Equation dolcan -0.0006442119
  Equation cpiUSA -0.0049563493
  Equation cpiCAN  0.9918856026
                  dolcan -1     cpiUSA -1     cpiCAN -1
  Equation dolcan 0.9990246  0.0004597724 -4.232838e-04
  Equation cpiUSA 0.3347079  0.9977301171  3.123187e-05
  Equation cpiCAN 0.4371558 -0.0064386166  1.002389e+00
                    dolcan -1     cpiUSA -1     cpiCAN -1      exo_1
  Equation dolcan  0.98184934  0.0006535181 -0.0005441472 0.01606226
  Equation cpiUSA -0.17515457  1.0034816358 -0.0035567095 0.47682275
  Equation cpiCAN  0.07511337 -0.0023545869  0.9998414195 0.33858157
                  Intercept
  Equation dolcan  1.231588
  Equation cpiUSA 71.664414
  Equation cpiCAN 71.804784
                        Trend
  Equation dolcan 0.006009626
  Equation cpiUSA 0.397201333
  Equation cpiCAN 0.400004285
                  Intercept       Trend
  Equation dolcan  1.024833 0.001272341
  Equation cpiUSA 28.609033 0.264956187
  Equation cpiCAN 27.342742 0.273612566
                        Trend     exo_1
  Equation dolcan 0.001272341  1.024833
  Equation cpiUSA 0.264956187 28.609033
  Equation cpiCAN 0.273612566 27.342742
                  Intercept dolcan -1    cpiUSA -1     cpiCAN -1  dolcan -2
  Equation dolcan 0.0213132 1.1426667 -0.002923395 -5.319548e-05 -0.1947679
  Equation cpiUSA 0.2297914 0.6115380  1.473715592 -3.413037e-02 -1.2214788
  Equation cpiCAN 0.1465491 0.4721442  0.279405971  9.752629e-01 -0.6781416
                     cpiUSA -2    cpiCAN -2  dolcan -3     cpiUSA -3    cpiCAN -3
  Equation dolcan  0.003242556 -0.007019863 0.03224004  0.0002842096  0.006567983
  Equation cpiUSA -0.497252953  0.109356758 0.54022104  0.0237898926 -0.075679565
  Equation cpiCAN -0.269165141  0.196158934 0.33685344 -0.0136459464 -0.170361820
                          Trend dolcan -1    cpiUSA -1    cpiCAN -1  dolcan -2
  Equation dolcan -0.0001881242 1.1378299 -0.002052383 -0.001345096 -0.1939782
  Equation cpiUSA -0.0009482088 0.6932990  1.485950589 -0.039084647 -1.2536289
  Equation cpiCAN -0.0033032731 0.1897148  0.280103019  0.949680615 -0.5970450
                     cpiUSA -2    cpiCAN -2  dolcan -3    cpiUSA -3    cpiCAN -3
  Equation dolcan  0.002896672 -0.007040656 0.03788217 0.0006495858  0.007690921
  Equation cpiUSA -0.498754452  0.109946225 0.62254152 0.0160737108 -0.071308210
  Equation cpiCAN -0.275688578  0.194501980 0.33566340 0.0105541670 -0.148246352
                     Intercept         Trend dolcan -1    cpiUSA -1   cpiCAN -1
  Equation dolcan  0.006752721 -0.0001508005 1.1366000 -0.002387016 -0.00112091
  Equation cpiUSA  0.296441336  0.0006902825 0.6393083  1.471260344 -0.02924296
  Equation cpiCAN -0.369694108 -0.0053466472 0.2570470  0.298423330  0.93740698
                   dolcan -2    cpiUSA -2    cpiCAN -2  dolcan -3    cpiUSA -3
  Equation dolcan -0.1933896  0.002960306 -0.007050852 0.03565128 0.0007742571
  Equation cpiUSA -1.2277882 -0.495960965  0.109498610 0.52460627 0.0215467227
  Equation cpiCAN -0.6292711 -0.279172354  0.195060204 0.45779914 0.0037287348
                     cpiCAN -3
  Equation dolcan  0.007494714
  Equation cpiUSA -0.079921633
  Equation cpiCAN -0.137504492
                  dolcan -1    cpiUSA -1     cpiCAN -1  dolcan -2    cpiUSA -2
  Equation dolcan 1.1611539 -0.001557016  0.0002180556 -0.2010610  0.003284684
  Equation cpiUSA 0.8108598  1.488447400 -0.0312058403 -1.2893289 -0.496798740
  Equation cpiCAN 0.5992614  0.288801154  0.9771279999 -0.7214129 -0.268875467
                     cpiCAN -2  dolcan -3    cpiUSA -3    cpiCAN -3
  Equation dolcan -0.006898937 0.04162504 -0.001380531  0.006343534
  Equation cpiUSA  0.110660533 0.64140684  0.005841242 -0.078099491
  Equation cpiCAN  0.196990414 0.40138450 -0.025092665 -0.171905123
                  dolcan -1    cpiUSA -1     cpiCAN -1  dolcan -2    cpiUSA -2
  Equation dolcan 1.1426667 -0.002923395 -5.319548e-05 -0.1947679  0.003242556
  Equation cpiUSA 0.6115380  1.473715592 -3.413037e-02 -1.2214788 -0.497252953
  Equation cpiCAN 0.4721442  0.279405971  9.752629e-01 -0.6781416 -0.269165141
                     cpiCAN -2  dolcan -3     cpiUSA -3    cpiCAN -3     exo_1
  Equation dolcan -0.007019863 0.03224004  0.0002842096  0.006567983 0.0213132
  Equation cpiUSA  0.109356758 0.54022104  0.0237898926 -0.075679565 0.2297914
  Equation cpiCAN  0.196158934 0.33685344 -0.0136459464 -0.170361820 0.1465491
                    Intercept dolcan -1    cpiUSA -1     cpiCAN -1   dolcan -2
  Equation dolcan 0.003381125 0.1617849 -0.002353031 -0.0001260648 -0.03741108
  Equation cpiUSA 0.122912595 0.6790979  0.479686920 -0.0255459970 -0.57705874
  Equation cpiCAN 0.122931337 0.4349111  0.289182756  0.0073892530 -0.27376324
                     cpiUSA -2    cpiCAN -2
  Equation dolcan  0.001311048 -0.007055727
  Equation cpiUSA -0.020762565  0.084046495
  Equation cpiCAN  0.005901144  0.203559141
                         Trend dolcan -1     cpiUSA -1   cpiCAN -1   dolcan -2
  Equation dolcan 6.881061e-06 0.1700795 -0.0000530234 0.001237383 -0.03274944
  Equation cpiUSA 2.664988e-04 0.9706962  0.5601041675 0.023760364 -0.41527155
  Equation cpiCAN 1.112911e-04 0.8208368  0.3999317151 0.059156879 -0.03909198
                    cpiUSA -2    cpiCAN -2
  Equation dolcan 0.003147651 -0.005464321
  Equation cpiUSA 0.042855080  0.141273505
  Equation cpiCAN 0.099407996  0.266724853
                    Intercept         Trend dolcan -1    cpiUSA -1   cpiCAN -1
  Equation dolcan 0.004385404 -4.912709e-06 0.1610634 -0.002475913 -0.00048570
  Equation cpiUSA 0.151995174 -1.422654e-04 0.6582061  0.476128424 -0.03596055
  Equation cpiCAN 0.222507194 -4.871027e-04 0.3633795  0.276998818 -0.02826914
                    dolcan -2    cpiUSA -2    cpiCAN -2
  Equation dolcan -0.03744932  0.001317679 -0.007418833
  Equation cpiUSA -0.57816617 -0.020570538  0.073531416
  Equation cpiCAN -0.27755496  0.006558625  0.167556559
                  dolcan -1   cpiUSA -1  cpiCAN -1   dolcan -2   cpiUSA -2
  Equation dolcan 0.1742584 0.001290824 0.00134614 -0.02952010 0.004471999
  Equation cpiUSA 1.1325421 0.612150449 0.02797246 -0.29020130 0.094146156
  Equation cpiCAN 0.8884244 0.421666484 0.06091587  0.01313794 0.120827387
                     cpiCAN -2
  Equation dolcan -0.005201487
  Equation cpiUSA  0.151452883
  Equation cpiCAN  0.270975808
                  dolcan -1    cpiUSA -1     cpiCAN -1   dolcan -2    cpiUSA -2
  Equation dolcan 0.1617849 -0.002353031 -0.0001260648 -0.03741108  0.001311048
  Equation cpiUSA 0.6790979  0.479686920 -0.0255459970 -0.57705874 -0.020762565
  Equation cpiCAN 0.4349111  0.289182756  0.0073892530 -0.27376324  0.005901144
                     cpiCAN -2       exo_1
  Equation dolcan -0.007055727 0.003381125
  Equation cpiUSA  0.084046495 0.122912595
  Equation cpiCAN  0.203559141 0.122931337
                  Intercept    dolcan-1      cpiUSA-1      cpiCAN-1 D_dolcan -1
  Equation dolcan 0.0213132 -0.01986115  0.0006033709 -0.0005050753   0.1625279
  Equation cpiUSA 0.2297914 -0.06971973  0.0002525317 -0.0004531813   0.6812577
  Equation cpiCAN 0.1465491  0.13085606 -0.0034051167  0.0010599980   0.3412882
                   D_cpiUSA -1   D_cpiCAN -1 D_dolcan -2   D_cpiUSA -2
  Equation dolcan -0.003526765  0.0004518798 -0.03224004 -0.0002842096
  Equation cpiUSA  0.473463061 -0.0336771926 -0.54022104 -0.0237898926
  Equation cpiCAN  0.282811088 -0.0257971141 -0.33685344  0.0136459464
                   D_cpiCAN -2
  Equation dolcan -0.006567983
  Equation cpiUSA  0.075679565
  Equation cpiCAN  0.170361820
                          Trend    dolcan-1    cpiUSA-1      cpiCAN-1 D_dolcan -1
  Equation dolcan -0.0001881242 -0.01826616 0.001493875 -0.0006948306   0.1560960
  Equation cpiUSA -0.0009482088  0.06221155 0.003269849 -0.0004466327   0.6310874
  Equation cpiCAN -0.0033032731 -0.07166682 0.014968609 -0.0040637573   0.2613816
                   D_cpiUSA -1   D_cpiCAN -1 D_dolcan -2   D_cpiUSA -2
  Equation dolcan -0.003546258 -0.0006502656 -0.03788217 -0.0006495858
  Equation cpiUSA  0.482680741 -0.0386380146 -0.62254152 -0.0160737108
  Equation cpiCAN  0.265134411 -0.0462556278 -0.33566340 -0.0105541670
                   D_cpiCAN -2
  Equation dolcan -0.007690921
  Equation cpiUSA  0.071308210
  Equation cpiCAN  0.148246352
                     Intercept         Trend    dolcan-1     cpiUSA-1
  Equation dolcan  0.006752721 -0.0001508005 -0.02113829  0.001347547
  Equation cpiUSA  0.296441336  0.0006902825 -0.06387369 -0.003153899
  Equation cpiCAN -0.369694108 -0.0053466472  0.08557500  0.022979710
                       cpiCAN-1 D_dolcan -1  D_cpiUSA -1   D_cpiCAN -1
  Equation dolcan -0.0006770479   0.1577383 -0.003734563 -0.0004438617
  Equation cpiUSA  0.0003340156   0.7031820  0.474414243 -0.0295769776
  Equation cpiCAN -0.0050373093   0.1714720  0.275443620 -0.0575557118
                  D_dolcan -2   D_cpiUSA -2  D_cpiCAN -2
  Equation dolcan -0.03565128 -0.0007742571 -0.007494714
  Equation cpiUSA -0.52460627 -0.0215467227  0.079921633
  Equation cpiCAN -0.45779914 -0.0037287348  0.137504492
                     dolcan-1      cpiUSA-1      cpiCAN-1 D_dolcan -1
  Equation dolcan 0.001717879  0.0003471365 -0.0003373473   0.1594360
  Equation cpiUSA 0.162937785 -0.0025100975  0.0013552021   0.6479220
  Equation cpiCAN 0.279232965 -0.0051669784  0.0022132913   0.3200284
                   D_cpiUSA -1   D_cpiCAN -1 D_dolcan -2  D_cpiUSA -2
  Equation dolcan -0.001904153  0.0005554029 -0.04162504  0.001380531
  Equation cpiUSA  0.490957498 -0.0325610424 -0.64140684 -0.005841242
  Equation cpiCAN  0.293968133 -0.0250852914 -0.40138450  0.025092665
                   D_cpiCAN -2
  Equation dolcan -0.006343534
  Equation cpiUSA  0.078099491
  Equation cpiCAN  0.171905123
                     dolcan-1      cpiUSA-1      cpiCAN-1 D_dolcan -1
  Equation dolcan -0.01986115  0.0006033709 -0.0005050753   0.1625279
  Equation cpiUSA -0.06971973  0.0002525317 -0.0004531813   0.6812577
  Equation cpiCAN  0.13085606 -0.0034051167  0.0010599980   0.3412882
                   D_cpiUSA -1   D_cpiCAN -1 D_dolcan -2   D_cpiUSA -2
  Equation dolcan -0.003526765  0.0004518798 -0.03224004 -0.0002842096
  Equation cpiUSA  0.473463061 -0.0336771926 -0.54022104 -0.0237898926
  Equation cpiCAN  0.282811088 -0.0257971141 -0.33685344  0.0136459464
                   D_cpiCAN -2     exo_1
  Equation dolcan -0.006567983 0.0213132
  Equation cpiUSA  0.075679565 0.2297914
  Equation cpiCAN  0.170361820 0.1465491
  $var_l1_co
                   Intercept   dolcan -1     cpiUSA -1     cpiCAN -1
  Equation dolcan 0.01606226  0.98184934  0.0006535181 -0.0005441472
  Equation cpiUSA 0.47682275 -0.17515457  1.0034816358 -0.0035567095
  Equation cpiCAN 0.33858157  0.07511337 -0.0023545869  0.9998414195
  
  $var_l1_tr
                          Trend  dolcan -1   cpiUSA -1     cpiCAN -1
  Equation dolcan -0.0001267674  0.9842553 0.001245808 -0.0006663591
  Equation cpiUSA -0.0031568297 -0.0330855 1.017304394 -0.0060219580
  Equation cpiCAN -0.0049290069 -0.1371091 0.024124244  0.9929378172
  
  $var_l1_bo
                     Intercept         Trend   dolcan -1   cpiUSA -1
  Equation dolcan  0.007388597 -8.622274e-05  0.98107844 0.001083529
  Equation cpiUSA  0.355501243 -1.206028e-03 -0.18593743 1.009496344
  Equation cpiCAN -0.351032771 -6.855288e-03  0.01382157 0.031834151
                      cpiCAN -1
  Equation dolcan -0.0006442119
  Equation cpiUSA -0.0049563493
  Equation cpiCAN  0.9918856026
  
  $var_l1_no
                  dolcan -1     cpiUSA -1     cpiCAN -1
  Equation dolcan 0.9990246  0.0004597724 -4.232838e-04
  Equation cpiUSA 0.3347079  0.9977301171  3.123187e-05
  Equation cpiCAN 0.4371558 -0.0064386166  1.002389e+00
  
  $var_l1_coAsExo
                    dolcan -1     cpiUSA -1     cpiCAN -1      exo_1
  Equation dolcan  0.98184934  0.0006535181 -0.0005441472 0.01606226
  Equation cpiUSA -0.17515457  1.0034816358 -0.0035567095 0.47682275
  Equation cpiCAN  0.07511337 -0.0023545869  0.9998414195 0.33858157
  
  $var_l0_co
                  Intercept
  Equation dolcan  1.231588
  Equation cpiUSA 71.664414
  Equation cpiCAN 71.804784
  
  $var_l0_tr
                        Trend
  Equation dolcan 0.006009626
  Equation cpiUSA 0.397201333
  Equation cpiCAN 0.400004285
  
  $var_l0_bo
                  Intercept       Trend
  Equation dolcan  1.024833 0.001272341
  Equation cpiUSA 28.609033 0.264956187
  Equation cpiCAN 27.342742 0.273612566
  
  $var_l0_coAsExo
                        Trend     exo_1
  Equation dolcan 0.001272341  1.024833
  Equation cpiUSA 0.264956187 28.609033
  Equation cpiCAN 0.273612566 27.342742
  
  $var_l3_co
                  Intercept dolcan -1    cpiUSA -1     cpiCAN -1  dolcan -2
  Equation dolcan 0.0213132 1.1426667 -0.002923395 -5.319548e-05 -0.1947679
  Equation cpiUSA 0.2297914 0.6115380  1.473715592 -3.413037e-02 -1.2214788
  Equation cpiCAN 0.1465491 0.4721442  0.279405971  9.752629e-01 -0.6781416
                     cpiUSA -2    cpiCAN -2  dolcan -3     cpiUSA -3    cpiCAN -3
  Equation dolcan  0.003242556 -0.007019863 0.03224004  0.0002842096  0.006567983
  Equation cpiUSA -0.497252953  0.109356758 0.54022104  0.0237898926 -0.075679565
  Equation cpiCAN -0.269165141  0.196158934 0.33685344 -0.0136459464 -0.170361820
  
  $var_l3_tr
                          Trend dolcan -1    cpiUSA -1    cpiCAN -1  dolcan -2
  Equation dolcan -0.0001881242 1.1378299 -0.002052383 -0.001345096 -0.1939782
  Equation cpiUSA -0.0009482088 0.6932990  1.485950589 -0.039084647 -1.2536289
  Equation cpiCAN -0.0033032731 0.1897148  0.280103019  0.949680615 -0.5970450
                     cpiUSA -2    cpiCAN -2  dolcan -3    cpiUSA -3    cpiCAN -3
  Equation dolcan  0.002896672 -0.007040656 0.03788217 0.0006495858  0.007690921
  Equation cpiUSA -0.498754452  0.109946225 0.62254152 0.0160737108 -0.071308210
  Equation cpiCAN -0.275688578  0.194501980 0.33566340 0.0105541670 -0.148246352
  
  $var_l3_bo
                     Intercept         Trend dolcan -1    cpiUSA -1   cpiCAN -1
  Equation dolcan  0.006752721 -0.0001508005 1.1366000 -0.002387016 -0.00112091
  Equation cpiUSA  0.296441336  0.0006902825 0.6393083  1.471260344 -0.02924296
  Equation cpiCAN -0.369694108 -0.0053466472 0.2570470  0.298423330  0.93740698
                   dolcan -2    cpiUSA -2    cpiCAN -2  dolcan -3    cpiUSA -3
  Equation dolcan -0.1933896  0.002960306 -0.007050852 0.03565128 0.0007742571
  Equation cpiUSA -1.2277882 -0.495960965  0.109498610 0.52460627 0.0215467227
  Equation cpiCAN -0.6292711 -0.279172354  0.195060204 0.45779914 0.0037287348
                     cpiCAN -3
  Equation dolcan  0.007494714
  Equation cpiUSA -0.079921633
  Equation cpiCAN -0.137504492
  
  $var_l3_no
                  dolcan -1    cpiUSA -1     cpiCAN -1  dolcan -2    cpiUSA -2
  Equation dolcan 1.1611539 -0.001557016  0.0002180556 -0.2010610  0.003284684
  Equation cpiUSA 0.8108598  1.488447400 -0.0312058403 -1.2893289 -0.496798740
  Equation cpiCAN 0.5992614  0.288801154  0.9771279999 -0.7214129 -0.268875467
                     cpiCAN -2  dolcan -3    cpiUSA -3    cpiCAN -3
  Equation dolcan -0.006898937 0.04162504 -0.001380531  0.006343534
  Equation cpiUSA  0.110660533 0.64140684  0.005841242 -0.078099491
  Equation cpiCAN  0.196990414 0.40138450 -0.025092665 -0.171905123
  
  $var_l3_coAsExo
                  dolcan -1    cpiUSA -1     cpiCAN -1  dolcan -2    cpiUSA -2
  Equation dolcan 1.1426667 -0.002923395 -5.319548e-05 -0.1947679  0.003242556
  Equation cpiUSA 0.6115380  1.473715592 -3.413037e-02 -1.2214788 -0.497252953
  Equation cpiCAN 0.4721442  0.279405971  9.752629e-01 -0.6781416 -0.269165141
                     cpiCAN -2  dolcan -3     cpiUSA -3    cpiCAN -3     exo_1
  Equation dolcan -0.007019863 0.03224004  0.0002842096  0.006567983 0.0213132
  Equation cpiUSA  0.109356758 0.54022104  0.0237898926 -0.075679565 0.2297914
  Equation cpiCAN  0.196158934 0.33685344 -0.0136459464 -0.170361820 0.1465491
  
  $var_l2_diff_co
                    Intercept dolcan -1    cpiUSA -1     cpiCAN -1   dolcan -2
  Equation dolcan 0.003381125 0.1617849 -0.002353031 -0.0001260648 -0.03741108
  Equation cpiUSA 0.122912595 0.6790979  0.479686920 -0.0255459970 -0.57705874
  Equation cpiCAN 0.122931337 0.4349111  0.289182756  0.0073892530 -0.27376324
                     cpiUSA -2    cpiCAN -2
  Equation dolcan  0.001311048 -0.007055727
  Equation cpiUSA -0.020762565  0.084046495
  Equation cpiCAN  0.005901144  0.203559141
  
  $var_l2_diff_tr
                         Trend dolcan -1     cpiUSA -1   cpiCAN -1   dolcan -2
  Equation dolcan 6.881061e-06 0.1700795 -0.0000530234 0.001237383 -0.03274944
  Equation cpiUSA 2.664988e-04 0.9706962  0.5601041675 0.023760364 -0.41527155
  Equation cpiCAN 1.112911e-04 0.8208368  0.3999317151 0.059156879 -0.03909198
                    cpiUSA -2    cpiCAN -2
  Equation dolcan 0.003147651 -0.005464321
  Equation cpiUSA 0.042855080  0.141273505
  Equation cpiCAN 0.099407996  0.266724853
  
  $var_l2_diff_bo
                    Intercept         Trend dolcan -1    cpiUSA -1   cpiCAN -1
  Equation dolcan 0.004385404 -4.912709e-06 0.1610634 -0.002475913 -0.00048570
  Equation cpiUSA 0.151995174 -1.422654e-04 0.6582061  0.476128424 -0.03596055
  Equation cpiCAN 0.222507194 -4.871027e-04 0.3633795  0.276998818 -0.02826914
                    dolcan -2    cpiUSA -2    cpiCAN -2
  Equation dolcan -0.03744932  0.001317679 -0.007418833
  Equation cpiUSA -0.57816617 -0.020570538  0.073531416
  Equation cpiCAN -0.27755496  0.006558625  0.167556559
  
  $var_l2_diff_no
                  dolcan -1   cpiUSA -1  cpiCAN -1   dolcan -2   cpiUSA -2
  Equation dolcan 0.1742584 0.001290824 0.00134614 -0.02952010 0.004471999
  Equation cpiUSA 1.1325421 0.612150449 0.02797246 -0.29020130 0.094146156
  Equation cpiCAN 0.8884244 0.421666484 0.06091587  0.01313794 0.120827387
                     cpiCAN -2
  Equation dolcan -0.005201487
  Equation cpiUSA  0.151452883
  Equation cpiCAN  0.270975808
  
  $var_l2_diff_coAsExo
                  dolcan -1    cpiUSA -1     cpiCAN -1   dolcan -2    cpiUSA -2
  Equation dolcan 0.1617849 -0.002353031 -0.0001260648 -0.03741108  0.001311048
  Equation cpiUSA 0.6790979  0.479686920 -0.0255459970 -0.57705874 -0.020762565
  Equation cpiCAN 0.4349111  0.289182756  0.0073892530 -0.27376324  0.005901144
                     cpiCAN -2       exo_1
  Equation dolcan -0.007055727 0.003381125
  Equation cpiUSA  0.084046495 0.122912595
  Equation cpiCAN  0.203559141 0.122931337
  
  $var_l2_adf_co
                  Intercept    dolcan-1      cpiUSA-1      cpiCAN-1 D_dolcan -1
  Equation dolcan 0.0213132 -0.01986115  0.0006033709 -0.0005050753   0.1625279
  Equation cpiUSA 0.2297914 -0.06971973  0.0002525317 -0.0004531813   0.6812577
  Equation cpiCAN 0.1465491  0.13085606 -0.0034051167  0.0010599980   0.3412882
                   D_cpiUSA -1   D_cpiCAN -1 D_dolcan -2   D_cpiUSA -2
  Equation dolcan -0.003526765  0.0004518798 -0.03224004 -0.0002842096
  Equation cpiUSA  0.473463061 -0.0336771926 -0.54022104 -0.0237898926
  Equation cpiCAN  0.282811088 -0.0257971141 -0.33685344  0.0136459464
                   D_cpiCAN -2
  Equation dolcan -0.006567983
  Equation cpiUSA  0.075679565
  Equation cpiCAN  0.170361820
  
  $var_l2_adf_tr
                          Trend    dolcan-1    cpiUSA-1      cpiCAN-1 D_dolcan -1
  Equation dolcan -0.0001881242 -0.01826616 0.001493875 -0.0006948306   0.1560960
  Equation cpiUSA -0.0009482088  0.06221155 0.003269849 -0.0004466327   0.6310874
  Equation cpiCAN -0.0033032731 -0.07166682 0.014968609 -0.0040637573   0.2613816
                   D_cpiUSA -1   D_cpiCAN -1 D_dolcan -2   D_cpiUSA -2
  Equation dolcan -0.003546258 -0.0006502656 -0.03788217 -0.0006495858
  Equation cpiUSA  0.482680741 -0.0386380146 -0.62254152 -0.0160737108
  Equation cpiCAN  0.265134411 -0.0462556278 -0.33566340 -0.0105541670
                   D_cpiCAN -2
  Equation dolcan -0.007690921
  Equation cpiUSA  0.071308210
  Equation cpiCAN  0.148246352
  
  $var_l2_adf_bo
                     Intercept         Trend    dolcan-1     cpiUSA-1
  Equation dolcan  0.006752721 -0.0001508005 -0.02113829  0.001347547
  Equation cpiUSA  0.296441336  0.0006902825 -0.06387369 -0.003153899
  Equation cpiCAN -0.369694108 -0.0053466472  0.08557500  0.022979710
                       cpiCAN-1 D_dolcan -1  D_cpiUSA -1   D_cpiCAN -1
  Equation dolcan -0.0006770479   0.1577383 -0.003734563 -0.0004438617
  Equation cpiUSA  0.0003340156   0.7031820  0.474414243 -0.0295769776
  Equation cpiCAN -0.0050373093   0.1714720  0.275443620 -0.0575557118
                  D_dolcan -2   D_cpiUSA -2  D_cpiCAN -2
  Equation dolcan -0.03565128 -0.0007742571 -0.007494714
  Equation cpiUSA -0.52460627 -0.0215467227  0.079921633
  Equation cpiCAN -0.45779914 -0.0037287348  0.137504492
  
  $var_l2_adf_no
                     dolcan-1      cpiUSA-1      cpiCAN-1 D_dolcan -1
  Equation dolcan 0.001717879  0.0003471365 -0.0003373473   0.1594360
  Equation cpiUSA 0.162937785 -0.0025100975  0.0013552021   0.6479220
  Equation cpiCAN 0.279232965 -0.0051669784  0.0022132913   0.3200284
                   D_cpiUSA -1   D_cpiCAN -1 D_dolcan -2  D_cpiUSA -2
  Equation dolcan -0.001904153  0.0005554029 -0.04162504  0.001380531
  Equation cpiUSA  0.490957498 -0.0325610424 -0.64140684 -0.005841242
  Equation cpiCAN  0.293968133 -0.0250852914 -0.40138450  0.025092665
                   D_cpiCAN -2
  Equation dolcan -0.006343534
  Equation cpiUSA  0.078099491
  Equation cpiCAN  0.171905123
  
  $var_l2_adf_coAsExo
                     dolcan-1      cpiUSA-1      cpiCAN-1 D_dolcan -1
  Equation dolcan -0.01986115  0.0006033709 -0.0005050753   0.1625279
  Equation cpiUSA -0.06971973  0.0002525317 -0.0004531813   0.6812577
  Equation cpiCAN  0.13085606 -0.0034051167  0.0010599980   0.3412882
                   D_cpiUSA -1   D_cpiCAN -1 D_dolcan -2   D_cpiUSA -2
  Equation dolcan -0.003526765  0.0004518798 -0.03224004 -0.0002842096
  Equation cpiUSA  0.473463061 -0.0336771926 -0.54022104 -0.0237898926
  Equation cpiCAN  0.282811088 -0.0257971141 -0.33685344  0.0136459464
                   D_cpiCAN -2     exo_1
  Equation dolcan -0.006567983 0.0213132
  Equation cpiUSA  0.075679565 0.2297914
  Equation cpiCAN  0.170361820 0.1465491
  
  > lapply(var_all, summary)
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  tsDyn
   --- call from context --- 
  myformat(betas, digits)
   --- call from argument --- 
  if (class(x) == "numeric") return(noquote(r))
   --- R stacktrace ---
  where 1: myformat(betas, digits)
  where 2: paste(myformat(betas, digits), "(", myformat(StDevB, digits), 
      ")", stars, sep = "")
  where 3: matrix(paste(myformat(betas, digits), "(", myformat(StDevB, digits), 
      ")", stars, sep = ""), nrow = nrow(Pval))
  where 4: summary.VAR(X[[i]], ...)
  where 5: FUN(X[[i]], ...)
  where 6: lapply(var_all, summary)
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (x, digits, toLatex = FALSE) 
  {
      r <- x
      littlex <- abs(x) < 10^-(digits)
      r[!littlex] <- formatC(x[!littlex], digits = digits, format = "f")
      r[littlex] <- format(x[littlex], digits = min(digits, 2), 
          scientific = TRUE)
      if (toLatex) 
          r <- gsub("(e.*)", "slashtext{\\1}", r)
      if (class(x) == "numeric") 
          return(noquote(r))
      if (class(x) == "matrix") 
          return(matrix(noquote(r), ncol = ncol(x), nrow = nrow(x)))
  }
  <bytecode: 0x41548a8>
  <environment: namespace:tsDyn>
   --- function search by body ---
  Function myformat in namespace tsDyn has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Error in if (class(x) == "numeric") return(noquote(r)) : 
    the condition has length > 1
  Calls: lapply -> FUN -> summary.VAR -> matrix -> paste -> myformat
  Execution halted
Running the tests in 'tests/VECM.R' failed.
Complete output:
  > library(tsDyn)
  > 
  > 
  > data(zeroyld)
  > data(barry)
  > 
  > 
  > 
  > 
  > ## Test a few VECM models
  > vecm_OLS_l1_co <-VECM(barry, lag=1)
  > vecm_OLS_l3_co <-VECM(barry, lag=3, include="const")
  > vecm_OLS_l3_co_betaGiven<-VECM(barry, lag=3, include="const", beta=c(0.1, -0.05))
  > vecm_OLS_l1_tr <-VECM(barry, lag=1, include="trend")
  > vecm_OLS_l1_bo <-VECM(barry, lag=1, include="both")
  > vecm_OLS_l1_no <-VECM(barry, lag=1, include="none")
  > vecm_OLS_l1_coAsExo <-VECM(barry, lag=1, include="none", exogen=rep(1, nrow(barry)))
  > vecm_OLS_l3_coAsExo <-VECM(barry, lag=3, include="none", exogen=rep(1, nrow(barry)))
  > 
  > vecm_OLS_l0_co <-VECM(barry, lag=0)
  Warning message:
  In lineVar(data, lag, r = r, include = include, model = "VECM",  :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > vecm_OLS_l0_tr <-VECM(barry, lag=0, include="trend")
  Warning message:
  In lineVar(data, lag, r = r, include = include, model = "VECM",  :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > vecm_ML_l0_co <-VECM(barry, lag=0, include="const", estim="ML")
  Warning message:
  In lineVar(data, lag, r = r, include = include, model = "VECM",  :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > vecm_ML_l0_tr <-VECM(barry, lag=0, include="trend", estim="ML")
  Warning message:
  In lineVar(data, lag, r = r, include = include, model = "VECM",  :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > vecm_ML_l0_bo <-VECM(barry, lag=0, include="both", estim="ML")
  Warning message:
  In lineVar(data, lag, r = r, include = include, model = "VECM",  :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > vecm_ML_l0_no <-VECM(barry, lag=0, include="none", estim="ML")
  Warning message:
  In lineVar(data, lag, r = r, include = include, model = "VECM",  :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > vecm_ML_l0_LRco <-VECM(barry, lag=0, LRinclude="const", estim="ML")
  Warning message:
  In lineVar(data, lag, r = r, include = include, model = "VECM",  :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > vecm_ML_l0_LRtr <-VECM(barry, lag=0, LRinclude="trend", estim="ML")
  Warning message:
  In lineVar(data, lag, r = r, include = include, model = "VECM",  :
    Lag=0 not fully implemented, methods not expected to work: fevd, predict, irf,...
  > 
  > vecm_OLS_l1_LRco <-VECM(barry, lag=1, LRinclude="const")
  > vecm_OLS_l1_LRtr <-VECM(barry, lag=1, LRinclude="trend")
  > vecm_OLS_l1_LRtr_noCo <-VECM(barry, lag=1, LRinclude="trend", include="none")
  > vecm_OLS_l1_LRbo <-VECM(barry, lag=1, LRinclude="both")
  > 
  > vecm_ML_l1_co <-VECM(barry, lag=1, estim="ML")
  > vecm_ML_l3_co <-VECM(barry, lag=3, include="const", estim="ML")
  > vecm_ML_l3_co_betaGiven<-VECM(barry, lag=3, include="const", beta=c(-0.035,0.04), estim="ML")
  > vecm_ML_l1_tr <-VECM(barry, lag=1, include="trend", estim="ML")
  > vecm_ML_l1_bo <-VECM(barry, lag=1, include="both", estim="ML")
  > vecm_ML_l1_no <-VECM(barry, lag=1, include="none", estim="ML")
  > vecm_ML_l1_coAsExo <-VECM(barry, lag=1, include="none", exogen=rep(1, nrow(barry)), estim="ML")
  > vecm_ML_l3_coAsExo <-VECM(barry, lag=3, include="none", exogen=rep(1, nrow(barry)), estim="ML")
  > 
  > set.seed(1234)
  > exoVar <- rnorm(n=nrow(barry))
  > vecm_ML_l1_LRco <-VECM(barry, lag=1, LRinclude="const", estim="ML")
  > vecm_ML_l1_LRc_exo <-VECM(barry, lag=1, LRinclude="const", estim="ML", exogen=exoVar)
  > vecm_ML_l1_LRtr <-VECM(barry, lag=1, LRinclude="trend", estim="ML")
  > vecm_ML_l1_LRtr_exo <-VECM(barry, lag=1, LRinclude="trend", estim="ML", exogen=exoVar)
  > vecm_ML_l1_LRtr_noCo <-VECM(barry, lag=1, LRinclude="trend", include="none", estim="ML")
  > vecm_ML_l1_LRbo <-VECM(barry, lag=1, LRinclude="both", estim="ML")
  > vecm_ML_l1_LRbo_exo <-VECM(barry, lag=1, LRinclude="both", estim="ML", exogen=exoVar)
  > 
  > vecm_all <- list(
  + 		vecm_OLS_l1_co=vecm_OLS_l1_co,
  + 		vecm_OLS_l3_co=vecm_OLS_l3_co,
  + 		vecm_OLS_l3_co_betaGiven=vecm_OLS_l3_co_betaGiven,
  + 		vecm_OLS_l1_tr=vecm_OLS_l1_tr, 
  + 		vecm_OLS_l1_bo=vecm_OLS_l1_bo,
  + 		vecm_OLS_l1_no=vecm_OLS_l1_no,
  + 		vecm_OLS_l1_coAsExo=vecm_OLS_l1_coAsExo,
  + 		vecm_OLS_l3_coAsExo=vecm_OLS_l3_coAsExo, 
  + 		vecm_OLS_l1_LRco=vecm_OLS_l1_LRco,
  + 		vecm_OLS_l1_LRtr=vecm_OLS_l1_LRtr, 
  + 		vecm_OLS_l1_LRtr_noCo=vecm_OLS_l1_LRtr_noCo, 
  + 		vecm_OLS_l1_LRbo=vecm_OLS_l1_LRbo, 
  + 
  + 		vecm_OLS_l0_co=vecm_OLS_l0_co,
  + 		vecm_OLS_l0_tr=vecm_OLS_l0_tr,
  + 		vecm_ML_l0_co=vecm_ML_l0_co,
  + 		vecm_ML_l0_tr=vecm_ML_l0_tr,
  + 		vecm_ML_l0_bo=vecm_ML_l0_bo,
  + 		vecm_ML_l0_no=vecm_ML_l0_no,
  + 		vecm_ML_l0_LRco=vecm_ML_l0_LRco,
  + 		vecm_ML_l0_LRtr=vecm_ML_l0_LRtr,
  + 		
  +     
  + 		vecm_ML_l1_co=vecm_ML_l1_co,
  + 		vecm_ML_l3_co=vecm_ML_l3_co,
  + 		vecm_ML_l1_tr=vecm_ML_l1_tr, 
  + 		vecm_ML_l1_bo=vecm_ML_l1_bo,
  + 		vecm_ML_l1_no=vecm_ML_l1_no,
  + 		vecm_ML_l1_coAsExo=vecm_ML_l1_coAsExo,
  + 		vecm_ML_l3_coAsExo=vecm_ML_l3_coAsExo, 
  + 		vecm_ML_l1_LRco=vecm_ML_l1_LRco,
  + 		vecm_ML_l1_LRc_exo=vecm_ML_l1_LRc_exo,
  + 		vecm_ML_l1_LRtr=vecm_ML_l1_LRtr,
  + 		vecm_ML_l1_LRtr_exo=vecm_ML_l1_LRtr_exo,
  + 		vecm_ML_l1_LRtr_noCo=vecm_ML_l1_LRtr_noCo,
  + 		vecm_ML_l1_LRbo=vecm_ML_l1_LRbo,
  + 		vecm_ML_l1_LRbo_exo=vecm_ML_l1_LRbo_exo)
  > 
  > 
  > vecm_ML <- vecm_all[grep("ML", names(vecm_all))]
  > vecm_no_l0 <- vecm_all[!names(vecm_all)%in%grep("l0", names(vecm_all), value=TRUE)]
  > 
  > lapply(vecm_all, print)
                           ECT   Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan -0.002537673 0.002202355 0.1587853 -0.003002494  0.0001286435
  Equation cpiUSA  0.055320874 0.135043876 0.5426890  0.483673616 -0.0353661496
  Equation cpiCAN  0.179057392 0.157670998 0.2897487  0.327296468 -0.0224027426
                           ECT   Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan -0.001338343 0.003662911 0.1611940 -0.002242126  0.0003953115
  Equation cpiUSA  0.029339845 0.108353256 0.8711430  0.468684873 -0.0510243367
  Equation cpiCAN  0.133099298 0.100383436 0.6925224  0.272239507 -0.0494533196
                    dolcan -2    cpiUSA -2    cpiCAN -2  dolcan -3    cpiUSA -3
  Equation dolcan -0.04139589  0.002012077 -0.006607018  0.0202477 -0.002153848
  Equation cpiUSA -0.49404335 -0.023189036  0.071589503 -0.3943149  0.007943649
  Equation cpiCAN -0.13395315  0.009117886  0.164960151 -0.6081994  0.022337674
                      cpiCAN -3
  Equation dolcan -0.0003941692
  Equation cpiUSA  0.0928680566
  Equation cpiCAN  0.1324489696
                           ECT   Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan 0.0002124546 0.004305988 0.1598227 -0.002231881 -3.986873e-05
  Equation cpiUSA 0.0094968887 0.135232014 0.8624816  0.466764351 -5.196265e-02
  Equation cpiCAN 0.0341381280 0.196424879 0.6776997  0.264598773 -4.708853e-02
                    dolcan -2    cpiUSA -2    cpiCAN -2   dolcan -3    cpiUSA -3
  Equation dolcan -0.04152905  0.002131204 -0.007082543  0.02006583 -0.001977308
  Equation cpiUSA -0.49347974 -0.024309562  0.070436138 -0.39432206  0.006050638
  Equation cpiCAN -0.12990784  0.003092470  0.167044145 -0.60570782  0.012500706
                      cpiCAN -3
  Equation dolcan -0.0007870201
  Equation cpiUSA  0.0918309823
  Equation cpiCAN  0.1338417608
                            ECT        Trend dolcan -1     cpiUSA -1
  Equation dolcan -0.0007661059 5.099328e-06 0.1643691 -0.0003575695
  Equation cpiUSA  0.2432039258 5.849243e-04 0.6613709  0.5454399791
  Equation cpiCAN  0.3894987881 6.522822e-04 0.4535006  0.4107164124
                      cpiCAN -1
  Equation dolcan  0.0008968084
  Equation cpiUSA -0.0228245306
  Equation cpiCAN -0.0038689987
                            ECT  Intercept         Trend dolcan -1    cpiUSA -1
  Equation dolcan -0.0175059946 0.01161813 -4.720124e-05 0.1557842 -0.004941816
  Equation cpiUSA -0.0161621128 0.18001000 -2.254151e-04 0.5283571  0.474412152
  Equation cpiCAN  0.0003185219 0.27010606 -5.636367e-04 0.2539127  0.304138740
                      cpiCAN -1
  Equation dolcan  6.895526e-05
  Equation cpiUSA -3.565120e-02
  Equation cpiCAN -2.311549e-02
                           ECT dolcan -1   cpiUSA -1   cpiCAN -1
  Equation dolcan -0.002250595 0.1685594 0.001523275 0.001544155
  Equation cpiUSA  0.072923859 1.1420163 0.761184412 0.051430078
  Equation cpiCAN  0.199609825 0.9894956 0.651305269 0.078936528
                           ECT dolcan -1    cpiUSA -1     cpiCAN -1       exo_1
  Equation dolcan -0.002537673 0.1587853 -0.003002494  0.0001286435 0.002202355
  Equation cpiUSA  0.055320874 0.5426890  0.483673616 -0.0353661496 0.135043876
  Equation cpiCAN  0.179057392 0.2897487  0.327296468 -0.0224027426 0.157670998
                           ECT dolcan -1    cpiUSA -1     cpiCAN -1   dolcan -2
  Equation dolcan -0.001338343 0.1611940 -0.002242126  0.0003953115 -0.04139589
  Equation cpiUSA  0.029339845 0.8711430  0.468684873 -0.0510243367 -0.49404335
  Equation cpiCAN  0.133099298 0.6925224  0.272239507 -0.0494533196 -0.13395315
                     cpiUSA -2    cpiCAN -2  dolcan -3    cpiUSA -3     cpiCAN -3
  Equation dolcan  0.002012077 -0.006607018  0.0202477 -0.002153848 -0.0003941692
  Equation cpiUSA -0.023189036  0.071589503 -0.3943149  0.007943649  0.0928680566
  Equation cpiCAN  0.009117886  0.164960151 -0.6081994  0.022337674  0.1324489696
                        exo_1
  Equation dolcan 0.003662911
  Equation cpiUSA 0.108353256
  Equation cpiCAN 0.100383436
                           ECT dolcan -1    cpiUSA -1   cpiCAN -1
  Equation dolcan -0.019977546 0.1757108 0.0005944517 0.001585752
  Equation cpiUSA -0.009018453 1.1626553 0.7639971636 0.070510320
  Equation cpiCAN  0.214396024 0.9540622 0.6689428094 0.123722329
                           ECT   Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan -0.018347198 0.002753888 0.1599738 -0.004415558 -0.0006741961
  Equation cpiUSA -0.001166353 0.136744939 0.5483841  0.482575944 -0.0222408144
  Equation cpiCAN -0.144023002 0.167975293 0.3192321  0.312589647  0.0185499708
                          ECT dolcan -1   cpiUSA -1   cpiCAN -1
  Equation dolcan -0.01523687 0.1715595 0.001287359 0.001150302
  Equation cpiUSA  0.15327753 1.1236760 0.765755640 0.068355071
  Equation cpiCAN  0.04569339 1.0259115 0.660443050 0.129836506
                          ECT dolcan -1    cpiUSA -1   cpiCAN -1
  Equation dolcan -0.02042543 0.1755439 0.0006424809 0.001532288
  Equation cpiUSA  0.01429980 1.1539268 0.7649198192 0.069831738
  Equation cpiCAN  0.18825465 0.9672391 0.6672418709 0.125157214
                           ECT   Intercept
  Equation dolcan -0.002780092 0.001704454
  Equation cpiUSA  0.068255265 0.249423711
  Equation cpiCAN  0.186186297 0.235109720
                            ECT        Trend
  Equation dolcan -0.0001422602 6.872164e-06
  Equation cpiUSA  0.4799565924 1.234973e-03
  Equation cpiCAN  0.5732976471 1.155503e-03
                            ECT   Intercept
  Equation dolcan -0.0003507433 0.002374059
  Equation cpiUSA -0.0436243553 0.368504529
  Equation cpiCAN -0.0823639695 0.464893314
                            ECT         Trend
  Equation dolcan -0.0005484774 -2.096466e-05
  Equation cpiUSA -0.0928989256 -3.607422e-03
  Equation cpiCAN -0.1123697005 -4.699981e-03
                           ECT   Intercept        Trend
  Equation dolcan -0.001999161 -0.01016577 -0.000118541
  Equation cpiUSA -0.019268819  0.18976366 -0.001429789
  Equation cpiCAN -0.100888273 -0.23130939 -0.006626575
                          ECT
  Equation dolcan 0.001869335
  Equation cpiUSA 0.358828407
  Equation cpiCAN 0.359559513
                            ECT
  Equation dolcan -0.0008273726
  Equation cpiUSA -0.1396685110
  Equation cpiCAN -0.1389057526
                            ECT   Intercept
  Equation dolcan -0.0003514011 0.002370631
  Equation cpiUSA -0.0435803377 0.367753637
  Equation cpiCAN -0.0824088721 0.463805846
                           ECT   Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan -0.001130982 0.001904987 0.1590566 -0.002905063 -0.0001549718
  Equation cpiUSA  0.046105240 0.145721073 0.5267517  0.480576053 -0.0352344706
  Equation cpiCAN  0.146594632 0.191714766 0.2393953  0.317390143 -0.0212333484
                           ECT  Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan -0.003567929 0.00996184 0.1575471 -0.002645103 -0.0003088685
  Equation cpiUSA -0.039517521 0.17719382 0.8568219  0.463043537 -0.0496534599
  Equation cpiCAN -0.106423797 0.28464387 0.6858825  0.255604221 -0.0345310347
                    dolcan -2    cpiUSA -2    cpiCAN -2  dolcan -3     cpiUSA -3
  Equation dolcan -0.04164141  0.001907206 -0.007404306  0.0197858 -0.0023602348
  Equation cpiUSA -0.49353536 -0.027543039  0.072715853 -0.3954077  0.0008115503
  Equation cpiCAN -0.12863269 -0.006517491  0.180187367 -0.6062154 -0.0028046000
                     cpiCAN -3
  Equation dolcan -0.001070038
  Equation cpiUSA  0.093566410
  Equation cpiCAN  0.144352463
                            ECT         Trend dolcan -1    cpiUSA -1
  Equation dolcan -0.0007704618 -3.488514e-05 0.1564255 -0.003644594
  Equation cpiUSA -0.0437029488 -1.985084e-03 0.5057202  0.479055607
  Equation cpiCAN -0.0768177401 -3.825069e-03 0.1408267  0.278120484
                      cpiCAN -1
  Equation dolcan -0.0009835739
  Equation cpiUSA -0.0399138144
  Equation cpiCAN -0.0457768410
                            ECT   Intercept         Trend  dolcan -1    cpiUSA -1
  Equation dolcan  0.0002393194 -0.00626408 -7.829592e-05 0.15543978 -0.003243091
  Equation cpiUSA -0.0015111788  0.22561620  3.052464e-04 0.54969245  0.477797087
  Equation cpiCAN  0.0177494843 -0.36623757 -6.296457e-03 0.03197812  0.285487996
                      cpiCAN -1
  Equation dolcan -0.0009971209
  Equation cpiUSA -0.0334095397
  Equation cpiCAN -0.0561606616
                          ECT dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan 0.002204256 0.1612798 -0.001191142 -0.0001156718
  Equation cpiUSA 0.214731716 0.5016621  0.509525642 -0.0349445624
  Equation cpiCAN 0.288265350 0.1538064  0.317913501 -0.0107951519
                           ECT dolcan -1    cpiUSA -1     cpiCAN -1       exo_1
  Equation dolcan -0.001130982 0.1590566 -0.002905063 -0.0001549718 0.001904987
  Equation cpiUSA  0.046105240 0.5267517  0.480576053 -0.0352344706 0.145721073
  Equation cpiCAN  0.146594632 0.2393953  0.317390143 -0.0212333484 0.191714766
                           ECT dolcan -1    cpiUSA -1     cpiCAN -1   dolcan -2
  Equation dolcan -0.003567929 0.1575471 -0.002645103 -0.0003088685 -0.04164141
  Equation cpiUSA -0.039517521 0.8568219  0.463043537 -0.0496534599 -0.49353536
  Equation cpiCAN -0.106423797 0.6858825  0.255604221 -0.0345310347 -0.12863269
                     cpiUSA -2    cpiCAN -2  dolcan -3     cpiUSA -3    cpiCAN -3
  Equation dolcan  0.001907206 -0.007404306  0.0197858 -0.0023602348 -0.001070038
  Equation cpiUSA -0.027543039  0.072715853 -0.3954077  0.0008115503  0.093566410
  Equation cpiCAN -0.006517491  0.180187367 -0.6062154 -0.0028046000  0.144352463
                       exo_1
  Equation dolcan 0.00996184
  Equation cpiUSA 0.17719382
  Equation cpiCAN 0.28464387
                            ECT dolcan -1   cpiUSA -1     cpiCAN -1
  Equation dolcan -0.0006194775 0.1587288 -0.00299679 -0.0006987469
  Equation cpiUSA -0.0398395940 0.5610538  0.48000626 -0.0367016097
  Equation cpiCAN -0.0516009162 0.2617847  0.29171521 -0.0081038167
                            ECT dolcan -1    cpiUSA -1     cpiCAN -1        exo_1
  Equation dolcan -0.0008964929 0.1623843 -0.003725519 -0.0007232082 0.0008011181
  Equation cpiUSA -0.0533550599 0.6105160  0.472143268 -0.0360471128 0.0098870566
  Equation cpiCAN -0.0682411008 0.2682708  0.290739259 -0.0073654180 0.0008344276
                           ECT    Intercept  dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan 0.0001862485 -0.001525362 0.15676381 -0.003190914 -0.0009664377
  Equation cpiUSA 0.0040952483  0.056415156 0.50949599  0.477512123 -0.0330553243
  Equation cpiCAN 0.0292851011 -0.411104860 0.03045308  0.287169175 -0.0573042137
                           ECT    Intercept  dolcan -1    cpiUSA -1    cpiCAN -1
  Equation dolcan 8.032743e-05 -0.002211648 0.16035291 -0.003741356 -0.001026514
  Equation cpiUSA 1.526143e-03  0.053418502 0.54276393  0.472517536 -0.033350523
  Equation cpiCAN 1.002912e-02 -0.389244734 0.04253324  0.284469244 -0.056535140
                         exo_1
  Equation dolcan 0.0007836666
  Equation cpiUSA 0.0070544860
  Equation cpiCAN 0.0017206267
                           ECT dolcan -1   cpiUSA -1    cpiCAN -1
  Equation dolcan -0.000727143 0.1568527 -0.00338676 -0.001057004
  Equation cpiUSA -0.041425715 0.5224463  0.49024939 -0.044905637
  Equation cpiCAN -0.060470225 0.1070294  0.25988640 -0.037670697
                            ECT dolcan -1    cpiUSA -1    cpiCAN -1
  Equation dolcan -0.0008871317 0.1568747 -0.003435533 -0.001059806
  Equation cpiUSA -0.0503421884 0.5261923  0.488556527 -0.044613218
  Equation cpiCAN -0.0729350525 0.1194230  0.260432949 -0.035987363
                           ECT dolcan -1    cpiUSA -1   cpiCAN -1        exo_1
  Equation dolcan -0.001179716 0.1605561 -0.004158054 -0.00109032 0.0008116696
  Equation cpiUSA -0.062648158 0.5734187  0.480592492 -0.04406994 0.0095401329
  Equation cpiCAN -0.089501483 0.1319369  0.259164681 -0.03476411 0.0015991179
  $vecm_OLS_l1_co
                           ECT   Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan -0.002537673 0.002202355 0.1587853 -0.003002494  0.0001286435
  Equation cpiUSA  0.055320874 0.135043876 0.5426890  0.483673616 -0.0353661496
  Equation cpiCAN  0.179057392 0.157670998 0.2897487  0.327296468 -0.0224027426
  
  $vecm_OLS_l3_co
                           ECT   Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan -0.001338343 0.003662911 0.1611940 -0.002242126  0.0003953115
  Equation cpiUSA  0.029339845 0.108353256 0.8711430  0.468684873 -0.0510243367
  Equation cpiCAN  0.133099298 0.100383436 0.6925224  0.272239507 -0.0494533196
                    dolcan -2    cpiUSA -2    cpiCAN -2  dolcan -3    cpiUSA -3
  Equation dolcan -0.04139589  0.002012077 -0.006607018  0.0202477 -0.002153848
  Equation cpiUSA -0.49404335 -0.023189036  0.071589503 -0.3943149  0.007943649
  Equation cpiCAN -0.13395315  0.009117886  0.164960151 -0.6081994  0.022337674
                      cpiCAN -3
  Equation dolcan -0.0003941692
  Equation cpiUSA  0.0928680566
  Equation cpiCAN  0.1324489696
  
  $vecm_OLS_l3_co_betaGiven
                           ECT   Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan 0.0002124546 0.004305988 0.1598227 -0.002231881 -3.986873e-05
  Equation cpiUSA 0.0094968887 0.135232014 0.8624816  0.466764351 -5.196265e-02
  Equation cpiCAN 0.0341381280 0.196424879 0.6776997  0.264598773 -4.708853e-02
                    dolcan -2    cpiUSA -2    cpiCAN -2   dolcan -3    cpiUSA -3
  Equation dolcan -0.04152905  0.002131204 -0.007082543  0.02006583 -0.001977308
  Equation cpiUSA -0.49347974 -0.024309562  0.070436138 -0.39432206  0.006050638
  Equation cpiCAN -0.12990784  0.003092470  0.167044145 -0.60570782  0.012500706
                      cpiCAN -3
  Equation dolcan -0.0007870201
  Equation cpiUSA  0.0918309823
  Equation cpiCAN  0.1338417608
  
  $vecm_OLS_l1_tr
                            ECT        Trend dolcan -1     cpiUSA -1
  Equation dolcan -0.0007661059 5.099328e-06 0.1643691 -0.0003575695
  Equation cpiUSA  0.2432039258 5.849243e-04 0.6613709  0.5454399791
  Equation cpiCAN  0.3894987881 6.522822e-04 0.4535006  0.4107164124
                      cpiCAN -1
  Equation dolcan  0.0008968084
  Equation cpiUSA -0.0228245306
  Equation cpiCAN -0.0038689987
  
  $vecm_OLS_l1_bo
                            ECT  Intercept         Trend dolcan -1    cpiUSA -1
  Equation dolcan -0.0175059946 0.01161813 -4.720124e-05 0.1557842 -0.004941816
  Equation cpiUSA -0.0161621128 0.18001000 -2.254151e-04 0.5283571  0.474412152
  Equation cpiCAN  0.0003185219 0.27010606 -5.636367e-04 0.2539127  0.304138740
                      cpiCAN -1
  Equation dolcan  6.895526e-05
  Equation cpiUSA -3.565120e-02
  Equation cpiCAN -2.311549e-02
  
  $vecm_OLS_l1_no
                           ECT dolcan -1   cpiUSA -1   cpiCAN -1
  Equation dolcan -0.002250595 0.1685594 0.001523275 0.001544155
  Equation cpiUSA  0.072923859 1.1420163 0.761184412 0.051430078
  Equation cpiCAN  0.199609825 0.9894956 0.651305269 0.078936528
  
  $vecm_OLS_l1_coAsExo
                           ECT dolcan -1    cpiUSA -1     cpiCAN -1       exo_1
  Equation dolcan -0.002537673 0.1587853 -0.003002494  0.0001286435 0.002202355
  Equation cpiUSA  0.055320874 0.5426890  0.483673616 -0.0353661496 0.135043876
  Equation cpiCAN  0.179057392 0.2897487  0.327296468 -0.0224027426 0.157670998
  
  $vecm_OLS_l3_coAsExo
                           ECT dolcan -1    cpiUSA -1     cpiCAN -1   dolcan -2
  Equation dolcan -0.001338343 0.1611940 -0.002242126  0.0003953115 -0.04139589
  Equation cpiUSA  0.029339845 0.8711430  0.468684873 -0.0510243367 -0.49404335
  Equation cpiCAN  0.133099298 0.6925224  0.272239507 -0.0494533196 -0.13395315
                     cpiUSA -2    cpiCAN -2  dolcan -3    cpiUSA -3     cpiCAN -3
  Equation dolcan  0.002012077 -0.006607018  0.0202477 -0.002153848 -0.0003941692
  Equation cpiUSA -0.023189036  0.071589503 -0.3943149  0.007943649  0.0928680566
  Equation cpiCAN  0.009117886  0.164960151 -0.6081994  0.022337674  0.1324489696
                        exo_1
  Equation dolcan 0.003662911
  Equation cpiUSA 0.108353256
  Equation cpiCAN 0.100383436
  
  $vecm_OLS_l1_LRco
                           ECT dolcan -1    cpiUSA -1   cpiCAN -1
  Equation dolcan -0.019977546 0.1757108 0.0005944517 0.001585752
  Equation cpiUSA -0.009018453 1.1626553 0.7639971636 0.070510320
  Equation cpiCAN  0.214396024 0.9540622 0.6689428094 0.123722329
  
  $vecm_OLS_l1_LRtr
                           ECT   Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan -0.018347198 0.002753888 0.1599738 -0.004415558 -0.0006741961
  Equation cpiUSA -0.001166353 0.136744939 0.5483841  0.482575944 -0.0222408144
  Equation cpiCAN -0.144023002 0.167975293 0.3192321  0.312589647  0.0185499708
  
  $vecm_OLS_l1_LRtr_noCo
                          ECT dolcan -1   cpiUSA -1   cpiCAN -1
  Equation dolcan -0.01523687 0.1715595 0.001287359 0.001150302
  Equation cpiUSA  0.15327753 1.1236760 0.765755640 0.068355071
  Equation cpiCAN  0.04569339 1.0259115 0.660443050 0.129836506
  
  $vecm_OLS_l1_LRbo
                          ECT dolcan -1    cpiUSA -1   cpiCAN -1
  Equation dolcan -0.02042543 0.1755439 0.0006424809 0.001532288
  Equation cpiUSA  0.01429980 1.1539268 0.7649198192 0.069831738
  Equation cpiCAN  0.18825465 0.9672391 0.6672418709 0.125157214
  
  $vecm_OLS_l0_co
                           ECT   Intercept
  Equation dolcan -0.002780092 0.001704454
  Equation cpiUSA  0.068255265 0.249423711
  Equation cpiCAN  0.186186297 0.235109720
  
  $vecm_OLS_l0_tr
                            ECT        Trend
  Equation dolcan -0.0001422602 6.872164e-06
  Equation cpiUSA  0.4799565924 1.234973e-03
  Equation cpiCAN  0.5732976471 1.155503e-03
  
  $vecm_ML_l0_co
                            ECT   Intercept
  Equation dolcan -0.0003507433 0.002374059
  Equation cpiUSA -0.0436243553 0.368504529
  Equation cpiCAN -0.0823639695 0.464893314
  
  $vecm_ML_l0_tr
                            ECT         Trend
  Equation dolcan -0.0005484774 -2.096466e-05
  Equation cpiUSA -0.0928989256 -3.607422e-03
  Equation cpiCAN -0.1123697005 -4.699981e-03
  
  $vecm_ML_l0_bo
                           ECT   Intercept        Trend
  Equation dolcan -0.001999161 -0.01016577 -0.000118541
  Equation cpiUSA -0.019268819  0.18976366 -0.001429789
  Equation cpiCAN -0.100888273 -0.23130939 -0.006626575
  
  $vecm_ML_l0_no
                          ECT
  Equation dolcan 0.001869335
  Equation cpiUSA 0.358828407
  Equation cpiCAN 0.359559513
  
  $vecm_ML_l0_LRco
                            ECT
  Equation dolcan -0.0008273726
  Equation cpiUSA -0.1396685110
  Equation cpiCAN -0.1389057526
  
  $vecm_ML_l0_LRtr
                            ECT   Intercept
  Equation dolcan -0.0003514011 0.002370631
  Equation cpiUSA -0.0435803377 0.367753637
  Equation cpiCAN -0.0824088721 0.463805846
  
  $vecm_ML_l1_co
                           ECT   Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan -0.001130982 0.001904987 0.1590566 -0.002905063 -0.0001549718
  Equation cpiUSA  0.046105240 0.145721073 0.5267517  0.480576053 -0.0352344706
  Equation cpiCAN  0.146594632 0.191714766 0.2393953  0.317390143 -0.0212333484
  
  $vecm_ML_l3_co
                           ECT  Intercept dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan -0.003567929 0.00996184 0.1575471 -0.002645103 -0.0003088685
  Equation cpiUSA -0.039517521 0.17719382 0.8568219  0.463043537 -0.0496534599
  Equation cpiCAN -0.106423797 0.28464387 0.6858825  0.255604221 -0.0345310347
                    dolcan -2    cpiUSA -2    cpiCAN -2  dolcan -3     cpiUSA -3
  Equation dolcan -0.04164141  0.001907206 -0.007404306  0.0197858 -0.0023602348
  Equation cpiUSA -0.49353536 -0.027543039  0.072715853 -0.3954077  0.0008115503
  Equation cpiCAN -0.12863269 -0.006517491  0.180187367 -0.6062154 -0.0028046000
                     cpiCAN -3
  Equation dolcan -0.001070038
  Equation cpiUSA  0.093566410
  Equation cpiCAN  0.144352463
  
  $vecm_ML_l1_tr
                            ECT         Trend dolcan -1    cpiUSA -1
  Equation dolcan -0.0007704618 -3.488514e-05 0.1564255 -0.003644594
  Equation cpiUSA -0.0437029488 -1.985084e-03 0.5057202  0.479055607
  Equation cpiCAN -0.0768177401 -3.825069e-03 0.1408267  0.278120484
                      cpiCAN -1
  Equation dolcan -0.0009835739
  Equation cpiUSA -0.0399138144
  Equation cpiCAN -0.0457768410
  
  $vecm_ML_l1_bo
                            ECT   Intercept         Trend  dolcan -1    cpiUSA -1
  Equation dolcan  0.0002393194 -0.00626408 -7.829592e-05 0.15543978 -0.003243091
  Equation cpiUSA -0.0015111788  0.22561620  3.052464e-04 0.54969245  0.477797087
  Equation cpiCAN  0.0177494843 -0.36623757 -6.296457e-03 0.03197812  0.285487996
                      cpiCAN -1
  Equation dolcan -0.0009971209
  Equation cpiUSA -0.0334095397
  Equation cpiCAN -0.0561606616
  
  $vecm_ML_l1_no
                          ECT dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan 0.002204256 0.1612798 -0.001191142 -0.0001156718
  Equation cpiUSA 0.214731716 0.5016621  0.509525642 -0.0349445624
  Equation cpiCAN 0.288265350 0.1538064  0.317913501 -0.0107951519
  
  $vecm_ML_l1_coAsExo
                           ECT dolcan -1    cpiUSA -1     cpiCAN -1       exo_1
  Equation dolcan -0.001130982 0.1590566 -0.002905063 -0.0001549718 0.001904987
  Equation cpiUSA  0.046105240 0.5267517  0.480576053 -0.0352344706 0.145721073
  Equation cpiCAN  0.146594632 0.2393953  0.317390143 -0.0212333484 0.191714766
  
  $vecm_ML_l3_coAsExo
                           ECT dolcan -1    cpiUSA -1     cpiCAN -1   dolcan -2
  Equation dolcan -0.003567929 0.1575471 -0.002645103 -0.0003088685 -0.04164141
  Equation cpiUSA -0.039517521 0.8568219  0.463043537 -0.0496534599 -0.49353536
  Equation cpiCAN -0.106423797 0.6858825  0.255604221 -0.0345310347 -0.12863269
                     cpiUSA -2    cpiCAN -2  dolcan -3     cpiUSA -3    cpiCAN -3
  Equation dolcan  0.001907206 -0.007404306  0.0197858 -0.0023602348 -0.001070038
  Equation cpiUSA -0.027543039  0.072715853 -0.3954077  0.0008115503  0.093566410
  Equation cpiCAN -0.006517491  0.180187367 -0.6062154 -0.0028046000  0.144352463
                       exo_1
  Equation dolcan 0.00996184
  Equation cpiUSA 0.17719382
  Equation cpiCAN 0.28464387
  
  $vecm_ML_l1_LRco
                            ECT dolcan -1   cpiUSA -1     cpiCAN -1
  Equation dolcan -0.0006194775 0.1587288 -0.00299679 -0.0006987469
  Equation cpiUSA -0.0398395940 0.5610538  0.48000626 -0.0367016097
  Equation cpiCAN -0.0516009162 0.2617847  0.29171521 -0.0081038167
  
  $vecm_ML_l1_LRc_exo
                            ECT dolcan -1    cpiUSA -1     cpiCAN -1        exo_1
  Equation dolcan -0.0008964929 0.1623843 -0.003725519 -0.0007232082 0.0008011181
  Equation cpiUSA -0.0533550599 0.6105160  0.472143268 -0.0360471128 0.0098870566
  Equation cpiCAN -0.0682411008 0.2682708  0.290739259 -0.0073654180 0.0008344276
  
  $vecm_ML_l1_LRtr
                           ECT    Intercept  dolcan -1    cpiUSA -1     cpiCAN -1
  Equation dolcan 0.0001862485 -0.001525362 0.15676381 -0.003190914 -0.0009664377
  Equation cpiUSA 0.0040952483  0.056415156 0.50949599  0.477512123 -0.0330553243
  Equation cpiCAN 0.0292851011 -0.411104860 0.03045308  0.287169175 -0.0573042137
  
  $vecm_ML_l1_LRtr_exo
                           ECT    Intercept  dolcan -1    cpiUSA -1    cpiCAN -1
  Equation dolcan 8.032743e-05 -0.002211648 0.16035291 -0.003741356 -0.001026514
  Equation cpiUSA 1.526143e-03  0.053418502 0.54276393  0.472517536 -0.033350523
  Equation cpiCAN 1.002912e-02 -0.389244734 0.04253324  0.284469244 -0.056535140
                         exo_1
  Equation dolcan 0.0007836666
  Equation cpiUSA 0.0070544860
  Equation cpiCAN 0.0017206267
  
  $vecm_ML_l1_LRtr_noCo
                           ECT dolcan -1   cpiUSA -1    cpiCAN -1
  Equation dolcan -0.000727143 0.1568527 -0.00338676 -0.001057004
  Equation cpiUSA -0.041425715 0.5224463  0.49024939 -0.044905637
  Equation cpiCAN -0.060470225 0.1070294  0.25988640 -0.037670697
  
  $vecm_ML_l1_LRbo
                            ECT dolcan -1    cpiUSA -1    cpiCAN -1
  Equation dolcan -0.0008871317 0.1568747 -0.003435533 -0.001059806
  Equation cpiUSA -0.0503421884 0.5261923  0.488556527 -0.044613218
  Equation cpiCAN -0.0729350525 0.1194230  0.260432949 -0.035987363
  
  $vecm_ML_l1_LRbo_exo
                           ECT dolcan -1    cpiUSA -1   cpiCAN -1        exo_1
  Equation dolcan -0.001179716 0.1605561 -0.004158054 -0.00109032 0.0008116696
  Equation cpiUSA -0.062648158 0.5734187  0.480592492 -0.04406994 0.0095401329
  Equation cpiCAN -0.089501483 0.1319369  0.259164681 -0.03476411 0.0015991179
  
  > lapply(vecm_all, summary)
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  tsDyn
   --- call from context --- 
  myformat(betas, digits)
   --- call from argument --- 
  if (class(x) == "numeric") return(noquote(r))
   --- R stacktrace ---
  where 1: myformat(betas, digits)
  where 2: paste(myformat(betas, digits), "(", myformat(StDevB, digits), 
      ")", stars, sep = "")
  where 3: matrix(paste(myformat(betas, digits), "(", myformat(StDevB, digits), 
      ")", stars, sep = ""), nrow = nrow(Pval))
  where 4: summary.VAR(X[[i]], ...)
  where 5: FUN(X[[i]], ...)
  where 6: lapply(vecm_all, summary)
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (x, digits, toLatex = FALSE) 
  {
      r <- x
      littlex <- abs(x) < 10^-(digits)
      r[!littlex] <- formatC(x[!littlex], digits = digits, format = "f")
      r[littlex] <- format(x[littlex], digits = min(digits, 2), 
          scientific = TRUE)
      if (toLatex) 
          r <- gsub("(e.*)", "slashtext{\\1}", r)
      if (class(x) == "numeric") 
          return(noquote(r))
      if (class(x) == "matrix") 
          return(matrix(noquote(r), ncol = ncol(x), nrow = nrow(x)))
  }
  <bytecode: 0x96edce8>
  <environment: namespace:tsDyn>
   --- function search by body ---
  Function myformat in namespace tsDyn has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Error in if (class(x) == "numeric") return(noquote(r)) : 
    the condition has length > 1
  Calls: lapply -> FUN -> summary.VAR -> matrix -> paste -> myformat
  Execution halted
Running the tests in 'tests/nlVar-methods.R' failed.
Complete output:
  > library(tsDyn)
  > 
  > data(zeroyld)
  > 
  > ###TVECM
  > tvecm <- TVECM(zeroyld, nthresh=2,lag=1, ngridBeta=20, ngridTh=20, plot=FALSE,trim=0.05, common="All")
  29 (7.2%) points of the grid lead to regimes with percentage of observations < trim and were not computed
  Best threshold from first search -1.195 
  Best cointegrating value 1.057203 
  There were  2  thresholds values which minimize the SSR in the conditional step, the first one was taken
  Second best (conditionnal on the first one) -1.195 0.643 	 SSR 157.1432 
  There were  4  thresholds values which minimize the SSR in the iterative step, the first one was taken
  Second step best thresholds -1.414 0.643 			 SSR 155.6996 
  > tvar <- TVAR(zeroyld, nthresh=2,lag=1,  plot=FALSE, trim=0.05)
  Best unique threshold 11.986 
  Second best: 10.709 (conditionnal on th= 11.986 and Delay= 1 ) 	 SSR/AIC: 162.8903
  Second best: 11.986 (conditionnal on th= 10.709 and Delay= 1 ) 	 SSR/AIC: 162.8903
  
  Second step best thresholds 10.709 11.986 		 SSR: 162.8903 
  > linVECM<-lineVar(zeroyld, lag=2, model="VECM")
  > lin<-lineVar(zeroyld,lag=2)
  > 
  > 
  > mods <- list(tvecm=tvecm, linVECM=linVECM, lin=lin, tvar=tvar)
  > mods_nonLIn <- mods[c("tvecm", "tvar")]
  > 
  > 
  > 
  > ## Standard functions
  > sapply(mods, class)
  $tvecm
  [1] "TVECM" "nlVar"
  
  $linVECM
  [1] "VECM"  "VAR"   "nlVar"
  
  $lin
  [1] "VAR"   "nlVar"
  
  $tvar
  [1] "TVAR"  "nlVar"
  
  > sapply(mods, print)
  Model TVECM with  2  thresholds
  
  $Bdown
                           ECT     Const short.run t -1 long.run t -1
  Equation short.run 0.2226023 0.5698814      0.2244073  -0.136190681
  Equation long.run  1.0935615 1.9832101      0.8186019  -0.002427001
  
  $Bmiddle
                              ECT        Const short.run t -1 long.run t -1
  Equation short.run -0.001818286  0.008678988      0.1112658    0.06567174
  Equation long.run   0.021794525 -0.004663874      0.3392230    0.23318881
  
  $Bup
                             ECT       Const short.run t -1 long.run t -1
  Equation short.run -0.03654149  0.04545852    -0.10772057    0.04261369
  Equation long.run   0.09836556 -0.07041546     0.09321772   -0.03159638
  
  
  Threshold value[1] -1.414  0.643
                             ECT   Intercept short.run -1 long.run -1
  Equation short.run -0.01462511  0.01574772   0.03605199  0.02351545
  Equation long.run   0.07510479 -0.01217832   0.30947969  0.06668876
                     short.run -2 long.run -2
  Equation short.run  -0.04290810 -0.02323537
  Equation long.run   -0.02727195 -0.07024155
                      Intercept short.run -1 long.run -1 short.run -2 long.run -2
  Equation short.run 0.06729104    1.0311341  0.02329517  -0.05255831 -0.00905873
  Equation long.run  0.03657482    0.4066159  0.95954683  -0.33196199 -0.04690559
  Model TVAR with  2  thresholds
  
  $Bdown
                      Intercept short.run -1 long.run -1
  Equation short.run 0.04572943    0.9793942  0.01783035
  Equation long.run  0.01061130    0.0474415  0.94923720
  
  $Bmiddle
                     Intercept short.run -1 long.run -1
  Equation short.run  6.231462    0.2406308   0.2463688
  Equation long.run   9.130317   -1.2924932   1.5753229
  
  $Bup
                     Intercept short.run -1 long.run -1
  Equation short.run 1.2234188    0.9246711 -0.02455317
  Equation long.run  0.9491886    0.2091544  0.70126696
  
  
  Threshold value[1] "10.709 11.986"
  $tvecm
  [1] -1.414  0.643
  
  $linVECM
                             ECT   Intercept short.run -1 long.run -1
  Equation short.run -0.01462511  0.01574772   0.03605199  0.02351545
  Equation long.run   0.07510479 -0.01217832   0.30947969  0.06668876
                     short.run -2 long.run -2
  Equation short.run  -0.04290810 -0.02323537
  Equation long.run   -0.02727195 -0.07024155
  
  $lin
                      Intercept short.run -1 long.run -1 short.run -2 long.run -2
  Equation short.run 0.06729104    1.0311341  0.02329517  -0.05255831 -0.00905873
  Equation long.run  0.03657482    0.4066159  0.95954683  -0.33196199 -0.04690559
  
  $tvar
  [1] "10.709 11.986"
  
  > sapply(mods, summary)
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  tsDyn
   --- call from context --- 
  asListIfMat(VarCovB)
   --- call from argument --- 
  if (class(x) == "matrix") return(list(x)) else return(x)
   --- R stacktrace ---
  where 1: asListIfMat(VarCovB)
  where 2: summary.TVECM(X[[i]], ...)
  where 3: FUN(X[[i]], ...)
  where 4: lapply(X = X, FUN = FUN, ...)
  where 5: sapply(mods, summary)
  
   --- value of length: 2 type: logical ---
  [1]  TRUE FALSE
   --- function from context --- 
  function (x) 
  {
      if (class(x) == "matrix") 
          return(list(x))
      else return(x)
  }
  <bytecode: 0x5568bd0>
  <environment: namespace:tsDyn>
   --- function search by body ---
  Function asListIfMat in namespace tsDyn has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Error in if (class(x) == "matrix") return(list(x)) else return(x) : 
    the condition has length > 1
  Calls: sapply -> lapply -> FUN -> summary.TVECM -> asListIfMat
  Execution halted