forked from fileds/ate-1-step-estimator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.R
143 lines (125 loc) · 5.66 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
library(shiny)
library(shinydashboard)
source("R/dgps.R")
source("R/estimate_ate_along_path.R")
source("R/influence_function_ate.R")
source("R/plots.R")
header <- dashboardHeader(
title = "ATE 1-Step Estimator"
)
body <- dashboardBody(
fluidRow(
column(width = 9,
box(width = NULL, title = "1-Step Estimator", status = "primary",
plotOutput("ifPlot"),
p(
class = "text-muted",
paste("Figure showing the ATE as a function of the",
"parametrized path (solid), the 1-step estimator",
"(dashed), and the empirical estimate (rightmost",
"point(s)). The path is a path the DGP space",
"from the empirical DGP to the true DGP as a convex",
"combination between the two. The empirical estimate",
"is based on model assumption and the 1-step estimator",
"corrects the bias introduced by the",
"model assumption asymptotically. Note: The true ATE",
"is calculated on the covariate range, [-6, 6].")
),
),
box(width = NULL, title = "DGPs and Sample", status = "primary",
plotOutput("dataPlot"),
p(
class = "text-muted",
paste("Figure showing the generated sample (points), the",
"true DGP (solid line), and the estimated DGP (dashed line).")
),
)
),
column(width = 3,
box(width = NULL, status = "warning", title = "Generate Sample",
sliderInput("sampleSize", "Sample size", min = 40, max = 1000,
value = 100, step = 10),
hr(),
actionButton(inputId = "generateButton",
label = "Generate sample")
),
box(width = NULL, status = "warning", title = "Data Generating Process",
radioButtons('dgpType', 'DGP Type',
choiceNames = c("Linear",
"Quadratic",
"2nd deg. polynomial",
"3rd deg. polynomial"),
choiceValues = c(1, 2, 3, 4),
selected = 1,
inline = FALSE),
p(
class = "text-muted",
paste("Select the underlying data generating process (DGP).",
"You can visualize the DGP as the 'True' curve in the 'DGPs",
"and Sample' figure.")
),
hr(),
sliderInput("varianceControl", "Variance of error of M0",
min = 0.1, max = 1, value = 0.5, step = 0.1),
sliderInput("varianceTreated", "Variance of error of M1",
min = 0.1, max = 1, value = 0.5, step = 0.1),
p(
class = "text-muted",
paste("Increase or decrease the variance in the treated and",
"control population.")
),
),
box(width = NULL, status = "warning", title = "Model",
checkboxGroupInput('modelTypes', 'Model',
choiceNames = c("True",
"Linear",
"2nd deg. polynomial",
"Kernel"),
choiceValues = c("True",
"Linear",
"Quadratic",
"Kernel"),
selected = c("True", "Linear"),
inline = FALSE),
p(
class = "text-muted",
paste("Select the model(s) to use in estimation of M0 and M1.",
"You can visualize the estimation in the 'DGPs and Sample'",
"figure.")
),
hr(),
sliderInput("kernelBw", "Kernel Bandwidth",
min = 0.1, max = 24, value = 2, step = 0.1),
p(
class = "text-muted",
paste("Select bandwith used in Kernel regression. ",
"Has no effect on 'Linear' or 'Quadratic'.")
),
actionButton(inputId = "updateBandwidth",
label = "Update Bandwidth")
)
)
)
)
footer_text <- p("Filip Edström and Mohammad Ghasempour, ",
a(href="https://www.stat4reg.se/home", "Stat4Reg"),
", Umeå University, 2022.", "For more information, feedback and contact please visit ",
a(href="https://github.com/fileds/ate-1-step-estimator", "GitHub/fileds"))
ui <- tagList(
dashboardPage(
header,
dashboardSidebar(disable = T),
body),
tags$footer(p(footer_text),
align = "center",
style = "
position:relative;
text-align: center;
bottom:0;
width:100%;
height:50px; /* Height of the footer */
color: #666;
padding: 10px;
background-color: #ECF0F5;
z-index: 1000;")
)