-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.R
106 lines (98 loc) · 2.92 KB
/
server.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
# Shiny App for visualization
function(input, output) {
output$dens_ingrds <- renderPlot({
if (input$orth) {
if (input$samplesplit) {
if (input$hq == "Tuned") {
est_selection <- c("theta_dml")
} else if (input$hq == "Underfitting") {
est_selection <- c("theta_dml_underfit")
} else if (input$hq == "Overfitting") {
est_selection <- c("theta_dml_overfit")
}
} else {
if (input$hq == "Tuned") {
est_selection <- c("theta_orth_nosplit")
} else if (input$hq == "Underfitting") {
est_selection <- c("theta_dml_nosplit_underfit")
} else if (input$hq == "Overfitting") {
est_selection <- c("theta_dml_nosplit_overfit")
}
}
} else {
if (input$samplesplit) {
if (input$hq == "Tuned") {
est_selection <- c("theta_nonorth")
} else if (input$hq == "Underfitting") {
est_selection <- c("theta_nonorth_underfit")
} else if (input$hq == "Overfitting") {
est_selection <- c("theta_nonorth_overfit")
}
} else {
if (input$hq == "Tuned") {
est_selection <- c("theta_nonorth_nosplit")
} else if (input$hq == "Underfitting") {
est_selection <- c("theta_nonorth_nosplit_underfit")
} else if (input$hq == "Overfitting") {
est_selection <- c("theta_nonorth_nosplit_overfit")
}
}
}
data <- estimates_scaled[estimation == est_selection, ]
g_dens <- ggplot(data) +
geom_histogram(aes(
y = ..density.., x = coef, fill = label,
col = label
),
bins = 30, alpha = 0.6
) +
geom_vline(aes(xintercept = 0), col = "black") +
suppressWarnings(geom_function(fun = dnorm, colour = "darkgrey")) +
scale_color_manual(
name = "",
values = colors
) +
scale_fill_manual(
name = "",
values = colors
) +
xlim(c(-6.0, 6.0)) +
xlab("") +
ylab("") +
theme_minimal() +
theme(legend.position = "none")
g_dens
})
output$dens_cf <- renderPlot({
if (!input$crossfit) {
est_selection <- c("theta_dml_nocf")
} else {
est_selection <- c("theta_dml")
}
data <- estimates_unscaled[estimation == est_selection, ]
g_dens_unscaled <- ggplot(data) +
geom_histogram(aes(
y = ..density.., x = coef, fill = label,
col = label
),
bins = 30, alpha = 0.9
) +
geom_vline(aes(xintercept = 0), col = "black") +
# suppressWarnings(geom_function(fun = dnorm, colour = "darkgrey")) +
scale_color_manual(
name = "",
values = colors
) +
scale_fill_manual(
name = "",
values = colors
) +
xlim(c(-0.25, 0.25)) +
ylim(c(0, 9)) +
xlab("") +
ylab("") +
theme_minimal() +
theme(legend.position = "none")
g_dens_unscaled
})
}