From 11b29b8c73506a5ffc78c4c6f05f793a651f2291 Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Sun, 16 Jun 2024 12:13:03 +0200 Subject: [PATCH 01/20] clean --- R/Simulations-class.R | 52 ++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/R/Simulations-class.R b/R/Simulations-class.R index 90eeaa981..e3e73641b 100644 --- a/R/Simulations-class.R +++ b/R/Simulations-class.R @@ -702,48 +702,40 @@ PseudoDualSimulations <- function(fit_eff, stop("Class PseudoDualSimulations cannot be instantiated directly. Please use a subclass.") } -# nolint start # PseudoDualFlexiSimulations ---- ## class ---- -## ------------------------------------------------------------------------------- -## Class for Pseudo simulation using DLE and efficacy responses using 'EffFlex' efficacy model -## ----------------------------------------------------------------------------------- -##' This is a class which captures the trial simulations design using both the -##' DLE and efficacy responses. The design of model from \code{\linkS4class{ModelTox}} -##' class and the efficacy model from \code{\linkS4class{EffFlexi}} class -##' It contains all slots from -##' \code{\linkS4class{GeneralSimulations}}, \code{\linkS4class{PseudoSimulations}} -##' and \code{\linkS4class{PseudoDualSimulations}} object. -##' In comparison to the parent class \code{\linkS4class{PseudoDualSimulations}}, -##' it contains additional slots to -##' capture the sigma2betaW estimates. -##' -##' @slot sigma2betaWest the vector of the final posterior mean sigma2betaW estimates -##' -##' @export -##' @keywords class +#' `PseudoDualFlexiSimulations` +#' +#' @description `r lifecycle::badge("stable")` +#' This class captures the trial simulations design using both the DLE and efficacy responses using [`EffFlexi`] efficacy model. +#' It extends [`PseudoDualSimulations`] by adding the capability to capture the sigma2betaW estimates. +#' +#' @slot sigma2_beta_west (`numeric`)\cr the vector of the final posterior mean sigma2betaW estimates +#' @aliases PseudoDualFlexiSimulations +#' @export .PseudoDualFlexiSimulations <- setClass( Class = "PseudoDualFlexiSimulations", - representation(sigma2betaWest = "numeric"), - prototype(sigma2betaWest = c(0.001, 0.002)), - contains = "PseudoDualSimulations", - validity = v_pseudo_dual_flex_simulations + slots = c(sigma2_beta_west = "numeric"), + prototype = prototype(sigma2_beta_west = c(0.001, 0.002)), + contains = "PseudoDualSimulations" ) -validObject(.PseudoDualFlexiSimulations()) +## constructor ---- -##' Initialization function for 'PseudoDualFlexiSimulations' class -##' @param sigma2betaWest please refer to \code{\linkS4class{PseudoDualFlexiSimulations}} class object -##' @param \dots additional parameters from \code{\linkS4class{PseudoDualSimulations}} -##' @return the \code{\linkS4class{PseudoDualFlexiSimulations}} object -PseudoDualFlexiSimulations <- function(sigma2betaWest, +#' @rdname PseudoDualFlexiSimulations-class +#' +#' @param sigma2_beta_west (`numeric`)\cr the vector of the final posterior mean sigma2betaW estimates +#' @param \dots additional parameters from [`PseudoDualSimulations`] +#' +#' @export +PseudoDualFlexiSimulations <- function(sigma2_beta_west, ...) { start <- PseudoDualSimulations(...) .PseudoDualFlexiSimulations(start, - sigma2betaWest = sigma2betaWest + sigma2_beta_west = sigma2_beta_west ) } @@ -753,7 +745,7 @@ PseudoDualFlexiSimulations <- function(sigma2betaWest, #' @note Typically, end users will not use the `.DefaultPseudoFlexiSimulations()` function. #' @export .DefaultPseudoDualFlexiSimulations <- function() { - stop(paste0("Class PseudoFlexiSimulations cannot be instantiated directly. Please use one of its subclasses instead.")) + stop("Class PseudoFlexiSimulations cannot be instantiated directly. Please use one of its subclasses instead.") } ## ------------------------------------------------------------------------------------------------------- From b5984e8359f76a05124006e3d47d1a4f1450ba4d Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Sun, 16 Jun 2024 12:24:18 +0200 Subject: [PATCH 02/20] add test --- tests/testthat/test-Simulations-class.R | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/testthat/test-Simulations-class.R b/tests/testthat/test-Simulations-class.R index 1e468bb58..f731e70f1 100644 --- a/tests/testthat/test-Simulations-class.R +++ b/tests/testthat/test-Simulations-class.R @@ -479,3 +479,35 @@ test_that("PseudoDualSimulations user constructor argument names are as expected ordered = TRUE ) }) + +# PseudoDualFlexiSimulations-class ---- +test_that("PseudoDualFlexiSimulations generator does not throw error and validates", { + result <- expect_silent(.PseudoDualFlexiSimulations()) + expect_valid(result, "PseudoDualFlexiSimulations") +}) + +test_that("PseudoDualFlexiSimulations object can be created with the user constructor", { + sigma2_beta_west <- c(0.001, 0.002) + + seed <- as.integer(123) + + result <- expect_silent( + PseudoDualFlexiSimulations( + sigma2_beta_west = sigma2_beta_west, + seed = seed + ) + ) + + expect_valid(result, "PseudoDualFlexiSimulations") + expect_identical(result@sigma2_beta_west, sigma2_beta_west) +}) + +test_that("PseudoDualFlexiSimulations user constructor argument names are as expected", { + expect_function( + PseudoDualFlexiSimulations, + args = c( + "sigma2_beta_west", "..." + ), + ordered = TRUE + ) +}) From edd3e3bdb205da063dc71156e5d5d7d7b1d5eafc Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Sun, 16 Jun 2024 12:47:08 +0200 Subject: [PATCH 03/20] move nolint st --- R/Simulations-class.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/Simulations-class.R b/R/Simulations-class.R index e3e73641b..bcd416ae0 100644 --- a/R/Simulations-class.R +++ b/R/Simulations-class.R @@ -748,6 +748,7 @@ PseudoDualFlexiSimulations <- function(sigma2_beta_west, stop("Class PseudoFlexiSimulations cannot be instantiated directly. Please use one of its subclasses instead.") } +# nolint start ## ------------------------------------------------------------------------------------------------------- ## ================================================================================================ From 2d74e31158e7dfada8e00a5daffa1c2df3510512 Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Sun, 16 Jun 2024 13:13:13 +0200 Subject: [PATCH 04/20] test --- tests/testthat/test-Simulations-class.R | 79 +++++++++++++++++++++---- 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/tests/testthat/test-Simulations-class.R b/tests/testthat/test-Simulations-class.R index f731e70f1..5bb668b2a 100644 --- a/tests/testthat/test-Simulations-class.R +++ b/tests/testthat/test-Simulations-class.R @@ -481,28 +481,85 @@ test_that("PseudoDualSimulations user constructor argument names are as expected }) # PseudoDualFlexiSimulations-class ---- -test_that("PseudoDualFlexiSimulations generator does not throw error and validates", { +test_that("PseudoDualFlexiSimulations can be generated without error and return a valid object", { result <- expect_silent(.PseudoDualFlexiSimulations()) expect_valid(result, "PseudoDualFlexiSimulations") }) -test_that("PseudoDualFlexiSimulations object can be created with the user constructor", { - sigma2_beta_west <- c(0.001, 0.002) +test_that("PseudoDualFlexiSimulations can be instantiated using the constructor", { + fit_eff <- list(c(0.1, 0.2), c(0.3, 0.4)) + final_gstar_estimates <- c(0.1, 0.2) + final_gstar_at_dose_grid <- c(0.3, 0.4) + final_gstar_cis <- list(c(0.1, 0.2), c(0.3, 0.4)) + final_gstar_ratios <- c(0.1, 0.2) + final_optimal_dose <- c(0.5, 0.6) + final_optimal_dose_at_dose_grid <- c(0.7, 0.8) + sigma2_est <- c(0.01, 0.02) + sigma2_beta_west <- c(0.03, 0.04) - seed <- as.integer(123) + fit <- list(c(0.1, 0.2), c(0.3, 0.4)) + final_td_target_during_trial_estimates <- c(0.5, 0.6) + final_td_target_end_of_trial_estimates <- c(0.7, 0.8) + final_td_target_during_trial_at_dose_grid <- c(0.9, 1.0) + final_td_target_end_of_trial_at_dose_grid <- c(1.1, 1.2) + final_tdeot_cis <- list(c(0.1, 0.2), c(0.3, 0.4)) + final_tdeot_ratios <- c(0.5, 0.6) + final_cis <- list(c(0.7, 0.8), c(0.9, 1.0)) + final_ratios <- c(1.1, 1.2) + stop_report <- matrix(TRUE, nrow = 2) + stop_reasons <- list("A", "B") - result <- expect_silent( - PseudoDualFlexiSimulations( - sigma2_beta_west = sigma2_beta_west, - seed = seed + data <- list( + Data( + x = 1:3, + y = c(0, 1, 0), # Adjusted values to meet the constraint + doseGrid = 1:3, + ID = 1L:3L, + cohort = 1L:3L + ), + Data( + x = 4:6, + y = c(1, 0, 1), # Adjusted values to meet the constraint + doseGrid = 4:6, + ID = 1L:3L, + cohort = 1L:3L ) ) - expect_valid(result, "PseudoDualFlexiSimulations") - expect_identical(result@sigma2_beta_west, sigma2_beta_west) + doses <- c(1, 2) + seed <- as.integer(123) + + sim_obj <- PseudoDualFlexiSimulations( + fit_eff = fit_eff, + final_gstar_estimates = final_gstar_estimates, + final_gstar_at_dose_grid = final_gstar_at_dose_grid, + final_gstar_cis = final_gstar_cis, + final_gstar_ratios = final_gstar_ratios, + final_optimal_dose = final_optimal_dose, + final_optimal_dose_at_dose_grid = final_optimal_dose_at_dose_grid, + sigma2_est = sigma2_est, + sigma2_beta_west = sigma2_beta_west, + fit = fit, + data = data, + doses = doses, + final_td_target_during_trial_estimates = final_td_target_during_trial_estimates, + final_td_target_end_of_trial_estimates = final_td_target_end_of_trial_estimates, + final_td_target_during_trial_at_dose_grid = final_td_target_during_trial_at_dose_grid, + final_td_target_end_of_trial_at_dose_grid = final_td_target_end_of_trial_at_dose_grid, + final_tdeot_cis = final_tdeot_cis, + final_tdeot_ratios = final_tdeot_ratios, + final_cis = final_cis, + final_ratios = final_ratios, + stop_report = stop_report, + stop_reasons = stop_reasons, + seed = seed + ) + + expect_valid(sim_obj, "PseudoDualFlexiSimulations") + expect_identical(sim_obj@sigma2_beta_west, sigma2_beta_west) }) -test_that("PseudoDualFlexiSimulations user constructor argument names are as expected", { +test_that("PseudoDualFlexiSimulations user constructor argument names", { expect_function( PseudoDualFlexiSimulations, args = c( From e36d756291a591fcb3d159dee47b22c46b6fc51e Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Sun, 16 Jun 2024 13:22:57 +0200 Subject: [PATCH 05/20] doc --- NAMESPACE | 1 + man/PseudoDualFlexiSimulations-class.Rd | 33 ++++++++++--------------- man/PseudoDualFlexiSimulations.Rd | 19 -------------- man/v_pseudo_simulations.Rd | 2 +- 4 files changed, 15 insertions(+), 40 deletions(-) delete mode 100644 man/PseudoDualFlexiSimulations.Rd diff --git a/NAMESPACE b/NAMESPACE index 378bb6b3a..10c9d2a38 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -387,6 +387,7 @@ export(OneParExpPrior) export(OneParLogNormalPrior) export(ProbitLogNormal) export(ProbitLogNormalRel) +export(PseudoDualFlexiSimulations) export(PseudoDualSimulations) export(PseudoSimulations) export(Quantiles2LogisticNormal) diff --git a/man/PseudoDualFlexiSimulations-class.Rd b/man/PseudoDualFlexiSimulations-class.Rd index c173ec8c1..cac426235 100644 --- a/man/PseudoDualFlexiSimulations-class.Rd +++ b/man/PseudoDualFlexiSimulations-class.Rd @@ -4,37 +4,30 @@ \name{PseudoDualFlexiSimulations-class} \alias{PseudoDualFlexiSimulations-class} \alias{.PseudoDualFlexiSimulations} +\alias{PseudoDualFlexiSimulations} \alias{.DefaultPseudoDualFlexiSimulations} -\title{This is a class which captures the trial simulations design using both the -DLE and efficacy responses. The design of model from \code{\linkS4class{ModelTox}} -class and the efficacy model from \code{\linkS4class{EffFlexi}} class -It contains all slots from -\code{\linkS4class{GeneralSimulations}}, \code{\linkS4class{PseudoSimulations}} -and \code{\linkS4class{PseudoDualSimulations}} object. -In comparison to the parent class \code{\linkS4class{PseudoDualSimulations}}, -it contains additional slots to -capture the sigma2betaW estimates.} +\title{\code{PseudoDualFlexiSimulations}} \usage{ +PseudoDualFlexiSimulations(sigma2_beta_west, ...) + .DefaultPseudoDualFlexiSimulations() } +\arguments{ +\item{sigma2_beta_west}{(\code{numeric})\cr the vector of the final posterior mean sigma2betaW estimates} + +\item{\dots}{additional parameters from \code{\link{PseudoDualSimulations}}} +} \description{ -This is a class which captures the trial simulations design using both the -DLE and efficacy responses. The design of model from \code{\linkS4class{ModelTox}} -class and the efficacy model from \code{\linkS4class{EffFlexi}} class -It contains all slots from -\code{\linkS4class{GeneralSimulations}}, \code{\linkS4class{PseudoSimulations}} -and \code{\linkS4class{PseudoDualSimulations}} object. -In comparison to the parent class \code{\linkS4class{PseudoDualSimulations}}, -it contains additional slots to -capture the sigma2betaW estimates. +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} +This class captures the trial simulations design using both the DLE and efficacy responses using \code{\link{EffFlexi}} efficacy model. +It extends \code{\link{PseudoDualSimulations}} by adding the capability to capture the sigma2betaW estimates. } \section{Slots}{ \describe{ -\item{\code{sigma2betaWest}}{the vector of the final posterior mean sigma2betaW estimates} +\item{\code{sigma2_beta_west}}{(\code{numeric})\cr the vector of the final posterior mean sigma2betaW estimates} }} \note{ Typically, end users will not use the \code{.DefaultPseudoFlexiSimulations()} function. } -\keyword{class} diff --git a/man/PseudoDualFlexiSimulations.Rd b/man/PseudoDualFlexiSimulations.Rd deleted file mode 100644 index acf2d4532..000000000 --- a/man/PseudoDualFlexiSimulations.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/Simulations-class.R -\name{PseudoDualFlexiSimulations} -\alias{PseudoDualFlexiSimulations} -\title{Initialization function for 'PseudoDualFlexiSimulations' class} -\usage{ -PseudoDualFlexiSimulations(sigma2betaWest, ...) -} -\arguments{ -\item{sigma2betaWest}{please refer to \code{\linkS4class{PseudoDualFlexiSimulations}} class object} - -\item{\dots}{additional parameters from \code{\linkS4class{PseudoDualSimulations}}} -} -\value{ -the \code{\linkS4class{PseudoDualFlexiSimulations}} object -} -\description{ -Initialization function for 'PseudoDualFlexiSimulations' class -} diff --git a/man/v_pseudo_simulations.Rd b/man/v_pseudo_simulations.Rd index 33fcbdaa4..04fa12af7 100644 --- a/man/v_pseudo_simulations.Rd +++ b/man/v_pseudo_simulations.Rd @@ -39,7 +39,7 @@ contains valid \code{fit_eff}, \code{final_gstar_estimates} , \code{final_gstar_ object and valid \code{sigma2_est} simulations. \item \code{v_pseudo_dual_flex_simulations()}: validates that the \code{\link{PseudoDualFlexiSimulations}} -object contains valid \code{sigma2betaWest} vector of the final posterior mean +object contains valid \code{sigma2_beta_west} vector of the final posterior mean sigma2betaW estimates.\code{FinalGstarEstimates} , \code{FinalGstarAtDoseGrid}, }} From e08e70ceb213a49141b22927a759ba501264b7f1 Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Sun, 16 Jun 2024 13:23:08 +0200 Subject: [PATCH 06/20] fix var --- R/Design-methods.R | 2 +- R/Simulations-methods.R | 2 +- R/Simulations-validity.R | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/Design-methods.R b/R/Design-methods.R index 7642d502b..ec6de4b23 100644 --- a/R/Design-methods.R +++ b/R/Design-methods.R @@ -3442,7 +3442,7 @@ setMethod("simulate", fit = fitDLEList, fit_eff = fitEffList, sigma2_est = sigma2Estimates, - sigma2betaWest = sigma2betaWEstimates, + sigma2_beta_West = sigma2betaWEstimates, stop_reasons = stopReasons, stop_report = stop_report, seed = RNGstate diff --git a/R/Simulations-methods.R b/R/Simulations-methods.R index dccaa4285..76a2cf464 100644 --- a/R/Simulations-methods.R +++ b/R/Simulations-methods.R @@ -2408,7 +2408,7 @@ setMethod("plot", ## save the plot plotList[[plotIndex <- plotIndex + 1L]] <- qplot(factor(0), - y = y, data = data.frame(y = x@sigma2betaWest), geom = "boxplot", + y = y, data = data.frame(y = x@sigma2_beta_west), geom = "boxplot", xlab = "", ylab = "Random walk model variance estimates" ) + coord_flip() + scale_x_discrete(breaks = NULL) diff --git a/R/Simulations-validity.R b/R/Simulations-validity.R index 31c219f8e..abc4415c8 100644 --- a/R/Simulations-validity.R +++ b/R/Simulations-validity.R @@ -138,15 +138,15 @@ v_pseudo_dual_simulations <- function(object) { } #' @describeIn v_pseudo_simulations validates that the [`PseudoDualFlexiSimulations`] -#' object contains valid `sigma2betaWest` vector of the final posterior mean +#' object contains valid `sigma2_beta_west` vector of the final posterior mean #' sigma2betaW estimates.`FinalGstarEstimates` , `FinalGstarAtDoseGrid`, #' v_pseudo_dual_flex_simulations <- function(object) { v <- Validate() nSims <- length(object@data) v$check( - identical(length(object@sigma2betaWest), nSims), - "sigma2betaWest has to have same length as data" + identical(length(object@sigma2_beta_west), nSims), + "sigma2_beta_west has to have same length as data" ) v$result() } From 5429fe94904dcf60729f1c54eabac496f8793b59 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:26:20 +0000 Subject: [PATCH 07/20] [skip style] [skip vbump] Restyle files --- R/Simulations-class.R | 2 +- tests/testthat/test-Simulations-class.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/Simulations-class.R b/R/Simulations-class.R index bcd416ae0..10782ed62 100644 --- a/R/Simulations-class.R +++ b/R/Simulations-class.R @@ -735,7 +735,7 @@ PseudoDualFlexiSimulations <- function(sigma2_beta_west, ...) { start <- PseudoDualSimulations(...) .PseudoDualFlexiSimulations(start, - sigma2_beta_west = sigma2_beta_west + sigma2_beta_west = sigma2_beta_west ) } diff --git a/tests/testthat/test-Simulations-class.R b/tests/testthat/test-Simulations-class.R index 5bb668b2a..1edc9ca13 100644 --- a/tests/testthat/test-Simulations-class.R +++ b/tests/testthat/test-Simulations-class.R @@ -512,14 +512,14 @@ test_that("PseudoDualFlexiSimulations can be instantiated using the constructor" data <- list( Data( x = 1:3, - y = c(0, 1, 0), # Adjusted values to meet the constraint + y = c(0, 1, 0), # Adjusted values to meet the constraint doseGrid = 1:3, ID = 1L:3L, cohort = 1L:3L ), Data( x = 4:6, - y = c(1, 0, 1), # Adjusted values to meet the constraint + y = c(1, 0, 1), # Adjusted values to meet the constraint doseGrid = 4:6, ID = 1L:3L, cohort = 1L:3L From bb7a26df061fddbe03e2487d2a7b9522a164ea60 Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Mon, 17 Jun 2024 20:38:25 +0200 Subject: [PATCH 08/20] fix var name --- R/Design-methods.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/Design-methods.R b/R/Design-methods.R index ec6de4b23..6c20f64e2 100644 --- a/R/Design-methods.R +++ b/R/Design-methods.R @@ -3442,7 +3442,7 @@ setMethod("simulate", fit = fitDLEList, fit_eff = fitEffList, sigma2_est = sigma2Estimates, - sigma2_beta_West = sigma2betaWEstimates, + sigma2_beta_west = sigma2betaWEstimates, stop_reasons = stopReasons, stop_report = stop_report, seed = RNGstate From 0510664df7dc0b2f85cab25fd73b04dd4ec78613 Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Mon, 17 Jun 2024 20:38:35 +0200 Subject: [PATCH 09/20] fix lint error --- R/Simulations-class.R | 3 ++- man/PseudoDualFlexiSimulations-class.Rd | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/R/Simulations-class.R b/R/Simulations-class.R index bcd416ae0..4416eba38 100644 --- a/R/Simulations-class.R +++ b/R/Simulations-class.R @@ -709,7 +709,8 @@ PseudoDualSimulations <- function(fit_eff, #' `PseudoDualFlexiSimulations` #' #' @description `r lifecycle::badge("stable")` -#' This class captures the trial simulations design using both the DLE and efficacy responses using [`EffFlexi`] efficacy model. +#' This class captures the trial simulations design using both the DLE and +#' efficacy responses using [`EffFlexi`] efficacy model. #' It extends [`PseudoDualSimulations`] by adding the capability to capture the sigma2betaW estimates. #' #' @slot sigma2_beta_west (`numeric`)\cr the vector of the final posterior mean sigma2betaW estimates diff --git a/man/PseudoDualFlexiSimulations-class.Rd b/man/PseudoDualFlexiSimulations-class.Rd index cac426235..f195411fc 100644 --- a/man/PseudoDualFlexiSimulations-class.Rd +++ b/man/PseudoDualFlexiSimulations-class.Rd @@ -19,7 +19,8 @@ PseudoDualFlexiSimulations(sigma2_beta_west, ...) } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -This class captures the trial simulations design using both the DLE and efficacy responses using \code{\link{EffFlexi}} efficacy model. +This class captures the trial simulations design using both the DLE and +efficacy responses using \code{\link{EffFlexi}} efficacy model. It extends \code{\link{PseudoDualSimulations}} by adding the capability to capture the sigma2betaW estimates. } \section{Slots}{ From 7e87e0752011fdeedbf6fb48f66d7da2e6bd9e4f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 18:41:18 +0000 Subject: [PATCH 10/20] [skip style] [skip vbump] Restyle files --- R/Simulations-class.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/Simulations-class.R b/R/Simulations-class.R index d289c202d..3c27134ca 100644 --- a/R/Simulations-class.R +++ b/R/Simulations-class.R @@ -709,7 +709,7 @@ PseudoDualSimulations <- function(fit_eff, #' `PseudoDualFlexiSimulations` #' #' @description `r lifecycle::badge("stable")` -#' This class captures the trial simulations design using both the DLE and +#' This class captures the trial simulations design using both the DLE and #' efficacy responses using [`EffFlexi`] efficacy model. #' It extends [`PseudoDualSimulations`] by adding the capability to capture the sigma2betaW estimates. #' From b1f0dffeb3d603696638a4ef78fe623192ddfdba Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Tue, 18 Jun 2024 11:03:16 +0200 Subject: [PATCH 11/20] trigger checks From a50f3d36c249be75551de5c7e05aa9e9019bdabe Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Tue, 18 Jun 2024 11:03:33 +0200 Subject: [PATCH 12/20] trigger checks From cc76990f41cbd05ddc4929e92d1e8bb1971b5e06 Mon Sep 17 00:00:00 2001 From: pengguanya Date: Fri, 12 Jul 2024 09:54:27 +0200 Subject: [PATCH 13/20] Update R/Design-methods.R Co-authored-by: Daniel Sabanes Bove --- R/Design-methods.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/Design-methods.R b/R/Design-methods.R index 6c20f64e2..fbf7b161e 100644 --- a/R/Design-methods.R +++ b/R/Design-methods.R @@ -3442,7 +3442,7 @@ setMethod("simulate", fit = fitDLEList, fit_eff = fitEffList, sigma2_est = sigma2Estimates, - sigma2_beta_west = sigma2betaWEstimates, + sigma2_beta_w_est = sigma2betaWEstimates, stop_reasons = stopReasons, stop_report = stop_report, seed = RNGstate From 7c4fa02c3831cdaca986fd321e7495f56728e89f Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Mon, 5 Aug 2024 23:10:47 +0200 Subject: [PATCH 14/20] trigger checks From 2c80578fc117686dee91bf37787bc5654d055f7e Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Mon, 5 Aug 2024 23:11:04 +0200 Subject: [PATCH 15/20] trigger checks From 3a2fb7380ae9f1fb306030d812a87c253ecf3f6c Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Tue, 6 Aug 2024 11:46:07 +0200 Subject: [PATCH 16/20] trigger checks From 688f7feb08738fc2abc841cc0e746f8ea8e39229 Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Thu, 8 Aug 2024 12:30:27 +0200 Subject: [PATCH 17/20] trigger checks From bbfa633134f14bc48e49f4ddb264aa3e6e0d74a1 Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Sat, 10 Aug 2024 08:32:59 +0200 Subject: [PATCH 18/20] trigger checks From 8969205ba7c0a9e545439f3648bcdd5a39fdc97d Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Sat, 10 Aug 2024 08:33:05 +0200 Subject: [PATCH 19/20] trigger checks From 92421f2b4a52533ffe9793d845ebdf89e7e94980 Mon Sep 17 00:00:00 2001 From: Guanya Peng Date: Sat, 10 Aug 2024 17:33:50 +0200 Subject: [PATCH 20/20] fix par names --- R/Simulations-class.R | 12 ++++++------ R/Simulations-methods.R | 2 +- R/Simulations-validity.R | 6 +++--- man/PseudoDualFlexiSimulations-class.Rd | 6 +++--- man/crmPackExample.Rd | 2 +- man/crmPackHelp.Rd | 2 +- man/v_pseudo_simulations.Rd | 2 +- tests/testthat/test-Simulations-class.R | 8 ++++---- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/R/Simulations-class.R b/R/Simulations-class.R index 3c27134ca..a2d896268 100644 --- a/R/Simulations-class.R +++ b/R/Simulations-class.R @@ -713,14 +713,14 @@ PseudoDualSimulations <- function(fit_eff, #' efficacy responses using [`EffFlexi`] efficacy model. #' It extends [`PseudoDualSimulations`] by adding the capability to capture the sigma2betaW estimates. #' -#' @slot sigma2_beta_west (`numeric`)\cr the vector of the final posterior mean sigma2betaW estimates +#' @slot sigma2_beta_w_est (`numeric`)\cr the vector of the final posterior mean sigma2betaW estimates #' @aliases PseudoDualFlexiSimulations #' @export .PseudoDualFlexiSimulations <- setClass( Class = "PseudoDualFlexiSimulations", - slots = c(sigma2_beta_west = "numeric"), - prototype = prototype(sigma2_beta_west = c(0.001, 0.002)), + slots = c(sigma2_beta_w_est = "numeric"), + prototype = prototype(sigma2_beta_w_est = c(0.001, 0.002)), contains = "PseudoDualSimulations" ) @@ -728,15 +728,15 @@ PseudoDualSimulations <- function(fit_eff, #' @rdname PseudoDualFlexiSimulations-class #' -#' @param sigma2_beta_west (`numeric`)\cr the vector of the final posterior mean sigma2betaW estimates +#' @param sigma2_beta_w_est (`numeric`)\cr the vector of the final posterior mean sigma2betaW estimates #' @param \dots additional parameters from [`PseudoDualSimulations`] #' #' @export -PseudoDualFlexiSimulations <- function(sigma2_beta_west, +PseudoDualFlexiSimulations <- function(sigma2_beta_w_est, ...) { start <- PseudoDualSimulations(...) .PseudoDualFlexiSimulations(start, - sigma2_beta_west = sigma2_beta_west + sigma2_beta_w_est = sigma2_beta_w_est ) } diff --git a/R/Simulations-methods.R b/R/Simulations-methods.R index 76a2cf464..98634bf8c 100644 --- a/R/Simulations-methods.R +++ b/R/Simulations-methods.R @@ -2408,7 +2408,7 @@ setMethod("plot", ## save the plot plotList[[plotIndex <- plotIndex + 1L]] <- qplot(factor(0), - y = y, data = data.frame(y = x@sigma2_beta_west), geom = "boxplot", + y = y, data = data.frame(y = x@sigma2_beta_w_est), geom = "boxplot", xlab = "", ylab = "Random walk model variance estimates" ) + coord_flip() + scale_x_discrete(breaks = NULL) diff --git a/R/Simulations-validity.R b/R/Simulations-validity.R index abc4415c8..f1bd52a24 100644 --- a/R/Simulations-validity.R +++ b/R/Simulations-validity.R @@ -138,15 +138,15 @@ v_pseudo_dual_simulations <- function(object) { } #' @describeIn v_pseudo_simulations validates that the [`PseudoDualFlexiSimulations`] -#' object contains valid `sigma2_beta_west` vector of the final posterior mean +#' object contains valid `sigma2_beta_w_est` vector of the final posterior mean #' sigma2betaW estimates.`FinalGstarEstimates` , `FinalGstarAtDoseGrid`, #' v_pseudo_dual_flex_simulations <- function(object) { v <- Validate() nSims <- length(object@data) v$check( - identical(length(object@sigma2_beta_west), nSims), - "sigma2_beta_west has to have same length as data" + identical(length(object@sigma2_beta_w_est), nSims), + "sigma2_beta_w_est has to have same length as data" ) v$result() } diff --git a/man/PseudoDualFlexiSimulations-class.Rd b/man/PseudoDualFlexiSimulations-class.Rd index f195411fc..d68b80434 100644 --- a/man/PseudoDualFlexiSimulations-class.Rd +++ b/man/PseudoDualFlexiSimulations-class.Rd @@ -8,12 +8,12 @@ \alias{.DefaultPseudoDualFlexiSimulations} \title{\code{PseudoDualFlexiSimulations}} \usage{ -PseudoDualFlexiSimulations(sigma2_beta_west, ...) +PseudoDualFlexiSimulations(sigma2_beta_w_est, ...) .DefaultPseudoDualFlexiSimulations() } \arguments{ -\item{sigma2_beta_west}{(\code{numeric})\cr the vector of the final posterior mean sigma2betaW estimates} +\item{sigma2_beta_w_est}{(\code{numeric})\cr the vector of the final posterior mean sigma2betaW estimates} \item{\dots}{additional parameters from \code{\link{PseudoDualSimulations}}} } @@ -26,7 +26,7 @@ It extends \code{\link{PseudoDualSimulations}} by adding the capability to captu \section{Slots}{ \describe{ -\item{\code{sigma2_beta_west}}{(\code{numeric})\cr the vector of the final posterior mean sigma2betaW estimates} +\item{\code{sigma2_beta_w_est}}{(\code{numeric})\cr the vector of the final posterior mean sigma2betaW estimates} }} \note{ diff --git a/man/crmPackExample.Rd b/man/crmPackExample.Rd index 72f1988f9..167e2e274 100644 --- a/man/crmPackExample.Rd +++ b/man/crmPackExample.Rd @@ -14,6 +14,6 @@ Calling this helper function should open the example.pdf document, residing in the doc subfolder of the package installation directory. } \author{ -Daniel Sabanes Bove \email{sabanesd@roche.com} +Daniel Sabanes Bove \email{sabanesd@rconis.com} } \keyword{documentation} diff --git a/man/crmPackHelp.Rd b/man/crmPackHelp.Rd index d8023e40f..4c10756d4 100644 --- a/man/crmPackHelp.Rd +++ b/man/crmPackHelp.Rd @@ -14,6 +14,6 @@ This convenience function opens your browser with the help pages for crmPack. } \author{ -Daniel Sabanes Bove \email{sabanesd@roche.com} +Daniel Sabanes Bove \email{sabanesd@rconis.com} } \keyword{documentation} diff --git a/man/v_pseudo_simulations.Rd b/man/v_pseudo_simulations.Rd index 04fa12af7..ceaabe354 100644 --- a/man/v_pseudo_simulations.Rd +++ b/man/v_pseudo_simulations.Rd @@ -39,7 +39,7 @@ contains valid \code{fit_eff}, \code{final_gstar_estimates} , \code{final_gstar_ object and valid \code{sigma2_est} simulations. \item \code{v_pseudo_dual_flex_simulations()}: validates that the \code{\link{PseudoDualFlexiSimulations}} -object contains valid \code{sigma2_beta_west} vector of the final posterior mean +object contains valid \code{sigma2_beta_w_est} vector of the final posterior mean sigma2betaW estimates.\code{FinalGstarEstimates} , \code{FinalGstarAtDoseGrid}, }} diff --git a/tests/testthat/test-Simulations-class.R b/tests/testthat/test-Simulations-class.R index 1edc9ca13..c3a55110e 100644 --- a/tests/testthat/test-Simulations-class.R +++ b/tests/testthat/test-Simulations-class.R @@ -495,7 +495,7 @@ test_that("PseudoDualFlexiSimulations can be instantiated using the constructor" final_optimal_dose <- c(0.5, 0.6) final_optimal_dose_at_dose_grid <- c(0.7, 0.8) sigma2_est <- c(0.01, 0.02) - sigma2_beta_west <- c(0.03, 0.04) + sigma2_beta_w_est <- c(0.03, 0.04) fit <- list(c(0.1, 0.2), c(0.3, 0.4)) final_td_target_during_trial_estimates <- c(0.5, 0.6) @@ -538,7 +538,7 @@ test_that("PseudoDualFlexiSimulations can be instantiated using the constructor" final_optimal_dose = final_optimal_dose, final_optimal_dose_at_dose_grid = final_optimal_dose_at_dose_grid, sigma2_est = sigma2_est, - sigma2_beta_west = sigma2_beta_west, + sigma2_beta_w_est = sigma2_beta_w_est, fit = fit, data = data, doses = doses, @@ -556,14 +556,14 @@ test_that("PseudoDualFlexiSimulations can be instantiated using the constructor" ) expect_valid(sim_obj, "PseudoDualFlexiSimulations") - expect_identical(sim_obj@sigma2_beta_west, sigma2_beta_west) + expect_identical(sim_obj@sigma2_beta_w_est, sigma2_beta_w_est) }) test_that("PseudoDualFlexiSimulations user constructor argument names", { expect_function( PseudoDualFlexiSimulations, args = c( - "sigma2_beta_west", "..." + "sigma2_beta_w_est", "..." ), ordered = TRUE )