-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decimals display in summary
for a group sequential subject
#410
Comments
I confirmed I can reproduce the bug: git2r::commits()[[1]]
## [4a97d17] 2024-06-13: Merge pull request #420 from Merck/419-add-developer-test-for-gs_power_ahr
library(gsDesign2)
design <- gs_design_ahr(
# time of interim and final analyses
analysis_time = c(12, 24),
# spending bound for efficacy
upper = gs_spending_bound,
# O’Brien-Fleming spending function; total_spend is normally alpha
upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025),
# fixed Z-values will be provided for futility bound
lower = gs_b,
lpar = c(qnorm(0.1), -Inf, -Inf)
)
design |>
summary(
col_vars = c(
"z", "~hr at bound", "nominal p", "Alternate hypothesis", "Null hypothesis"
),
col_decimals = c(4, 4, 4, 4, 4)
) |>
as_gt()
## Adding missing grouping variables: `Analysis`
## Error in `dplyr::filter()`:
## ℹ In argument: `Bound == display_bound[1]`.
## ℹ In group 1: `Analysis = "Analysis: 1 Time: 12 N: 701.7 Event: 159.1 AHR: 0.81 Information
## fraction: 0.42"`.
## Caused by error:
## ! object 'Bound' not found
## Run `rlang::last_trace()` to see where the error occurred.
sessionInfo()
## R version 4.3.3 (2024-02-29 ucrt)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 11 x64 (build 22631)
##
## Matrix products: default
##
##
## locale:
## [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
## [3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
## [5] LC_TIME=English_United States.utf8
##
## time zone: America/New_York
## tzcode source: internal
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] gsDesign2_1.1.2.11
##
## loaded via a namespace (and not attached):
## [1] Matrix_1.6-5 gtable_0.3.5 dplyr_1.1.4 compiler_4.3.3 tidyselect_1.2.1
## [6] Rcpp_1.0.12 xml2_1.3.6 tidyr_1.3.1 splines_4.3.3 scales_1.3.0
## [11] fastmap_1.1.1 lattice_0.22-6 ggplot2_3.5.1 R6_2.5.1 generics_0.1.3
## [16] tibble_3.2.1 r2rtf_1.1.1 munsell_0.5.1 pillar_1.9.0 rlang_1.1.3
## [21] utf8_1.2.4 cli_3.6.2 withr_3.0.0 magrittr_2.0.3 digest_0.6.35
## [26] grid_4.3.3 rstudioapi_0.16.0 mvtnorm_1.2-4 xtable_1.8-4 gsDesign_3.6.2
## [31] lifecycle_1.0.4 vctrs_0.6.5 glue_1.7.0 data.table_1.15.4 survival_3.6-4
## [36] gt_0.10.1 fansi_1.0.6 colorspace_2.1-0 purrr_1.0.2 tools_4.3.3
## [41] pkgconfig_2.0.3 htmltools_0.5.8.1 |
From the backtrace, the error occurs in Line 309 in 4a97d17
rlang::last_trace()
## <error/rlang_error>
## Error in `dplyr::filter()`:
## ℹ In argument: `Bound == display_bound[1]`.
## ℹ In group 1: `Analysis = "Analysis: 1 Time: 12 N: 701.7 Event: 159.1 AHR: 0.81 Information
## fraction: 0.42"`.
## Caused by error:
## ! object 'Bound' not found
## ---
## Backtrace:
## ▆
## 1. ├─base::source("~/.active-rstudio-document", echo = TRUE)
## 2. │ ├─base::withVisible(eval(ei, envir))
## 3. │ └─base::eval(ei, envir)
## 4. │ └─base::eval(ei, envir)
## 5. ├─gsDesign2::as_gt(...) at ~/.active-rstudio-document:15:1
## 6. ├─gsDesign2:::as_gt.gs_design(...) at gsDesign2/R/as_gt.R:28:3
## 7. │ └─x %>% dplyr::filter(Bound == display_bound[1]) at gsDesign2/R/as_gt.R:309:3
## 8. ├─dplyr::filter(., Bound == display_bound[1])
## 9. └─dplyr:::filter.data.frame(., Bound == display_bound[1])
## 10. └─dplyr:::filter_rows(.data, dots, by)
## 11. └─dplyr:::filter_eval(...)
## 12. ├─base::withCallingHandlers(...)
## 13. └─mask$eval_all_filter(dots, env_filter)
## 14. └─dplyr (local) eval()
## Run rlang::last_trace(drop = FALSE) to see 3 hidden frames. |
I was worried that I introduced the bug in #403, but it appears to have existed prior to this. Below I reproduced the bug from commit 9071ab1 git2r::commits()[[1]]
## [9071ab1] 2024-05-23: Merge pull request #399 from Merck/397-update-gs_update_ahr-to-get-rid-of-ia_alpha_spending-and-fa_alpha_spending
library(gsDesign2)
packageVersion("gsDesign2")
## [1] ‘1.1.2.7’
design <- gs_design_ahr(
# time of interim and final analyses
analysis_time = c(12, 24),
# spending bound for efficacy
upper = gs_spending_bound,
# O’Brien-Fleming spending function; total_spend is normally alpha
upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025),
# fixed Z-values will be provided for futility bound
lower = gs_b,
lpar = c(qnorm(0.1), -Inf, -Inf)
)
design |>
summary(
col_vars = c(
"z", "~hr at bound", "nominal p", "Alternate hypothesis", "Null hypothesis"
),
col_decimals = c(4, 4, 4, 4, 4)
) |>
as_gt()
## Adding missing grouping variables: `Analysis`
## Error in `dplyr::filter()`:
## ℹ In argument: `Bound == display_bound[1]`.
## ℹ In group 1: `Analysis = "Analysis: 1 Time: 12 N: 701.7 Event: 159.1 AHR: 0.81 Information
## fraction: 0.42"`.
## Caused by error:
## ! object 'Bound' not found
## Run `rlang::last_trace()` to see where the error occurred. |
I don't think this bug is a regression. I think this is how it has always behaved. You have to include I couldn't find any tests or examples that use gsDesign2/vignettes/articles/story-update-boundary.Rmd Lines 134 to 140 in 4a97d17
If I add library(gsDesign2)
design <- gs_design_ahr(
# time of interim and final analyses
analysis_time = c(12, 24),
# spending bound for efficacy
upper = gs_spending_bound,
# O’Brien-Fleming spending function; total_spend is normally alpha
upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025),
# fixed Z-values will be provided for futility bound
lower = gs_b,
lpar = c(qnorm(0.1), -Inf, -Inf)
)
design |>
summary(
col_vars = c(
"bound", "z", "~hr at bound", "nominal p", "Alternate hypothesis", "Null hypothesis"
),
col_decimals = c(NA, 4, 4, 4, 4, 4)
) |>
as_gt()
## Adding missing grouping variables: `Analysis` Thus I think this warrants a discussion around the argument |
Thanks for researching this!
|
The following lines of codes gives me an error message:
The text was updated successfully, but these errors were encountered: