From 6901d5fe6853bd8f32b6119854cd066dcf58e610 Mon Sep 17 00:00:00 2001 From: Nils Kappelmann Date: Wed, 11 Dec 2019 13:55:14 +0100 Subject: [PATCH] Updated results box and included warnings for small/negative traditional RCT sample sizes --- server.R | 28 +++++++++++++++++++++++++--- ui.R | 24 +++++++++++------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/server.R b/server.R index 76491cf..b662dcb 100644 --- a/server.R +++ b/server.R @@ -56,14 +56,16 @@ server <- function(input, output) { output$n_total <- renderText({ temp <- npRCT() - as.character(temp$n_total) + paste("Sample size for the total npRCT is: ", + temp$n_total * 2, sep = "") }) output$n_traditional <- renderText({ temp <- npRCT() - as.character(temp$n_strat) + paste("Sample size (per group) for the traditional RCT is: ", + temp$n_strat, sep = "") }) @@ -71,7 +73,8 @@ server <- function(input, output) { output$n_precision <- renderText({ temp <- npRCT() - as.character(temp$n_total - temp$n_strat) + paste("Sample size (per group) for the precision RCT is: ", + as.character(temp$n_total - temp$n_strat), sep = "") }) @@ -79,7 +82,26 @@ server <- function(input, output) { temp <- npRCT() as.character(temp$n_saved) + paste("Using the npRCT design (as compared to two independent RCTs) thus saves a sample size of ", + temp$n_saved, " participants per group.", sep = "") + }) + + output$warning <- renderText({ + + temp <- npRCT() + + if(temp$n_strat < 20) { + if(temp$n_strat >= 0) { + as.character("Please note that the sample size (per group) of the traditional RCT is relatively small (i.e., smaller than 20). If you aim for online identification of a precision algorithm, you may need to adjust your parameters. Visit the Explanations tab for more insights on practical considerations.") + } else { + as.character("WARNING: You have obtained a negative sample size for the traditional RCT. This occurs, if the to-be-detected effect of the precision RCT is much smaller than for the traditional RCT (i.e., all participants required for testing the traditional research question (intervention A or B) are recruited as part of the precision RCT. If you want to use the npRCT, please adjust parameters accordingly and visit the Explanations tab for more insights on practical considerations.") + } + } else { + as.character("") + } + }) + } \ No newline at end of file diff --git a/ui.R b/ui.R index 6bb225a..c7d404d 100644 --- a/ui.R +++ b/ui.R @@ -50,23 +50,21 @@ body <- dashboardBody( color = "blue", collapsible = FALSE, - h3("Total Sample Size"), + h3("Estimated Sample Sizes"), textOutput("n_total"), - - h3("Sample Sizes of nested RCTs"), - - h4("Traditional RCT"), + br(), textOutput("n_traditional"), - - icon("chevron circle down", align = "center"), - - h4("Precision RCT"), textOutput("n_precision"), - - - - h3("Saved Sample Size"), + textOutput("warning"), + tags$head(tags$style("#warning{color: red; + + font-style: italic; + }" + ) + ), + br(), textOutput("n_saved") + ) ),