aboutsummaryrefslogtreecommitdiff
path: root/apps/rappor-sim/ui.R
blob: 9a1eb63db48499b7a76d71ea18b55c3dcec8fbf0 (plain)
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
library(shiny)

shinyUI(pageWithSidebar(
                        headerPanel("RAPPOR Simulation"),
                        sidebarPanel(
                                     tabsetPanel(
                                                 tabPanel("RAPPOR",
                                                          selectInput("size", "Bloom filter size:",
                                                                      c(4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096),
                                                                      selected = 128),
                                                          selectInput("hashes", "Number of hash functions:",
                                                                      c(1, 2, 4, 8, 16, 32),
                                                                      selected = 2),
                                                          selectInput("instances", "Number of cohorts:",
                                                                      c(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024),
                                                                      selected = 8),
                                                          br(),
                                                          br(),
                                                          sliderInput("N", "Number of samples to generate:",
                                                                      min = 100000, max = 10000000,
                                                                      value = 1000000, step = 100000),
                                                          br(),
                                                          helpText(actionButton("sample", "Rerun Simulations"), align = "center"),
                                                          br(),
                                                          br(),
                                                          helpText("Version 0.1", align = "center"),
                                                          helpText(a("RAPPOR Repository", href="http://github.com/google/rappor"), align = "center")),
                                                 tabPanel("Privacy",
                                                          sliderInput("p", "Probability of reporting noise (p):",
                                                                      min = .01, max = .99, value = .5, step = .01),
                                                          sliderInput("q", "Probability of reporting signal (q):",
                                                                      min = .01, max = .99, value = .75, step = .01),
                                                          sliderInput("f", "Probability of lies (f):",
                                                                      min = 0, max = .99, value = .5, step = .01),
                                                          br(),
                                                          htmlOutput("epsilon"),
                                                          br(),
                                                          helpText("* In addition to p, q and f, the number of hash functions (set in the RAPPOR tab) also effects privacy guarantees."),
                                                          br(),
                                                          br(),
                                                          br()
                                                          ),
                                                 tabPanel("Population",
                                                          sliderInput("nstrs", "Number of strings:",
                                                                      min = 100, max = 10000, value = 300, step = 100),
                                                          br(),
                                                          sliderInput("nonzero", "Proportion of non-zero strings:",
                                                                      min = .1, max = 1, value = 0.5, step = .1),
                                                          br(),
                                                          selectInput("decay", "Decay of non-zero strings",
                                                                      c("Linear", "Exponential", "Constant"),
                                                                      selected = "Exponential"),
                                                          br(),
                                                          conditionalPanel(condition = "input.decay == 'Exponential'",
                                                                           sliderInput("expo", "Rate of exponential decay",
                                                                                       min = 1, max = 200, value = 10, step = 1)),
                                                          sliderInput("background", "Frequency of background strings:",
                                                                      min = 0, max = .2, value = .05, step = .01),
                                                          br(),
                                                          br(),
                                                          br()
                                                 ),
                                                 tabPanel("Decoding",
                                                          sliderInput("alpha", "Alpha - probability of false positive:",
                                                                      min = .01, max = .3, value = .05, step = .01),
                                                          br(),
                                                          selectInput("correction", "Multiple testing correction",
                                                                      c("None", "Bonferroni", "FDR"),
                                                                      selected = "FDR"),
                                                          br(),
                                                          sliderInput("missing", "Proportion of non-zero strings missing from decoding:",
                                                                      min = 0, max = 1, value = 0, step = .1),
                                                          br()
                                                          )
                                     )),
                        mainPanel(
                                  tabsetPanel(
                                              tabPanel("Life of a  Report",
                                                       actionButton("new_user", "New Participant"),
                                                       actionButton("new_value", "New Value"),
                                                       actionButton("new_report", "New Report"),
                                                       plotOutput("example", height = "600px")),
                                              tabPanel("Population", plotOutput("probs", height = "600px")),
                                              tabPanel("Results", helpText(h3("Summary")), htmlOutput("pr"), br(), br(), dataTableOutput("tab")),
                                              tabPanel("True Bits", plotOutput("truth", height = "800px")),
                                              tabPanel("Estimated Bits", plotOutput("ests", height = "800px")),
                                              tabPanel("Estimates vs Truth", plotOutput("ests_truth", height = "600px")),
                                              # tabPanel("Lasso", plotOutput("lasso", height = "600px")),
                                              tabPanel("Residuals", plotOutput("resid", height = "600px"))
                                              )
                                  )
                        ))