tests/testthat/test-elasticity.R

test_that("Elasticity function returns 2 for the CES_sigma_2 dataset", {

  elas <- elasticity(CES_sigma_2, pvar = "prices", qvar = "quantities", pervar = "time", prodID = "prodID",
                     compIndex = "ces")

  # floating point errors lead to this failing without a tolerance
  expect_equal(elas$sigma, 2, tolerance = 0.0000001)

})

Try the IndexNumR package in your browser

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

IndexNumR documentation built on Feb. 7, 2022, 5:09 p.m.