-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults.Rmd
185 lines (167 loc) · 4.9 KB
/
results.Rmd
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
```{r}
results %>%
select(w,gamma,r,N,y,k,abs_gold) %>%
names() %>%
paste('scale(abs_p)~',.)%>%
map_df(~tidy(lm(as.formula(.x),
data= results %>% select(-gamma_l) %>% mutate_all(scale)
))) %>%
filter(!term %>% str_detect("Intercept")) %>%
arrange(p.value) %>% select(term, estimate) %>%
mutate_if(is.numeric,round,3) %>%
left_join(
results %>%
select(w,gamma,r,N,y,k,abs_gold) %>%
names() %>%
paste('scale(abs_yu)~',.)%>%
map_df(~tidy(lm(as.formula(.x),
data= results %>% select(-gamma_l) %>% mutate_all(scale)
))) %>%
filter(!term %>% str_detect("Intercept")) %>%
arrange(p.value) %>% select(term, estimate) %>%
mutate_if(is.numeric,round,3), by = "term"
) %>%
left_join(
results %>%
select(w,gamma,r,N,k,y,abs_gold) %>%
names() %>%
paste('scale(abs_hp)~',.)%>%
map_df(~tidy(lm(as.formula(.x),
data= results %>% select(-gamma_l) %>% mutate_all(scale)
))) %>%
filter(!term %>% str_detect("Intercept")) %>%
arrange(p.value) %>% select(term, estimate) %>%
mutate_if(is.numeric,round,3), by = "term"
) %>%
left_join(
results %>%
select(w,gamma,r,N,y,k,abs_gold) %>%
names() %>%
paste('scale(abs_hyu)~',.)%>%
map_df(~tidy(lm(as.formula(.x),
data= results %>% select(-gamma_l) %>% mutate_all(scale)
))) %>%
filter(!term %>% str_detect("Intercept")) %>%
arrange(p.value) %>% select(term, estimate) %>%
mutate_if(is.numeric,round,3), by = "term"
)
```
```{r}
lm(data = results,
scale(delta_p) ~ scale(n_p - n_gold) + scale(gamma) + scale(r)) %>% tidy() %>% select(-p.value,statistic) %>%
mutate_if(is.numeric,round,3)
```
```{r}
results %>% summarise(
delta_p = mean(delta_p)*100,
delta_yu = mean(delta_yu)*100,
delta_hp = mean(delta_hp)*100,
delta_hyu = mean(delta_hyu)*100
) %>% add_column(gamma_l = NA, .before = "delta_p") %>%
add_row(
results %>% group_by(gamma_l) %>%
summarise(
delta_p = mean(delta_p)*100,
delta_yu = mean(delta_yu)*100,
delta_hp = mean(delta_hp)*100,
delta_hyu = mean(delta_hyu)*100
)) %>%
mutate_if(is.numeric,round,3)
```
```{r}
results %>%
select(phi_y,phi_k,Q) %>%
names() %>%
paste0("scale(",.,")~gamma")%>%
map_df(~tidy(lm(as.formula(.x),
data= results %>% select(-gamma_l) %>% mutate_all(scale)
))) %>%
filter(!term %>% str_detect("Intercept")) %>%
arrange(p.value) %>% select(-statistic) %>%
mutate_if(is.numeric,round,3)
```
```{r}
results %>% summarise(
cor1 = cor(phi_y,phi_k),
cor2 = cor(Q,phi_k),
cor3 = cor(Q,phi_y)
)
```
```{r}
results %>%
mutate(I_p = abs_gold/y - abs_p/y,
I_hp = abs_gold/y - abs_hp/y,
I_hp2 = abs_0/y - abs_hp/y,
I_yu = abs_gold/y - abs_yu/y,
I_hyu = abs_gold/y - abs_hyu/y,
I_hyu2 = abs_0/y - abs_hyu/y) %>%
group_by(gamma_l) %>%
summarise("Scenario I" = mean(I_p)*100,
"Scenario II" = mean(I_hp2)*100,
"Scenario III" = mean(I_yu)*100,
"Scenario IV" = mean(I_hyu2)*100) %>%
mutate_if(is.numeric,round,3) %>%
data.table::transpose(make.names = 'gamma_l', keep.names = 'gamma_l') %>%
as.tibble()
```
```{r}
results %>%
mutate(I_p = abs_gold/y - abs_p/y,
I_hp = abs_gold/y - abs_hp/y,
I_hp2 = abs_0/y - abs_hp/y,
I_yu = abs_gold/y - abs_yu/y,
I_hyu = abs_gold/y - abs_hyu/y,
I_hyu2 = abs_0/y - abs_hyu/y) %>%
group_by(gamma_l) %>%
summarise("I" = sum(abs_gold > abs_p)/n(),
"II" = sum(abs_gold > abs_yu)/n(),
"III" = sum(abs_0 > abs_hp)/n(),
"IV" = sum(abs_0 > abs_hyu)/n()) %>%
mutate_if(is.numeric,round,2)
```
```{r}
results %>%
summarise(I = 1 - (var(err_p)/var(err_gold)),
II = 1 - (var(err_yu)/var(err_gold)),
III = 1 - (var(err_hp)/var(err_0)),
IV = 1 - (var(err_hyu)/var(err_0))
) %>%
add_row(results %>%
summarise(I = mean(err_p),
II = mean(err_yu),
III = mean(err_hp),
IV = mean(err_hyu))
) %>%
mutate_if(is.numeric,round,2)
results %>%
summarise(I = mean(ub_p),
II = mean(ub_yu),
III = mean(ub_hp),
IV = mean(ub_hyu)
) %>%
mutate_if(is.numeric,round,2)
```
```{r}
results %>% summarise(
I = mean(delta_ubp)*100,
II = mean(delta_ubyu)*100,
III = mean(delta_ubhp)*100,
IV = mean(delta_ubhyu)*100
) %>% add_column(gamma_l = NA, .before = "I") %>%
add_row(
results %>% group_by(gamma_l) %>%
summarise(
I = mean(delta_ubp)*100,
II = mean(delta_ubyu)*100,
III = mean(delta_ubhp)*100,
IV = mean(delta_ubhyu)*100
)) %>%
mutate_if(is.numeric,round,3)
results %>%
group_by(gamma_l) %>%
summarise("I" = sum(abs_gold > abs(ub_p))/n(),
"II" = sum(abs_gold > abs(ub_yu))/n(),
"III" = sum(abs_0 > abs(ub_hp))/n(),
"IV" = sum(abs_0 > abs(ub_hyu))/n()) %>%
mutate_if(is.numeric,round,2)
```