Skip to content

Conversation

@jdblischak
Copy link
Collaborator

Closes #392
Unblocked by #584

Adds a print method for the classes gs_design and fixed_design. It suppresses the list element input as well as the attributes.

library("gsDesign2")

(gsd <- gs_design_ahr())
## $design
## [1] "ahr"
##
## $enroll_rate
## # A tibble: 3 × 3
##   stratum duration  rate
##   <chr>      <dbl> <dbl>
## 1 All            2  13.2
## 2 All            2  26.4
## 3 All           10  39.7
##
## $fail_rate
## # A tibble: 2 × 5
##   stratum duration fail_rate dropout_rate    hr
##   <chr>      <dbl>     <dbl>        <dbl> <dbl>
## 1 All            3    0.0770        0.001   0.9
## 2 All          100    0.0385        0.001   0.6
##
## $bound
## # A tibble: 1 × 7
##   analysis bound probability probability0     z `~hr at bound` `nominal p`
##      <dbl> <chr>       <dbl>        <dbl> <dbl>          <dbl>       <dbl>
## 1        1 upper         0.9        0.025  1.96          0.795      0.0250
##
## $analysis
## # A tibble: 1 × 10
##   analysis  time     n event   ahr theta  info info0 info_frac info_frac0
##      <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>     <dbl>      <dbl>
## 1        1    36  476.  292. 0.683 0.381  71.7  73.0         1          1
(gsd_sum <- summary(gsd))
## # A tibble: 1 × 7
## # Groups:   Analysis [1]
##   Analysis                Bound     Z `~HR at bound` `Nominal p` `Alternate hypothesis` `Null hypothesis`
##   <chr>                   <chr> <dbl>          <dbl>       <dbl>                  <dbl>             <dbl>
## 1 Analysis: 1 Time: 36 N… Effi…  1.96          0.795       0.025                    0.9             0.025
as_gt(gsd_sum)

(fd <- fixed_design_ahr(
  enroll_rate = define_enroll_rate(duration = 18, rate = 1),
  fail_rate = define_fail_rate(duration = 18, fail_rate = 0.05, dropout_rate = 0.001)
))
## $enroll_rate
## # A tibble: 1 × 3
##   stratum duration  rate
##   <chr>      <dbl> <dbl>
## 1 All           18     1
##
## $fail_rate
## # A tibble: 1 × 5
##   stratum duration fail_rate dropout_rate    hr
##   <chr>      <dbl>     <dbl>        <dbl> <dbl>
## 1 All           18      0.05        0.001     1
##
## $analysis
## # A tibble: 1 × 8
##   design     n event  time   ahr bound alpha  power
##   <chr>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>  <dbl>
## 1 ahr       18  10.6    36     1  1.96 0.025 0.0250
##
## $design
## [1] "ahr"
##
(fd_sum <- summary(fd))
## # A tibble: 1 × 8
##   Design                   N Events  Time   AHR Bound alpha  Power
##   <chr>                <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>  <dbl>
## 1 Average hazard ratio    18   10.6    36     1  1.96 0.025 0.0250
as_gt(fd_sum)

@jdblischak jdblischak self-assigned this Sep 17, 2025
Copy link
Collaborator

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small suggestion on simplifying the code.

Co-authored-by: Yihui Xie <xie@yihui.name>
@jdblischak jdblischak requested a review from yihui September 17, 2025 17:17
Copy link
Collaborator

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@LittleBeannie LittleBeannie merged commit 1282c0b into Merck:main Sep 18, 2025
7 checks passed
@jdblischak jdblischak deleted the print-gs-design branch September 18, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide the input parameters from print of a design object

3 participants