-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
287 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ type: software | |
license: MIT | ||
title: 'bpmodels: Simulating and Analysing Transmission Chain Statistics using Branching | ||
Process Models' | ||
version: 0.3.0 | ||
version: 0.3.1 | ||
abstract: Provides methods to simulate and analyse the size and length of branching | ||
processes with an arbitrary offspring distribution. These can be used, for example, | ||
to analyse the distribution of chain sizes or length of infectious disease outbreaks, | ||
|
@@ -249,3 +249,15 @@ references: | |
given-names: Saralees | ||
email: [email protected] | ||
year: '2023' | ||
- type: software | ||
title: checkmate | ||
abstract: 'checkmate: Fast and Versatile Argument Checks' | ||
notes: Imports | ||
url: https://mllg.github.io/checkmate/ | ||
repository: https://CRAN.R-project.org/package=checkmate | ||
authors: | ||
- family-names: Lang | ||
given-names: Michel | ||
email: [email protected] | ||
orcid: https://orcid.org/0000-0001-9754-0393 | ||
year: '2023' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: bpmodels | ||
Title: Simulating and Analysing Transmission Chain Statistics using Branching Process | ||
Models | ||
Version: 0.3.0 | ||
Version: 0.3.1 | ||
Authors@R: c( | ||
person("James M.", "Azam", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "https://orcid.org/0000-0001-5782-7330")), | ||
|
@@ -48,3 +48,5 @@ LazyData: true | |
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.2.3 | ||
Language: en-GB | ||
Imports: | ||
checkmate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
test_that("We can calculate probabilities and sample", { | ||
expect_gt(dborel(1, 0.5), 0) | ||
expect_identical(dborel(1, 0.5, log = TRUE), -0.5) | ||
expect_length(rborel(2, 0.9), 2) | ||
}) | ||
|
||
test_that("Errors are thrown", { | ||
expect_error( | ||
dborel(x = 0, mu = 0.5), | ||
"is not >= 1" | ||
) | ||
expect_error( | ||
dborel(x = 1, mu = -0.5), | ||
"is not >= 0" | ||
) | ||
expect_error( | ||
dborel(x = 1, mu = Inf), | ||
"Must be finite" | ||
) | ||
expect_error( | ||
rborel(n = 0, mu = -0.5), | ||
"is not >= 1" | ||
) | ||
expect_error( | ||
rborel(n = 0, mu = Inf), | ||
"is not >= 1" | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
test_that("Util functions work", { | ||
expect_length(rnbinom_mean_disp(n = 5, mn = 4, disp = 2), 5) | ||
expect_length(rgen_length(n = 1, x = c(1, 2, 3), prob = 0.3), 3) | ||
expect_length(rbinom_size(n = 1, x = c(1, 2, 3), prob = 0.3), 3) | ||
expect_identical(complementary_logprob(x = 0), -Inf) | ||
expect_identical(complementary_logprob(x = -Inf), 0) | ||
expect_lt(complementary_logprob(x = -0.1), 0) | ||
}) | ||
|
||
test_that("Errors are thrown", { | ||
# Checks on 'disp' argument | ||
expect_error( | ||
rnbinom_mean_disp(n = 5, mn = 4, disp = 0.9), | ||
"is not >= 1" | ||
) | ||
expect_error( | ||
rnbinom_mean_disp(n = 5, mn = 4, disp = NA), | ||
"May not be NA" | ||
) | ||
expect_error( | ||
rnbinom_mean_disp(n = 5, mn = 4, disp = Inf), | ||
"Must be finite" | ||
) | ||
# Checks on 'n' argument | ||
expect_error( | ||
rnbinom_mean_disp(n = 0, mn = 4, disp = 2), | ||
"is not >= 1" | ||
) | ||
expect_error( | ||
rnbinom_mean_disp(n = NA, mn = 4, disp = 2), | ||
"May not be NA" | ||
) | ||
expect_error( | ||
rnbinom_mean_disp(n = Inf, mn = 4, disp = 2), | ||
"Must be finite" | ||
) | ||
# Checks on 'mn' argument | ||
expect_error( | ||
rnbinom_mean_disp(n = 2, mn = 0, disp = 2) | ||
) | ||
expect_error( | ||
rnbinom_mean_disp(n = 2, mn = NA, disp = 2), | ||
"May not be NA" | ||
) | ||
expect_error( | ||
rnbinom_mean_disp(n = 2, mn = Inf, disp = 2), | ||
"Must be finite" | ||
) | ||
}) | ||
|
||
test_that("Errors are thrown", { | ||
expect_error( | ||
complementary_logprob(0.1), | ||
"is not <= 0" | ||
) | ||
expect_error( | ||
complementary_logprob(Inf), | ||
"is not <= 0" | ||
) | ||
}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.