Skip to content

Commit

Permalink
fix par names
Browse files Browse the repository at this point in the history
  • Loading branch information
pengguanya committed Aug 10, 2024
1 parent 8969205 commit 92421f2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions R/Simulations-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -713,30 +713,30 @@ 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"
)

## constructor ----

#' @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
)
}

Expand Down
2 changes: 1 addition & 1 deletion R/Simulations-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions R/Simulations-validity.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
6 changes: 3 additions & 3 deletions man/PseudoDualFlexiSimulations-class.Rd

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

2 changes: 1 addition & 1 deletion man/crmPackExample.Rd

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

2 changes: 1 addition & 1 deletion man/crmPackHelp.Rd

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

2 changes: 1 addition & 1 deletion man/v_pseudo_simulations.Rd

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

8 changes: 4 additions & 4 deletions tests/testthat/test-Simulations-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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
)
Expand Down

0 comments on commit 92421f2

Please sign in to comment.