From f3557d004d5f031f38c3067bed273f613ac48717 Mon Sep 17 00:00:00 2001 From: gowerc Date: Thu, 29 Feb 2024 14:18:33 +0000 Subject: [PATCH] Fix cicd; fix review comments --- R/settings.R | 20 +++++++------------- man/jmpost-settings.Rd | 18 ++++++------------ tests/testthat/test-options.R | 14 ++++---------- 3 files changed, 17 insertions(+), 35 deletions(-) diff --git a/R/settings.R b/R/settings.R index d801625d..3e1662ff 100644 --- a/R/settings.R +++ b/R/settings.R @@ -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{ @@ -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) { diff --git a/man/jmpost-settings.Rd b/man/jmpost-settings.Rd index 88457758..f3eeb610 100644 --- a/man/jmpost-settings.Rd +++ b/man/jmpost-settings.Rd @@ -41,19 +41,13 @@ the given R session. Can also be set via the environment variable \code{JMPOST_C 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. \code{jmpost} estimates this -via Gaussian Quadrature, in particular it uses \code{\link[statmod:gauss.quad]{statmod::gauss.quad}} to create the -nodes and weights. +and as such it is calculated by integrating the hazard function. \code{jmpost} estimates this +via Gaussian Quadrature, in particular it uses \code{\link[statmod:gauss.quad]{statmod::gauss.quad}} with +\code{kind = "legendre"} to create the nodes and weights. -This option specifies the \code{n} arguement in the call to \code{\link[statmod:gauss.quad]{statmod::gauss.quad}}. -} - -\subsection{\code{jmpost.gauss_quad_kind}}{ - -Default = \code{"legendre"} - -This option specifies the \code{kind} arguement in the call to \code{\link[statmod:gauss.quad]{statmod::gauss.quad}}. -See the \code{jmpost.gauss_quad_n} option description for more details. +This option specifies the \code{n} arguement in the call to \code{\link[statmod:gauss.quad]{statmod::gauss.quad}}. In general +higher values of \code{n} lead to better accuracy of the approximation but at the cost of +increased computational time. } } \examples{ diff --git a/tests/testthat/test-options.R b/tests/testthat/test-options.R index ccb14720..0e8d2540 100644 --- a/tests/testthat/test-options.R +++ b/tests/testthat/test-options.R @@ -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), @@ -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 @@ -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) })