tests/testthat/test-tvgeom-moments.R

context("moment functions")

test_that(
  "Check that moment functions are correct and work", {
    probs <- c(rep(0.01, 14))
    expect_equal(
      round(tvgeom_mean(probs), digits = 0),
      round(mean(rtvgeom(n = 1e8, prob = probs)), digits = 0)
    )
    expect_equal(
      round(tvgeom_var(probs), digits = 0),
      round(var(rtvgeom(n = 1e8, prob = probs)), digits = 0)
    )
  }
)

Try the tvgeom package in your browser

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

tvgeom documentation built on Dec. 10, 2019, 5:11 p.m.