inst/tests/test-regressionBF.R

context("regressionBF")

set.seed(0)

test_that("regressionBF works", {
  x <- rnorm(100)
  a <- rnorm(100)
  y <- x + a + rnorm(100)
  data <- data.frame(y, x, a)
  regressionBF(y ~ x + a, data)
})

test_that("regressionBF errors appropriately", {
  x <- rnorm(100)
  a <- rnorm(100)
  y <- x + a + rnorm(100)
  data <- data.frame(y, x, a)
  expect_error(
    regressionBF(y ~ x * a, data),
    'Interactions not allowed in regressionBF (try generalTestBF)',
    fixed=TRUE)
})

Try the BayesFactor package in your browser

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

BayesFactor documentation built on May 29, 2024, 3:09 a.m.