Skip to content

Commit

Permalink
Changed shiny app ui to have multiple tabs for power calculation, exp…
Browse files Browse the repository at this point in the history
…lanations, and references
  • Loading branch information
kappelmann committed Nov 28, 2019
1 parent 1c7c48f commit a4fc436
Showing 1 changed file with 200 additions and 109 deletions.
309 changes: 200 additions & 109 deletions ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,122 +7,213 @@ library("shiny")
library("semantic.dashboard")


ui <- dashboardPage(

# -----------------Sidebar--------------------------------

sidebar <- dashboardSidebar(

side = "left",
color = "blue",
size = "thin",
inverted = TRUE,

dashboardHeader(
sidebarMenu(

menuItem("Power Calculation", tabName = "calculation", icon = icon("calculator")),
menuItem("Explanations", tabName = "explanation", icon = icon("th")),
menuItem("Reference", tabName = "reference", icon = icon("info circle"))

)
)

# -----------------Body-----------------------------------

body <- dashboardBody(
tabItems(

# -----------------Power Calculation Tab----------------
tabItem(tabName = "calculation",


fluidRow(


# ----------Power Analysis Output---------
box(
title = "Power Analysis",
color = "blue",

h1("Power Calculation"),
p("Below you can find results from power analysis for the", strong("nested-precision Randomised Controlled Trial (npRCT)"),". You can set parameters for power analysis in the box to the right. Results from power analysis will change accordingly below."),
box(
title = "Results",
color = "blue",
collapsible = FALSE,

h3("Total Sample Size"),
textOutput("n_total"),

h3("Point of Stratification"),
textOutput("n_strat"),

h3("Saved Sample Size"),
textOutput("n_saved")
)
),


# ----------Set RCT Parameters------------
box(
title = "Set Parameters",
color = "blue",


# ----------Traditional RCT Parameters------------
h2("Traditional RCT"),
sliderInput("d1",
"Effect Size",
step = 0.01,
min = 0,
max = 1,
value = 0.5),
br(),
sliderInput("power1",
"Power",
step = 0.01,
min = 0.5,
max = 1,
value = 0.8),
br(),
sliderInput("sig.level1",
"Significance Level",
step = 0.001,
min = 0.001,
max = 0.1,
value = 0.05),
br(),
radioButtons("alternative1",
NULL,
c("Two Sided Test"= "two.sided",
"One Sided Test"= "greater"),
selected = "two.sided"),


# ----------Precision RCT Parameters------------
h2("Precision RCT"),
sliderInput("d2",
"Effect Size",
step = 0.01,
min = 0,
max = 1,
value = 0.5),
br(),
sliderInput("power2",
"Power",
step = 0.01,
min = 0.5,
max = 1,
value = 0.8),
br(),
sliderInput("sig.level2",
"Significance Level",
step = 0.001,
min = 0.001,
max = 0.1,
value = 0.05),
br(),
radioButtons("alternative2",
NULL,
c("Two Sided Test"= "two.sided",
"One Sided Test"= "greater"),
selected = "two.sided")

)




)


),


# -----------------Explanation Tab----------------------
tabItem(tabName = "explanation",



fluidRow(



# ----------Ethical Implications---------------
box(
title = "Ethical Implications",
color = "blue",

#h2("Ethical Implications"),
p("There are the following ethical implications.")


),

# ----------Negative Values-------------------
box(
title = "Negative Values",
color = "blue",

#h2("Negative Values"),
p("Below you can find results from power analysis for the", strong("nested-precision Randomised Controlled Trial (npRCT)"),". You can set parameters for power analysis in the box to the right. Results from power analysis will change accordingly below.")

)

)

),


# -----------------Reference Tab----------------------
tabItem(tabName = "reference",



fluidRow(



# ----------Reference box---------------------
box(
title = "References",
color = "blue",

#h2("Ethical Implications"),
p(strong("This is where the letter is published."))


)


)

)

)
)

# -----------------Defining UI----------------------------

ui <- dashboardPage(

dashboardHeader(

h1("nested-precision Randomised Controlled Trial (npRCT)", style = "color:black"),

color = "blue",
disable = FALSE
),

dashboardSidebar(
side = "left",
color = "blue",
size = "thin",
helpText("This is a help text."),


),


# ----------------dashboardBody---------------------
dashboardBody(
fluidRow(



# ----------Power Analysis Output---------
box(
title = "Power Analysis",
color = "blue",

h1("npRCT"),
p("Below you can find results from power analysis for the", strong("nested-precision Randomised Controlled Trial (npRCT)"),". You can set parameters for power analysis in the box to the right. Results from power analysis will change accordingly below."),
box(
title = "Results",
color = "grey",

h3("Total Sample Size"),
textOutput("n_total"),

h3("Point of Stratification"),
textOutput("n_strat"),

h3("Saved Sample Size"),
textOutput("n_saved")
)
),


# ----------Set RCT Parameters------------
box(
title = "Set Parameters",
color = "blue",


# ----------Traditional RCT Parameters------------
h2("Traditional RCT"),
sliderInput("d1",
"Effect Size",
step = 0.01,
min = 0,
max = 1,
value = 0.5),
br(),
sliderInput("power1",
"Power",
step = 0.01,
min = 0.5,
max = 1,
value = 0.8),
br(),
sliderInput("sig.level1",
"Significance Level",
step = 0.001,
min = 0.001,
max = 0.1,
value = 0.05),
br(),
radioButtons("alternative1",
NULL,
c("Two Sided Test"= "two.sided",
"One Sided Test"= "greater"),
selected = "two.sided"),


# ----------Precision RCT Parameters------------
h2("Precision RCT"),
sliderInput("d2",
"Effect Size",
step = 0.01,
min = 0,
max = 1,
value = 0.5),
br(),
sliderInput("power2",
"Power",
step = 0.01,
min = 0.5,
max = 1,
value = 0.8),
br(),
sliderInput("sig.level2",
"Significance Level",
step = 0.001,
min = 0.001,
max = 0.1,
value = 0.05),
br(),
radioButtons("alternative2",
NULL,
c("Two Sided Test"= "two.sided",
"One Sided Test"= "greater"),
selected = "two.sided")

)
)
)
sidebar,
body
)

0 comments on commit a4fc436

Please sign in to comment.