Nothing
test_that("parameters and variables create expression objects", {
parameter <- biogeme_beta("b_time", start = -1, lower = -10, upper = 0)
time <- variable("TIME")
expect_s3_class(parameter, "biogeme_beta")
expect_s3_class(time, "biogeme_variable")
expect_equal(parameter$name, "b_time")
expect_equal(time$name, "TIME")
})
test_that("arithmetic creates a neutral expression tree", {
expression <- biogeme_beta("b_time") * variable("TIME") + 3
expect_s3_class(expression, "biogeme_expression")
expect_equal(expression$kind, "binary")
expect_equal(expression$operator, "+")
expect_equal(format(expression), "((b_time * TIME) + 3)")
})
test_that("unary functions and numeric-left operators work", {
expression <- 2 + exp(-biogeme_beta("x") / variable("income"))
expect_s3_class(expression, "biogeme_expression")
expect_equal(
format(expression),
"(2 + exp(((-x) / income)))"
)
})
test_that("parameter validation catches malformed definitions", {
expect_error(biogeme_beta("", start = 0), "name")
expect_error(biogeme_beta("x", start = NA_real_), "finite")
expect_error(biogeme_beta("x", start = 2, upper = 1), "upper")
expect_error(biogeme_beta("x", lower = 2, upper = 1), "lower")
expect_error(variable(NA_character_), "name")
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.