Skip to content

Commit

Permalink
Updated results box and included warnings for small/negative traditio…
Browse files Browse the repository at this point in the history
…nal RCT sample sizes
  • Loading branch information
kappelmann committed Dec 11, 2019
1 parent c3af7df commit 6901d5f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
28 changes: 25 additions & 3 deletions server.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,52 @@ 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 = "")

})


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 = "")

})

output$n_saved <- renderText({

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("")
}


})


}
24 changes: 11 additions & 13 deletions ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

)
),

Expand Down

0 comments on commit 6901d5f

Please sign in to comment.