tests/testthat/test-simStateSpace-tests.R

## ---- test-simStateSpace-tests
lapply(
  X = 1,
  FUN = function(i,
                 text) {
    message(text)
    testthat::test_that(
      paste(text, "stationary"),
      {
        testthat::expect_true(
          TestStationarity(
            matrix(
              data = c(0.5, 0.3, 0.2, 0.4),
              nrow = 2
            )
          )
        )
      }
    )
    testthat::test_that(
      paste(text, "nonstationary"),
      {
        testthat::expect_false(
          TestStationarity(
            matrix(
              data = c(0.9, -0.5, 0.8, 0.7),
              nrow = 2
            )
          )
        )
      }
    )
    testthat::test_that(
      paste(text, "stable"),
      {
        testthat::expect_true(
          TestStability(
            matrix(
              data = c(
                -0.357, 0.771, -0.450,
                0.0, -0.511, 0.729,
                0, 0, -0.693
              ),
              nrow = 3
            )
          )
        )
      }
    )
  },
  text = "test-simStateSpace-tests"
)

Try the simStateSpace package in your browser

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

simStateSpace documentation built on June 22, 2024, 9:15 a.m.