forked from nickseewald/mrt-ss-calculator
/
ui.R
802 lines (685 loc) · 47.4 KB
/
ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
# Copyright 2016 Nicholas J. Seewald and Peng Liao
# This file is part of MRT-SS Calculator.
#
# MRT-SS Calculator is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# MRT-SS Calculator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with MRT-SS Calculator. If not, see <http://www.gnu.org/licenses/>.
#
# Contact the authors at nseewald@umich.edu or pengliao@umich.edu
library(shiny)
library(shinyBS)
library(shinyjs)
source("server.R")
shinyUI(fluidPage(
titlePanel(HTML("<strong>MRT-SS Calculator</strong>: A Sample Size Calculator for Micro-Randomized Trials"),
windowTitle = "MRT-SS Calculator"),
useShinyjs(),
####Sample Size Calculator Simple version####
### Print error validation in "red" ###
tags$head(
tags$style(HTML("
.shiny-output-error-validation {
color: red;
}
")),
includeScript("www/google-analytics.js")
),
### CSS HEADER ###
### Apply style attributes across the application
tags$head(
tags$style(type = 'text/css',"input[type='number'] {width:90px}"), #set width of numericInputs
tags$link(rel = "stylesheet", href = "//fonts.googleapis.com/css?family=Roboto|Roboto+Condensed"),
tags$style("body {font-family: 'Roboto', sans-serif;}
h1 {font-family: 'Roboto Condensed', sans-serif;}
h2 {font-family: 'Roboto Condensed', sans-serif;}
h3 {font-family: 'Roboto Condensed', sans-serif;}
h4 {font-family: 'Roboto Condensed', sans-serif;}
h5 {font-family: 'Roboto Condensed', sans-serif;}
h6 {font-family: 'Roboto Condensed', sans-serif;}") #apply font styles
),
### Introduction of MRT-SS Calculator on left-hand side panel ###
sidebarPanel(
includeHTML("www/sidebar.html")
),
### Main Panel on the right-hand side ###
mainPanel(
tags$hr(),
### Study Setup ###
h3("Study Setup"),
fluidRow(
column(3,
numericInput("days",label = "Duration of the Study (Days)",value = 42)
),
column(4,
numericInput("occ_per_day",label = "Number of Decision Time Points per Day",value = 5)
),
column(5,
textOutput("setting_warning") ### output warnings when you type in wrong format for
) ### "Duration of the study" and "Number of decision time
), ### per day"
tags$hr(),
#### time-varying randomization probability ####
h3("Randomization Probability"),
tabsetPanel(id = "ranPro",
### Input of constant randomization probability ###
tabPanel("Constant",
br(),
fluidRow(
column(6,
numericInput("P_intervene",label = "Constant Randomization Probability",value = 0.4 )
),
column(6,
textOutput("setting_warning_ranPro") ### Output warnings when you type in wrong format for
) ### "Value of Constant Randomization Probability"
)
),
### Input of time-varying randomization probability ###
tabPanel("Time-varying",
br(),
fluidRow(helpText(textOutput("timevar_prob_text"))),
hr(),
fluidRow(
column(4,
# textOutput("timevar_prob_text"),
radioButtons("numbers", "Number of Inputs:",
c("One per Day" = "re_days",
"One per Decision Time" = "re_dec")), ### two choices for uploading files ###
### uploading file respect to decision times ###
conditionalPanel(condition="input.numbers =='re_dec'",
fileInput('file1', 'Choose a .csv file containing time-varying randomization probabilities (one per decision time) to upload',
accept = c('.csv')
)
),
###uploading file respect to dyas ###
conditionalPanel(condition="input.numbers =='re_days'",
fileInput('file2', 'Choose a .csv file containing time-varying randomization probabilities (one per day) to upload',
accept = c('.csv')
)
),
bsButton("file.resetbutton", "Reset file upload", style = "link")
),
column(4,
### downloading the sample file for "respecting to days" and
### "respecting to number of days"
p("If you would like to use a template, you can download one here:"),
downloadButton("timevar_prob_template", "Download Template"),
br(),
textOutput("download_template_caption")
),
column(4,
### showing the first 5 rows of the uploaded file ###
conditionalPanel(condition="input.numbers =='re_dec'",
p('Showing the first 5 rows of the uploaded file. '),
tableOutput('P_inter_table_dec')
),
conditionalPanel(condition="input.numbers =='re_days'",
p('Showing the first 5 rows of the uploaded file. '),
tableOutput('P_inter_table_days')
)
)
)
)
),
tags$hr(),
#### Expected Availability ####
h3("Expected Availability"),
fluidRow(
column(5,
### Three patterns of expected availability to choose from
### quadratic, constant and linear
selectizeInput("tau_choices", label = "Select one of the following patterns for the expected availability",
choices=list("Quadratic" = "quadratic","Constant"="constant",
"Linear"="linear"),
options = list(
placeholder = "Please select a pattern",
onInitialize = I('function() { this.setValue(0); }')
)
),
### Inputs for constant pattern of expected availability ###
conditionalPanel(condition="input.tau_choices =='constant' ",
sliderInput("tau_mean_a",label="Average of Expected Availability",min = 0, max = 1,value = 0.5)),
### Inputs for linear pattern of expected availability ###
conditionalPanel(condition="input.tau_choices == 'linear' ",
sliderInput("tau_mean_c",label="Average of Expected Availability",min = 0, max = 1,value = 0.5),
sliderInput("tau_initial_c", label = "Initial Value of Expected Availability",
min = 0, max = 1,value = 0.2)),
### Inputs for quadratic pattern of expected availability ###
conditionalPanel(condition="input.tau_choices == 'quadratic' ",
sliderInput("tau_mean_e",label="Average of Expected Availability",min = 0, max = 1,value = 0.5),
sliderInput("quadratic_initial", label = "Initial value of Expected Availability",min =0, max = 1, value = 0.7),
numericInput("quadratic_max", label = "Changing Point of Availability", value = 42)),
### Comments on constant pattern of expected availability ###
conditionalPanel(condition="input.tau_choices == 'constant'",
p(em("Notes: ")," A simplistic constant availability pattern.")
),
### Comments on linear pattern of expected availability ###
conditionalPanel(condition="input.tau_choices == 'linear'",
p(em("Notes: "), "A linearly increasing pattern of expected availability might be used if participants
will find the intervention useful and thus more likely to turn the intervention on"),
p("A linearly decreasing pattern of expected availability might be used if participants learn more about the intervetion
and get bored through the course of the study and thus getting less likely to turn on the invervention.")
),
### Comments on quadratic pattern of expected availability ###
conditionalPanel(condition="input.tau_choices == 'quadratic'",
p(em("Notes: "),"A quadratic pattern of availability. Here the changing point of availability refers to day of either maximal of minimal availability,
depending on the input values of initial and average availability")
),
### invisible checkboxInput that will not show on the screen
### This invisible checkboxinput is used to check whether a specific
### actionbutton is pressed.
conditionalPanel(condition="input.tau_choices == 'invisible'", ### this condition is nver true, which make it invisible ###
### invisible_a_size: to check whether I pressed the action button for calculating the sample size
# for quadratic trend of proximal effect and constant pattern for expected availability
checkboxInput("invisible_a_size",label = "Invisible_a_size",value = FALSE ),
### invisible_c_size: to check whether I pressed the action button for calculating the sample size
# for quadratic trend of proximal effect and linear pattern for expected availability
checkboxInput("invisible_c_size",label = "Invisible_c_size",value = FALSE ),
### invisible_e_size: to check whether I pressed the action button for calculating the sample size
# for quadratic trend of proximal effect and quadratic pattern for expected availability
checkboxInput("invisible_e_size",label = "Invisible_e_size",value = FALSE ),
### invisible_a1_size: to check whether I pressed the action button for calculating the sample size
# for constant trend of proximal effect and constant pattern for expected availability
checkboxInput("invisible_a1_size",label = "Invisible_a1_size",value = FALSE ),
### invisible_c1_size: to check whether I pressed the action button for calculating the sample size
# for constant trend of proximal effect and linear pattern for expected availability
checkboxInput("invisible_c1_size",label = "Invisible_c1_size",value = FALSE ),
### invisible_e1_size: to check whether I pressed the action button for calculating the sample size
# for constant trend of proximal effect and quadratic pattern for expected availability
checkboxInput("invisible_e1_size",label = "Invisible_e1_size",value = FALSE ),
### invisible_a2_size: to check whether I pressed the action button for calculating the sample size
# for linear trend of proximal effect and constant pattern for expected availability
checkboxInput("invisible_a2_size",label = "Invisible_a2_size",value = FALSE ),
### invisible_c2_size: to check whether I pressed the action button for calculating the sample size
# for linear trend of proximal effect and linear pattern for expected availability
checkboxInput("invisible_c2_size",label = "Invisible_c2_size",value = FALSE ),
### invisible_e2_size: to check whether I pressed the action button for calculating the sample size
# for linear trend of proximal effect and quadratic pattern for expected availability
checkboxInput("invisible_e2_size",label = "Invisible_e2_size",value = FALSE ),
### invisible_a_power: to check whether I pressed the action button for calculating the power
# for quadratic trend of proximal effect and constant pattern for expected availability
checkboxInput("invisible_a_power",label = "Invisible_a_power",value = FALSE ),
### invisible_c_power: to check whether I pressed the action button for calculating the power
# for quadratic trend of proximal effect and linear pattern for expected availability
checkboxInput("invisible_c_power",label = "Invisible_c_power",value = FALSE ),
### invisible_e_power: to check whether I pressed the action button for calculating the power
# for quadratic trend of proximal effect and quadratic pattern for expected availability
checkboxInput("invisible_e_power",label = "Invisible_e_power",value = FALSE ),
### invisible_a1_power: to check whether I pressed the action button for calculating the power
# for constant trend of proximal effect and constant pattern for expected availability
checkboxInput("invisible_a1_power",label = "Invisible_a1_power",value = FALSE ),
### invisible_c1_power: to check whether I pressed the action button for calculating the power
# for constant trend of proximal effect and linear pattern for expected availability
checkboxInput("invisible_c1_power",label = "Invisible_c1_power",value = FALSE ),
### invisible_e1_power: to check whether I pressed the action button for calculating the power
# for constant trend of proximal effect and quadratic pattern for expected availability
checkboxInput("invisible_e1_power",label = "Invisible_e1_power",value = FALSE ),
### invisible_a2_power: to check whether I pressed the action button for calculating the power
# for linear trend of proximal effect and constant pattern for expected availability
checkboxInput("invisible_a2_power",label = "Invisible_a2_power",value = FALSE ),
### invisible_c2_power: to check whether I pressed the action button for calculating the power
# for linear trend of proximal effect and linear pattern for expected availability
checkboxInput("invisible_c2_power",label = "Invisible_c2_power",value = FALSE ),
### invisible_e2_power: to check whether I pressed the action button for calculating the power
# for linear trend of proximal effect and quadratic pattern for expected availability
checkboxInput("invisible_e2_power",label = "Invisible_e2_power",value = FALSE )
)
),
column(1),
column(6,
### Output the graph of constant pattern of expected availability ###
conditionalPanel(condition="input.tau_choices=='constant'",
plotOutput("cst_graph")
),
### Output the graph of linear pattern of expected availability ###
conditionalPanel(condition="input.tau_choices=='linear'",
plotOutput("linear_graph")
),
### Output the graph of quadratic pattern of expected availability ###
conditionalPanel(condition="input.tau_choices=='quadratic'",
plotOutput("quadratic_graph")
)
)
),
tags$hr(),
#### Specifying trend for Proximal Treatment Effect ####
h3("Proximal Treatment Effect"),
fluidRow(
column(5,
### Three trends of proximal treatment effect to choose from
### quadratic, constant, linear
selectizeInput("beta_choices", label = "Select one of the following trends for the proximal treatment effect",
choices=list("Quadratic" = "beta_quadratic","Constant"="beta_constant",
"Linear"="beta_linear"),
options = list(
placeholder = "Please select a trend",
onInitialize = I('function() { this.setValue(0); }')
)
),
### Inputs for quadratic trend of proximal treatment effect ###
conditionalPanel(condition="input.beta_choices =='beta_quadratic'",
sliderInput("beta_quadratic__mean",label="Average of Proximal Treatment Effect",min = 0, max = 0.2,value = 0.1),
numericInput("beta_quadratic__max", label = "Day of Maximal Proximal Treatment Effect", value = 28),
numericInput("beta_quadratic__initial", label = "Initial value of Proximal Treatment Effect",value = 0),
p(em("Notes"),": The quadratic form of a proximal treatment effect might be used if you expect that
initially participants will enthusiastically engage in the apps and thus the
proximal effect will get higher. Then, as the study goes on, some participants are
likely to disengage or begin to ignore the activity suggestions and hence a downward trend.")
),
### Inputs for constant trend of proximal treatment effect ###
conditionalPanel(condition="input.beta_choices =='beta_constant'",
sliderInput("beta_constant_mean", label = "Average of Proximal Treatment Effect",min = 0, max = 0.2, value = 0.1),
p(em("Notes"),": The proximal treatment effect stays constant over the study.")
),
### Inputs for linear trend of proximal treatment effect ###
conditionalPanel(condition="input.beta_choices == 'beta_linear' ",
sliderInput("beta_linear_mean",label="Average of Proximal Treatment Effect",min = 0, max = 0.2,value = 0.1),
sliderInput("beta_linear_initial", label = "Initial Value of Proximal Treatment Effect",
min = 0, max = 0.2,value = 0),
p(em("Notes"),": The linearly increasing form of a proximal treatment effect might be used if participants
will get more enthusiastically engage in the apps and thus the proximal effect will increase as the
study goes."),
p("The linearly decreasing form of a proximal treatment effect might be used if participants
are likely to disengage the activity suggestionss and thus the proximal effect will decrease as the
study goes.")
)
),
column(1),
column(6,
### output graph for quadratic trend of proximal treatment effect ###
conditionalPanel(condition="input.beta_choices =='beta_quadratic'",
plotOutput("beta_graph_quadratic")),
### output graph for constant trend of proximal treatment effect ###
conditionalPanel(condition="input.beta_choices =='beta_constant'",
plotOutput("beta_graph_constant")),
### output graph for linear trend of proximal treatment effect ###
conditionalPanel(condition="input.beta_choices =='beta_linear'",
plotOutput("beta_graph_linear"))
)
),
tags$hr(),
### Specifying whether you are interested in calculating the sample size or the power ###
fluidRow(
column(4,
### Choices to choose from "sample size" or "power" ###
radioButtons("radio_choices", label = "Are you interested in finding sample size or power?",
choices=list("Sample Size"="choice_sample_size","Power"="choice_power"),
selected = "choice_sample_size")
),
column(4,
### type in the desired power if you want to calculate the sample size ###
conditionalPanel(condition="input.radio_choices=='choice_sample_size'",
numericInput("power", label = HTML("Desired Power"), value = 0.8)
),
### type in the sample size if you want to calculate the power attained ###
conditionalPanel(condition="input.radio_choices=='choice_power'",
numericInput("sample_size", label = HTML("Number of Participants"), value = 40)
),
### type in significance level for both cases ###
numericInput("sigLev", label = HTML("Significance Level"), value = 0.05)
),
column(4,
### Output warnings if you type in wrong format for "desired power" ###
conditionalPanel(condition="input.radio_choices=='choice_sample_size'",
textOutput("choice_sample_size_warning")
),
### Output warnings if you type in wrong format for "Number of participants" ###
conditionalPanel(condition="input.radio_choices=='choice_power'",
textOutput("choice_power_warning")
),
### Output warnings if you type in wrong format for "Significance level" ###
textOutput("significance_warning")
)
),
tags$hr(),
### Output warnings if you didn't choose any patterns for expected availability ###
conditionalPanel(condition="input.tau_choices !='constant'
&& input.tau_choices != 'quadratic'
&& input.tau_choices != 'linear'",
uiOutput("result_warning")
),
### Output warnings if you didn't choose any patterns for proximal treatment effect ###
conditionalPanel(condition="input.beta_choices !='beta_constant'
&&input.beta_choices != 'beta_linear'
&& input.beta_choices != 'beta_quadratic'",
uiOutput("result_warning_beta")
),
##### choice to calculate sample size(action buttons) #####
### action button to calculate sample size for constant expected availability and
### quadratic proximal treatment effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_sample_size' ",
actionButton("getResult_a_size","Get Result")
),
### action button to calculate sample size for linear expected availability and
### quadratic proximal treatment effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_sample_size' ",
actionButton("getResult_c_size","Get Result")
),
### action button to calculate sample size for quadratic expected availability and
### quadratic proximal treatment effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_sample_size' ",
actionButton("getResult_e_size","Get Result")
),
### action button to calculate sample size for constant expected availability and
### constant proximal treatment effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_sample_size' ",
actionButton("getResult_a1_size","Get Result")
),
### action button to calculate sample size for linear expected availability and
### constant proximal treatment effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_sample_size' ",
actionButton("getResult_c1_size","Get Result")
),
### action button to calculate sample size for quadratic expected availability and
### constant proximal treatment effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_sample_size' ",
actionButton("getResult_e1_size","Get Result")
),
### action button to calculate sample size for constant expected availability and
### linear proximal treatment effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_sample_size' ",
actionButton("getResult_a2_size","Get Result")
),
### action button to calculate sample size for linear expected availability and
### linear proximal treatment effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_sample_size' ",
actionButton("getResult_c2_size","Get Result")
),
### action button to calculate sample size for quadratic expected availability and
### linear proximal treatment effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_sample_size' ",
actionButton("getResult_e2_size","Get Result")
),
##### choice to calculate power(action buttons) #####
### action button to calculate power for constant expected availability and
### quadratic proximal treatment effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_power' ",
actionButton("getResult_a_power","Get Result")
),
### action button to calculate power for linear expected availability and
### quadratic proximal treatment effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_power' ",
actionButton("getResult_c_power","Get Result")
),
### action button to calculate power for quadratic expected availability and
### quadratic proximal treatment effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_power' ",
actionButton("getResult_e_power","Get Result")
),
### action button to calculate power for constant expected availability and
### constant proximal treatment effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_power' ",
actionButton("getResult_a1_power","Get Result")
),
### action button to calculate power for linear expected availability and
### constant proximal treatment effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_power' ",
actionButton("getResult_c1_power","Get Result")
),
### action button to calculate power for quadratic expected availability and
### constant proximal treatment effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_power' ",
actionButton("getResult_e1_power","Get Result")
),
### action button to calculate power for constant expected availability and
### linear proximal treatment effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_power' ",
actionButton("getResult_a2_power","Get Result")
),
### action button to calculate power for linear expected availability and
### linear proximal treatment effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_power' ",
actionButton("getResult_c2_power","Get Result")
),
### action button to calculate power for quadratic expected availability and
### linear proximal treatment effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_power' ",
actionButton("getResult_e2_power","Get Result")
),
br(),
conditionalPanel(condition="(input.tau_choices =='constant'
|| input.tau_choices == 'quadratic'
|| input.tau_choices == 'linear')
&& (input.beta_choices =='beta_constant'
||input.beta_choices == 'beta_linear'
|| input.beta_choices == 'beta_quadratic')",
tabsetPanel(
### Current result ###
tabPanel("Current Result",
################choice to calculate sample size(results) ###############
###current result of sample size for constant expected availability and
### quadratic proximal effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_sample_size' ",
uiOutput("result_a")
),
###current result of sample size for linear expected availability and
### quadratic proximal effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_sample_size' ",
uiOutput("result_c")
),
###current result of sample size for quaratic expected availability and
### quadratic proximal effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_sample_size' ",
uiOutput("result_e")
),
###current result of sample size for constant expected availability and
### constant proximal effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_sample_size' ",
uiOutput("result_a1")
),
###current result of sample size for linear expected availability and
### constant proximal effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_sample_size' ",
uiOutput("result_c1")
),
###current result of sample size for quaratic expected availability and
### constant proximal effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_sample_size' ",
uiOutput("result_e1")
),
###current result of sample size for constant expected availability and
### linear proximal effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_sample_size' ",
uiOutput("result_a2")
),
###current result of sample size for linear expected availability and
### linear proximal effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_sample_size' ",
uiOutput("result_c2")
),
###current result of sample size for quadratic expected availability and
### linear proximal effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_sample_size' ",
uiOutput("result_e2")
),
############# choice to calculate the power(results) ####################
###current result of power for constant expected availability and
### quadratic proximal effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_power' ",
uiOutput("result_a_power")
),
###current result of power for linear expected availability and
### quadratic proximal effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_power' ",
uiOutput("result_c_power")
),
###current result of power for quadratic expected availability and
### quadratic proximal effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_quadratic'
&& input.radio_choices == 'choice_power' ",
uiOutput("result_e_power")
),
###current result of power for constant expected availability and
### constant proximal effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_power' ",
uiOutput("result_a1_power")
),
###current result of power for linear expected availability and
### constant proximal effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_power' ",
uiOutput("result_c1_power")
),
###current result of power for quadratic expected availability and
### constant proximal effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_constant'
&& input.radio_choices == 'choice_power' ",
uiOutput("result_e1_power")
),
###current result of power for constant expected availability and
### linear proximal effect
conditionalPanel(condition="input.tau_choices =='constant'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_power' ",
uiOutput("result_a2_power")
),
###current result of power for linear expected availability and
### linear proximal effect
conditionalPanel(condition="input.tau_choices =='linear'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_power' ",
uiOutput("result_c2_power")
),
###current result of power for quadratic expected availability and
### linear proximal effect
conditionalPanel(condition="input.tau_choices=='quadratic'
&& input.beta_choices == 'beta_linear'
&& input.radio_choices == 'choice_power' ",
uiOutput("result_e2_power")
)
),
################result of history table ######################
tabPanel("History",
### download the result table of sample size ###
conditionalPanel(condition="input.radio_choices=='choice_sample_size'
&& (input.tau_choices == 'constant'
|| input.tau_choices =='linear'
|| input.tau_choices == 'quadratic' )
&&(input.beta_choices == 'beta_constant'
|| input.beta_choices =='beta_linear'
|| input.beta_choices == 'beta_quadratic')",
fluidRow(
column(2,
radioButtons("filetype_size", "File type:",
choices = c("csv", "tsv"))
),
column(3,
br(),
downloadButton('downloadData_size', 'Download')
)
),
tableOutput("result_table_size") ### Output the table result for sample size ###
),
### download the result table of power ###
conditionalPanel(condition="input.radio_choices=='choice_power'
&& (input.tau_choices == 'constant'
|| input.tau_choices =='linear'
|| input.tau_choices == 'quadratic' )
&&(input.beta_choices == 'beta_constant'
|| input.beta_choices =='beta_linear'
|| input.beta_choices == 'beta_quadratic')",
fluidRow(
column(2,
radioButtons("filetype_power", "File type:",
choices = c("csv", "tsv"))
),
column(3,
br(),
downloadButton('downloadData_power', 'Download')
)
),
tableOutput("result_table_power") ### Output the table result for power ###
)
)
)
),
br(),
br(),
br(),
br(),
br()
),
#### A TOOLTIPS: to give you tips for typeing in numeric inputs. ####
bsTooltip(id = "days", title = "integer greater than 0",placement="right", trigger = "focus"),
bsTooltip(id = "occ_per_day", title = "integer greater than 0",placement="right", trigger = "focus"),
bsTooltip(id = "P_intervene", title = "Input must range from 0-1" ,placement="right", trigger = "focus"),
bsTooltip(id = "sigLev", title = "Input must range from 0-1" ,placement="right", trigger = "focus"),
bsTooltip(id = "power", title = "Input must range from 0-1" ,placement="right", trigger = "focus"),
bsTooltip(id = "beta_quadratic__initial", title = "Input must be greater than or equal to 0, and less than or equal to Average Standardized Effect",placement="right", trigger = "focus"),
bsTooltip(id = "beta_quadratic__max", title = "Input must be integer greater than 0",placement="right", trigger = "focus"),
bsTooltip(id = "sample_size", title = "Input must be integer greater than 1",placement="right", trigger = "focus"),
bsTooltip(id = "quadratic_max", title = "Input must be integer greater than 0",placement="right", trigger = "focus"),
collapsable = TRUE,
footer = HTML("<p style = 'font-size:12px'> Please direct correspondence to <a href='mailto:pengliao@umich.edu'>pengliao@umich.edu</a></p>")
))