-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinterpret.R
45 lines (41 loc) · 1.3 KB
/
interpret.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
hcd %>%
map(pvclust::pvpick) %>%
map(~.$clusters) %>%
map(enframe) %>%
map(unnest, cols = c(value)) %>%
bind_rows(.id = "scen") %>%
mutate(scen = factor(scen,
levels = c("lo","mid","hi"),
labels = c("Low","Mid","High")))-> clust_index
expand.grid(c(-1,-5,-10),
c("AIC", "BIC"),
c("2020-04-13", "2020-06-22")) %>%
setNames(c("optim_lag",
"criterion",
"max_date")) %>%
mutate(max_date = lubridate::ymd(max_date))-> test_grid
eff_size %>%
filter(scen != "Mid") %>%
group_by(scen, var) %>%
# tally() %>% View()
group_split() %>%
map(right_join,
test_grid,
by = c("optim_lag",
"criterion",
"max_date")) %>%
map(mutate,
var = zoo::na.locf(var),
scen = zoo::na.locf(scen),
UL = estimate + 1.96*std.error,
LL = estimate - 1.96*std.error,
UL_sign = UL/abs(UL),
LL_sign = LL/abs(LL),
stat = case_when(UL > 0 & LL > 0 ~ "pos",
UL < 0 & LL < 0 ~ "neg",
TRUE ~ "null")) %>%
map(filter,
stat %in% c("pos", "null")) %>%
map(dplyr::select, var, scen, optim_lag, criterion, max_date, stat)
dplyr::select(criterion, stat) %>%
filter(stat %in% c("pos", "null"))