tests/testthat/test_statio.R

library(statiotest)
context("Unit tests for statiotest")

# Stationary data sample

 x2 <- function(){
  set.seed(1234)
  rnorm(1000)
 }

test_that("p_value is >= 0.05 if data stationary", {
  expect_true(statiotest(x2())$p.val >= 0.05)
})

# Non-stationary data sample

  x3 <- function(){
    set.seed(1234)
    cumsum(rnorm(1000))
  }

  test_that("p_value is < 0.05 if data non-stationary unit root", {
    expect_true(statiotest(x3())$p.val < 0.05)
  })
D-Roberts/statiotest documentation built on May 6, 2019, 12:55 p.m.