Skip to content

Commit d22dc9d

Browse files
committed
Added test_that test
1 parent 8b9c208 commit d22dc9d

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/testthat/test-pNextGenSize.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,15 @@ test_that("pNextGenSize() with multiple transmitters matches brute-force dnbinom
1010

1111
expect_equal(pngs, dnb, tolerance = sqrt(.Machine$double.eps))
1212
})
13+
14+
test_that("pFinalSize() matches brute-force calculation", {
15+
pfs <- pFinalSize(n=1, j=4, R=1.2, k=0.33)
16+
17+
d <- dnbinom(0:3, mu=1.2, size=0.33)
18+
dnb <- d[4] * d[1]^3 +
19+
d[3] * d[2] * d[1]^2 * 2 +
20+
d[2] * d[3] * d[1]^2 +
21+
d[2]^3 * d[1]
22+
23+
expect_equal(pfs, dnb, tolerance = sqrt(.Machine$double.eps))
24+
})

0 commit comments

Comments
 (0)