tests/testthat/test.apply_bcskew0.r

context("apply_bcskew0")

library(moments)
library(magrittr)
library(mnmacros)
#library(testthat)

rm(list = ls())

x <- testdata.apply_bcskew0
t <- x %>% agostino.test()
expect_equal(t$p.value, 0.01729354)

x2 <- x %>% apply_bcskew0()
t <- x2 %>% agostino.test()
l <- x2 %>% attr('lamda')
expect_equal(t$p.value, 0.9999949)
expect_equal(l, -0.05313)

expect_error(
  rep(1, 8) %>% apply_bcskew0(),
  "x %>% unique() %>% length() > 1 is not TRUE",
  fixed = T)

expect_error(
  rep(1, 7) %>% apply_bcskew0(),
  "8 <= lx && lx <= 46340 is not TRUE",
  fixed = T)
markanewman/AnalysisMacros documentation built on May 22, 2019, 2:41 p.m.