tests/testthat/test-linear_combination.R

test_that("SLR T test equivalence", {
  m <- setup_slr()
  out <- linear_combination(m$model, c(0, 1))
  expect_snapshot(out)

  coef_test <- unname(summary(m$model)$coefficients[2, ])
  expect_equal(out$estimate, coef_test[1])
  expect_equal(out$se, coef_test[2])
  expect_equal(out$p_value, coef_test[4], tolerance = 1e-5)
})

test_that("MLR Works", {
  m <- setup_mlr()
  out <- linear_combination(m$model, c(0, 0, 1, -1))
  expect_snapshot(out)
})

Try the probstats4econ package in your browser

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

probstats4econ documentation built on Sept. 11, 2024, 8:29 p.m.