File: test-ttest.R

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

context('t-test')

data('ToothGrowth')

test_that('ttest works', {
    ttestBF(ToothGrowth$len, ToothGrowth$dose)
    ttestBF(formula=len~supp, data=ToothGrowth)
})

test_that('rejects bad input', {
    expect_error(
        ttestBF(formula=len~dose, data=ToothGrowth),
        'Indep. groups t test requires a factor with exactly 2 levels.',
        fixed=TRUE
    )
    expect_error(
        ttestBF(formula=len~dose+supp, data=ToothGrowth),
        'Indep. groups t test can only support 1 factor as predictor.',
        fixed=TRUE
    )
    expect_error(
        ttestBF(formula=len~dose:supp, data=ToothGrowth),
        'Interaction terms are not allowed in t test.',
        fixed=TRUE
    )
})