File: test-regressionBF.R

package info (click to toggle)
r-cran-bayesfactor 0.9.12-4.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,512 kB
  • sloc: cpp: 1,555; sh: 16; makefile: 7
file content (23 lines) | stat: -rw-r--r-- 503 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

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)
})