-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.R
More file actions
325 lines (226 loc) · 17.8 KB
/
Copy pathui.R
File metadata and controls
325 lines (226 loc) · 17.8 KB
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
source("helper_functions.R")
# Apply the CSS used by the Shiny app to the ggplot2 plots
thematic_shiny()
ui <- page_sidebar(
theme = bs_theme(preset = 'minty',
version = 5,
"navbar-bg" = "green"),
title = "Model Builder: Load Data and Build some Models!",
sidebar = sidebar(
fileInput(inputId = "file", accept = c('csv', 'xlsx'),
label = "Upload Excel/CSV file"),
numericInput(inputId = "sheet_index",
label = "Choose sheet index if you uploaded Excel above",
min = 1,
max = 10,
value = 1),
# The tibble vars and the function 'myselectInput' are defined in the helper_functions.R script
pmap(vars[1,], mySelectInput),
pmap(vars[3,], mySelectInput),
pmap(vars[4,], mySelectInput),
pmap(vars[5,], mySelectInput),
pmap(vars[6,], mySelectInput),
pmap(vars[7,], mySelectInput)
),
layout_columns(
navbarPage("",
id = 'datasets',
tabPanel(
title = "App Information",
includeMarkdown("readme2.md")
),
navbarMenu("Transform Data",
tabpanFun1(id = "raw_data1", id2 = "down_raw", label = "Raw data", OutputId = "raw_data"),
tabpanFun1(id = "imp_data1", id2 = "down_imp", label = "Imputed data", OutputId = "imp_data"),
tabpanFun1(id = "l_transform", id2 = "down_log", label = "Log transform", OutputId = "log_data"),
tabpanFun1(id = "f_transform", id2 = "down_f", label = "First differences", OutputId = "first_data"),
tabpanFun1(id = "lag1_transform", id2 = "down_lag1", label = "First lag", OutputId = "lag1_data"),
tabpanFun1(id = "lag2_transform", id2 = "down_lag2", label = "Second lag", OutputId = "lag2_data"),
tabpanFun1(id = "lag3_transform", id2 = "down_lag3", label = "Third lag", OutputId = "lag3_data"),
tabpanFun1(id = "lag4_transform", id2 = "down_lag4", label = "Fourth lag", OutputId = "lag4_data")
),
navbarMenu("Model Results",
tabpanFun2(title = "Model results - First model",id1 = "model_summary1", id3 = "hetero", id4 = "multi", id5 = "auto",
id6 = "correct1", run_id = "run1"),
tabpanFun2(title = "Model results - Second model",id1 = "model_summary2", id3 = "hetero2", id4 = "multi2", id5 = "auto2",
id6 = "correct2", run_id = "run2"),
tabpanFun2(title = "Model results - Ridge Regression",
id1 = "model_summary3", id2 = "model_summary3_zero", id3 = "metrics3", run_id = "run3"),
tabpanFun2(title = "Forward elimination method", id1 = "forward_results", run_id = "run4"),
tabpanFun2(title = "Backward elimination method", id1 = "back_results", run_id = "run5"),
tabpanFun2(title = "Zero intercept model", id1 = "zero_results", run_id = "run_z")
),
tabPanel(
title = "Orcutt Cochrane correction",
actionButton("id_orc","Click here to run the model"),
downloadButton("orc_d","Download coefficients"),
verbatimTextOutput("correct_orcutt1"),
verbatimTextOutput("correct_diff")
),
navbarMenu("Time series models",
tabpanFun2(title = "Time series model", id1 = "model_summary4", run_id = "run6"),
tabpanFun2(title = "Time series model with lag 1", id1 = "model_summary5", run_id = "run7"),
tabPanel(
title = "Time series model: KOYCK",
verbatimTextOutput("model_summary6"),
#downloadButton("downloadPreds8", "Predictions"),
selectInput(inputId = "x_vars2",
label = "select a single predictor",
choices = "",
multiple = FALSE),
actionButton("run8", "Click here to run the model"),
),
tabpanFun2(title = "Time series model: VAR", id1 = "model_summary7", run_id = "run9"),
tabpanFun2(title = "Time series model: VECM", id1 = "model_summary8", run_id = "run10"),
# tabpanFun2(title = "Cubic spline interpolation for quarterly data", id1 = "cubic", run_id = "run11")
tabPanel(
title = "Cubic spline interpolation for quarterly data",
verbatimTextOutput("cubic"),
fileInput(inputId = "file2", accept = c('csv', 'xlsx'),
label = "Upload quarterly data"),
pmap(vars[2,], mySelectInput),
actionButton("run11", "Click here to run the model"),
downloadButton("qtr","Download quartely data"),
DTOutput('cubic_dt'),
plotOutput('cubic_plot')
)
),
navbarMenu("Visualization",
tabPanel(
title = "Visualize Model 1",
plotOutput("plot")
),
tabPanel(
title = "Visualize Model 2",
plotOutput("plot1")
),
tabPanel(
title = "Visualize Time series",
plotOutput("plot2"),
plotOutput("acf"),
plotOutput("pacf"),
verbatimTextOutput("dicky_test")
)
),
navbarMenu("Machine Learning models",
tabPanel(
sliderInput(inputId = "prop",
label = "Proportion for the training set",
value = 0,
min = 0,
max = 1,
step = 0.05),
title = "Logistic Classification",
actionButton("idn0", "Click here to run the model"),
#downloadButton("dw0","Download predictions"),
verbatimTextOutput("metrics0"),
DTOutput("preds0")
),
tabPanel(
sliderInput(inputId = "prop",
label = "Proportion for the training set",
value = 0,
min = 0,
max = 1,
step = 0.05),
title = "Decision Tree",
actionButton("idn1", "Click here to run the model"),
#downloadButton("dw1","Download predictions"),
verbatimTextOutput("metrics1"),
DTOutput("preds1")
),
tabPanel(
sliderInput(inputId = "prop",
label = "Proportion for the training set",
value = 0,
min = 0,
max = 1,
step = 0.05),
title = "Random Forest",
actionButton("idn2", "Click here to run the model"),
#downloadButton("dw2","Download predictions"),
verbatimTextOutput("metrics2"),
DTOutput("preds2")
),
tabPanel(
sliderInput(inputId = "prop",
label = "Proportion for the training set",
value = 0,
min = 0,
max = 1,
step = 0.05),
title = "Support Vector Machine",
actionButton("idn33", "Click here to run the model"),
#downloadButton("dw33","Download predictions"),
verbatimTextOutput("metrics33"),
verbatimTextOutput("svm_summary"),
DTOutput("preds3")
)
# tabPanel(
# title = "Model Comparison\n",
#
# verbatimTextOutput("mod_comp")
# )
),
tabPanel(
title = "IV Regression",
actionButton("idn3","Click here to run the model"),
downloadButton("dw3","Download coefficients"),
verbatimTextOutput("iv_summary")
),
tabPanel(
title = "Simplex Regression",
actionButton("ids3","Click here to run the model"),
#downloadButton("dws3","Download coefficients"),
verbatimTextOutput("simp_summary"),
plotOutput('simp_plot')
),
navbarMenu(
"Constrained Regression",
tabPanel(
title = "Constrained Regression with intercept",
pmap(vars[8,], mySelectInput),
actionButton("idc3","Click here to run the model"),
#downloadButton("dwc3","Download coefficients"),
verbatimTextOutput("cons_summary")
),
tabPanel(
title = "Constrained Regression without intercept",
# pmap(vars[8,], mySelectInput),
# actionButton("idc3_","Click here to run the model"),
#downloadButton("dwc3","Download coefficients"),
verbatimTextOutput("cons_summary_")
)
),
navbarMenu("Kalman Filter",
tabPanel(
title = "Kalman Filter without constraint",
actionButton("id_kalman0","Click here to run the model"),
#downloadButton("kalman_d","Download coefficients"),
verbatimTextOutput("kalman_summary0"),
plotOutput('kalman_plot0')
),
tabPanel(
title = "Kalman Filter with constraint",
actionButton("id_kalman","Click here to run the model"),
#downloadButton("kalman_d","Download coefficients"),
verbatimTextOutput("kalman_summary"),
plotOutput('kalman_plot')
)
),
tabPanel(
title = "Solver",
actionButton("id_solver","Click here to run the model"),
downloadButton("solver_d","Download coefficients"),
verbatimTextOutput("solver_summary")
),
tabPanel(
title = "Download Reports",
downloadButton("dw3_","Download coefficients"),
downloadButton("dw4_","Download Predictions"),
downloadButton("dw5_","Download a pdf report"),
actionButton('db', 'Save to data base')
)
)
)
)