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 Nov. 11, 2023, 1:07 a.m.