diff --git a/README.Rmd b/README.Rmd index 257892e7..1114beaa 100644 --- a/README.Rmd +++ b/README.Rmd @@ -71,9 +71,6 @@ enrollment duration of 12 months with exponential inter-arrival times. ```{r, message=FALSE, warning=FALSE} library(gsDesign2) -library(gsDesign) -library(dplyr) -library(gt) # Basic example @@ -97,10 +94,14 @@ The resulting failure rate specification is the following table. As many rows and strata as needed can be specified to approximate whatever patterns you wish. -```{r} -fail_rate %>% - gt() %>% - as_raw_html(inline_css = FALSE) +```{r, eval = FALSE} +fail_rate |> gt::gt() +``` + +```{r, echo = FALSE, eval = getRversion() >= "4.1"} +fail_rate |> + gt::gt() |> + gt::as_raw_html(inline_css = FALSE) ``` ### Step 2: derive a fixed design with no interim analyses @@ -111,8 +112,7 @@ Enrollment duration is the sum of `enroll_rate$duration`. We used `fixed_design()` since there is a single analysis: ```{r} -fd <- fixed_design( - method = "ahr", +fd <- fixed_design_ahr( enroll_rate = enroll_rate, fail_rate = fail_rate, alpha = 0.025, @@ -124,10 +124,14 @@ fd <- fixed_design( The input enrollment rates have now been scaled to achieve power: -```{r} -fd$enroll_rate %>% - gt() %>% - as_raw_html(inline_css = FALSE) +```{r, eval = FALSE} +fd$enroll_rate |> gt::gt() +``` + +```{r, echo = FALSE, eval = getRversion() >= "4.1"} +fd$enroll_rate |> + gt::gt() |> + gt::as_raw_html(inline_css = FALSE) ``` The failure and dropout rates remain unchanged from what was input. @@ -141,11 +145,17 @@ The summary is obtained below. The columns are: - `Power`: power corresponding to enrollment, failure rate, and trial targeted events. -```{r} -fd %>% - summary() %>% - as_gt() %>% - as_raw_html(inline_css = FALSE) +```{r, eval = FALSE} +fd |> + summary() |> + as_gt() +``` + +```{r, echo = FALSE, eval = getRversion() >= "4.1"} +fd |> + summary() |> + as_gt() |> + gt::as_raw_html(inline_css = FALSE) ``` ### Step 3: group sequential design @@ -198,9 +208,15 @@ treatment) for a proof of concept. Actual bounds and timing selected for a trial are situation dependent, but we hope the suggestions here are provocative for what might be considered. -```{r} -gsd %>% - summary() %>% - as_gt() %>% - as_raw_html(inline_css = FALSE) +```{r, eval = FALSE} +gsd |> + summary() |> + as_gt() +``` + +```{r, echo = FALSE, eval = getRversion() >= "4.1"} +gsd |> + summary() |> + as_gt() |> + gt::as_raw_html(inline_css = FALSE) ``` diff --git a/README.md b/README.md index 923e61f2..7dc7f8da 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,6 @@ enrollment duration of 12 months with exponential inter-arrival times. ``` r library(gsDesign2) -library(gsDesign) -library(dplyr) -library(gt) # Basic example @@ -78,34 +75,32 @@ rows and strata as needed can be specified to approximate whatever patterns you wish. ``` r -fail_rate %>% - gt() %>% - as_raw_html(inline_css = FALSE) +fail_rate |> gt::gt() ```
- + - + - - + + - - + +
stratum duration fail_ratehr dropout_ratehr
All 4 0.057762271.00.001
0.0011.0
All Inf 0.057762270.60.001
0.0010.6
@@ -120,8 +115,7 @@ and 90% power. We specify a trial duration of 36 months with analysis: ``` r -fd <- fixed_design( - method = "ahr", +fd <- fixed_design_ahr( enroll_rate = enroll_rate, fail_rate = fail_rate, alpha = 0.025, @@ -134,16 +128,14 @@ fd <- fixed_design( The input enrollment rates have now been scaled to achieve power: ``` r -fd$enroll_rate %>% - gt() %>% - as_raw_html(inline_css = FALSE) +fd$enroll_rate |> gt::gt() ```
- + @@ -171,10 +163,9 @@ summary is obtained below. The columns are: targeted events. ``` r -fd %>% - summary() %>% - as_gt() %>% - as_raw_html(inline_css = FALSE) +fd |> + summary() |> + as_gt() ```
@@ -182,32 +173,30 @@ fd %>%
stratum duration rate
- + - - + + - - - + + - - + - +
Fixed Design under AHR Method1Fixed Design under AHR Method1
Design NEventtimeEventsTime Bound alpha Powerdesign
Average hazard ratio 420.6346311.002836311.002836 1.959964 0.0250.9ahr
0.9
1 Power computed with average hazard ratio method.1 Power computed with average hazard ratio method.
@@ -264,10 +253,9 @@ a trial are situation dependent, but we hope the suggestions here are provocative for what might be considered. ``` r -gsd %>% - summary() %>% - as_gt() %>% - as_raw_html(inline_css = FALSE) +gsd |> + summary() |> + as_gt() ```
@@ -296,41 +284,41 @@ gsd %>% - Analysis: 1 Time: 8 Event: 53.2 AHR: 0.9 N: 279.11 Information fraction: 0.17 + Analysis: 1 Time: 8 N: 279.1 Event: 53.2 AHR: 0.91 Information fraction: 0.17 - Futility --1.28 -0.9000 -1.4210 -0.0539 -0.1000 + Futility +-1.28 +0.9000 +1.4210 +0.0539 +0.1000 - Analysis: 2 Time: 14 Event: 137.2 AHR: 0.8 N: 418.66 Information fraction: 0.44 + Analysis: 2 Time: 14 N: 418.7 Event: 137.2 AHR: 0.82 Information fraction: 0.44 - Futility -0.00 -0.5000 -1.0000 -0.1451 -0.5091 + Futility +0.00 +0.5000 +1.0000 +0.1451 +0.5091 - Analysis: 3 Time: 24 Event: 238.4 AHR: 0.7 N: 418.66 Information fraction: 0.76 + Analysis: 3 Time: 24 N: 418.7 Event: 238.4 AHR: 0.72 Information fraction: 0.76 - Efficacy -2.30 -0.0106 -0.7421 -0.5582 -0.0106 + Efficacy +2.30 +0.0106 +0.7421 +0.5582 +0.0106 - Analysis: 4 Time: 36 Event: 309.5 AHR: 0.7 N: 418.66 Information fraction: 1 + Analysis: 4 Time: 36 N: 418.7 Event: 309.5 AHR: 0.69 Information fraction: 1 - Efficacy -2.02 -0.0219 -0.7951 -0.8000 -3 0.0244 + Efficacy +2.02 +0.0219 +0.7951 +0.8000 +3 0.0244