Skip to content

Commit

Permalink
Fix cicd; fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gowerc committed Feb 29, 2024
1 parent b9a54a8 commit f3557d0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 35 deletions.
20 changes: 7 additions & 13 deletions R/settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,13 @@
#' Default = 15
#'
#' In most cases the survival function of the joint model does not have a closed form
#' and as such is calculated by integrating the hazard function. `jmpost` estimates this
#' via Gaussian Quadrature, in particular it uses [`statmod::gauss.quad`] to create the
#' nodes and weights.
#' and as such it is calculated by integrating the hazard function. `jmpost` estimates this
#' via Gaussian Quadrature, in particular it uses [`statmod::gauss.quad`] with
#' `kind = "legendre"` to create the nodes and weights.
#'
#' This option specifies the `n` arguement in the call to [`statmod::gauss.quad`].
#'
#' ## `jmpost.gauss_quad_kind`
#'
#' Default = `"legendre"`
#'
#' This option specifies the `kind` arguement in the call to [`statmod::gauss.quad`].
#' See the `jmpost.gauss_quad_n` option description for more details.
#' This option specifies the `n` arguement in the call to [`statmod::gauss.quad`]. In general
#' higher values of `n` lead to better accuracy of the approximation but at the cost of
#' increased computational time.
#'
#' @examples
#' \dontrun{
Expand All @@ -67,8 +62,7 @@ set_options <- function() {
jmpost_opts <- list(
jmpost.cache_dir = cache_dir,
jmpost.prior_shrinkage = 0.5,
jmpost.gauss_quad_n = 15,
jmpost.gauss_quad_kind = "legendre"
jmpost.gauss_quad_n = 15
)
for (opt in names(jmpost_opts)) {
if (!opt %in% current_opts) {
Expand Down
18 changes: 6 additions & 12 deletions man/jmpost-settings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions tests/testthat/test-options.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@



test_that("Can alter Gaussian Quadrature arguements", {
test_that("Can alter Gaussian Quadrature arguments", {
x <- data.frame(
vpt = c("b", "a", "c", "d", "e"),
vtime = c(10, 20, 30, 25, 15),
Expand All @@ -25,10 +25,7 @@ test_that("Can alter Gaussian Quadrature arguements", {


## Test modified values
options(
"jmpost.gauss_quad_n" = 20,
"jmpost.gauss_quad_kind" = "chebyshev2"
)
options( "jmpost.gauss_quad_n" = 20)
df <- DataSurvival(
data = x,
formula = Surv(vtime, vevent) ~ vcov1 * vcov2
Expand All @@ -37,13 +34,10 @@ test_that("Can alter Gaussian Quadrature arguements", {
expect_equal(li$n_nodes, 20)
expect_equal(
li[c("nodes", "weights")],
statmod::gauss.quad(20, "chebyshev2")
statmod::gauss.quad(20, "legendre")
)


## Reset back to default to not impact additional tests
options(
"jmpost.gauss_quad_n" = 15,
"jmpost.gauss_quad_kind" = "legendre"
)
options( "jmpost.gauss_quad_n" = 15)
})

0 comments on commit f3557d0

Please sign in to comment.