tests/testthat/test-cf.R

test_that("cf works with 3-dims", {
  v1 <- vars::VAR(USA, p = 3, ic = "AIC" )
  x1 <- id.dc(v1)
  x2 <- cf(x1, series = 1)

  expect_equal(round(sum(x2$counter[,1]), 2),  -3.51, tolerance = 0.3)
})

test_that("cf works with 2-dims", {
  v1 <- vars::VAR(USA[,-3], p = 3, ic = "AIC" )
  x1 <- id.dc(v1)
  x2 <- cf(x1, series = 1)

  expect_equal(round(sum(x2$counter[,1]), 2), -0.86, tolerance = 0.3)
})

Try the svars package in your browser

Any scripts or data that you put into this service are public.

svars documentation built on Feb. 16, 2023, 7:52 p.m.