-
Notifications
You must be signed in to change notification settings - Fork 4
/
.Rhistory
512 lines (512 loc) · 21.9 KB
/
.Rhistory
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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
sol_iv <- iv(problem, w, Z, prior_table = 10, M = 1000)
summary(sol_iv)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
summary(sol_iv)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
?iv
?summary.iv
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
2+seq_len(10)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
?conditionTable
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
2^1000
2^20
problem <- simulateWitnessModel(p = 4, q = 4, par_max = 3, M = 1000)
covariate_hat <- covsearch(problem, cred_calc = TRUE, M = 1000)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
devtools::load_all(".")
covariate_hat <- covsearch(problem, cred_calc = TRUE, M = 1000)
names(covariate_hat)
names(covariate_hat$witness)
covariate_hat$witness
sol_ACE <- bindagCausalEffectBackdoor(problem, prior_table = 10, S = covariate_hat$Z[[1]])
sol_ACE
cat(sprintf("Estimated ACE = %1.2f\n", sol_ACE))
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
sol_pop <- covsearch(problem, pop_solve = TRUE)
ffect_pop <- bindagCausalEffect(problem)
effect_pop <- bindagCausalEffect(problem)
effect_pop
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
bindagCausalEffectBackdoor(problem, prior_table = 10, S = covariate_hat$Z[[1]])
fifi <- bindagCausalEffectBackdoor(problem, prior_table = 10, S = covariate_hat$Z[[1]])
fifi
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/util.R')
devtools::load_all(".")
cfx
devtools::load_all(".")
library(rje)
library(graph)
library(igraph)
library(rscdd)
library(rcdd)
epsilons <- c(0.2, 0.2, 0.2, 0.2, 0.9, 1.1)
p <- 4
q <- 4
par_max <- 3
sample_size <- 1000
num_monte_carlo <- 1000
hardness_factor <- 0.10
N <- 1000; i <- 1
while (TRUE) {
problem <- simulateWitnessModel(p, q, par_max, sample_size)
effects <- synthetizeCausalEffect(problem)
out <- effects[[1]] - effects[[2]]
if (abs(out) > hardness_factor) break()
printPercentage(i, N)
i <- i + 1
}
sol_pop <- covariateSearch(problem, pop_solve = TRUE)
effect_pop <- synthetizeCausalEffect(problem)
cat(sprintf("ACE (true) = %1.2f\nACE (adjusting for all) = %1.2f\nACE (adjusting for nothing) = %1.2f\n",
effect_pop$effect_real, effect_pop$effect_naive, effect_pop$effect_naive2))
sol_pop <- covsearch(problem, pop_solve = TRUE)
effect_pop <- synthetizeCausalEffect(problem)
cat(sprintf("ACE (true) = %1.2f\nACE (adjusting for all) = %1.2f\nACE (adjusting for nothing) = %1.2f\n",
effect_pop$effect_real, effect_pop$effect_naive, effect_pop$effect_naive2))
covariate_hat <- covsearch(problem, cred_calc = TRUE, M = 1000)
summary(covariate_hat)
sol_iv <- iv(problem, covariate_hat$hw, covariate_hat$hZ, prior_table = 10, M = 1000)
summary(sol_iv)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
problem
class(problem)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
summary(wpp_sol)
summary(wpp_sol)
object$bounds
object$varnames[[object$witness[i]]]
object$varnams
object$varnames
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
summary(wpp_sol)
object$varnames
summary(wpp_sol)
object$varnames
object$problem$varnames
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
summary(wpp_sol)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
summary(wpp_sol)
summary(wpp_sol)
?CausalFX
?CausalFX
summary(wpp_sol)
?CausalFX
?iv
?covsearch
?wpp
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = TRUE)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = TRUE)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = TRUE)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
i
j
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
devtools::load_all(".")
library(igraph)
library(rje)
library(rcdd)
epsilons <- c(0.2, 0.2, 0.2, 0.2, 0.9, 1.1)
p <- 4
q <- 4
par_max <- 3
sample_size <- 1000
num_monte_carlo <- 1000
hardness_factor <- 0.10
N <- 1000; i <- 1
while (TRUE) {
problem <- simulateWitnessModel(p, q, par_max, sample_size)
effects <- synthetizeCausalEffect(problem)
out <- effects[[1]] - effects[[2]]
if (abs(out) > hardness_factor) break()
printPercentage(i, N)
i <- i + 1
}
# Test covariate search only
sol_pop <- covsearch(problem, pop_solve = TRUE)
effect_pop <- synthetizeCausalEffect(problem)
cat(sprintf("ACE (true) = %1.2f\nACE (adjusting for all) = %1.2f\nACE (adjusting for nothing) = %1.2f\n",
effect_pop$effect_real, effect_pop$effect_naive, effect_pop$effect_naive2))
covariate_hat <- covsearch(problem, cred_calc = TRUE, M = 1000)
summary(covariate_hat)
sol_iv <- iv(problem, covariate_hat$hw, covariate_hat$hZ, prior_table = 10, M = 1000)
summary(sol_iv)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
epsilons <- c(0.2, 0.2, 0.2, 0.2, 0.9, 1.1)
p <- 4
q <- 4
par_max <- 3
sample_size <- 1000
num_monte_carlo <- 1000
hardness_factor <- 0.10
N <- 1000; i <- 1
while (TRUE) {
problem <- simulateWitnessModel(p, q, par_max, sample_size)
effects <- synthetizeCausalEffect(problem)
out <- effects[[1]] - effects[[2]]
if (abs(out) > hardness_factor) break()
printPercentage(i, N)
i <- i + 1
}
# Test covariate search only
sol_pop <- covsearch(problem, pop_solve = TRUE)
effect_pop <- synthetizeCausalEffect(problem)
cat(sprintf("ACE (true) = %1.2f\nACE (adjusting for all) = %1.2f\nACE (adjusting for nothing) = %1.2f\n",
effect_pop$effect_real, effect_pop$effect_naive, effect_pop$effect_naive2))
covariate_hat <- covsearch(problem, cred_calc = TRUE, M = 1000)
summary(covariate_hat)
# Test IV analysis using result from covariate search
sol_iv <- iv(problem, covariate_hat$hw, covariate_hat$hZ, prior_table = 10, M = 1000)
sol_iv <- iv(problem, covariate_hat$hw, covariate_hat$hZ, prior_table = 10, M = 1000)
sol_iv
sol_iv <- iv(problem, covariate_hat$hw, covariate_hat$hZ, prior_table = 10, M = 1000)
covariate_hat$hw
covariate_hat$hw
sol_iv <- iv(problem, covariate_hat$hw, covariate_hat$hZ, prior_table = 10, M = 1000)
covariate_hat$hw
covariate_hat$hZ
sol_iv <- iv(problem, covariate_hat$hw, covariate_hat$hZ, prior_table = 10, M = 1000, verbose = TRUE)
sol_iv <- iv(problem, covariate_hat$hw, covariate_hat$hZ, prior_table = 10, M = 1000, verbose = TRUE)
devtools::load_all(".")
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
sol_iv <- iv(problem, covariate_hat$hw, covariate_hat$hZ, prior_table = 10, M = 1000, verbose = TRUE)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
problem <- simulateWitnessModel(p, q, par_max, sample_size)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
problem <- simulateWitnessModel(p, q, par_max, sample_size)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
problem <- simulateWitnessModel(p, q, par_max, sample_size)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
problem <- simulateWitnessModel(p, q, par_max, sample_size)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = TRUE)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = TRUE)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = TRUE)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = TRUE)
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = TRUE)
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = TRUE)
result_max_relax <- lpcdd(H, lpp_params$C, minimize = FALSE)
capture.output(result_max_relax <- lpcdd(H, lpp_params$C, minimize = FALSE))
try(result_max_relax <- lpcdd(H, lpp_params$C, minimize = FALSE), silent = TRUE)
capture.output(try(result_max_relax <- lpcdd(H, lpp_params$C, minimize = FALSE), silent = TRUE))
sink(try(result_max_relax <- lpcdd(H, lpp_params$C, minimize = FALSE), silent = TRUE))
sink(file = NULL)
try(result_max_relax <- lpcdd(H, lpp_params$C, minimize = FALSE), silent = TRUE)
sink()
cat("oi")
sink(file = NULL)
cat("oi")
sink()
?sink
sink(tempfile())
try(result_max_relax <- lpcdd(H, lpp_params$C, minimize = FALSE), silent = TRUE)
sink()
invisible(force(try(result_max_relax <- lpcdd(H, lpp_params$C, minimize = FALSE), silent = TRUE)))
sink(tempfile())
on.exit(sink())
invisible(force(try(result_max_relax <- lpcdd(H, lpp_params$C, minimize = FALSE), silent = TRUE)))
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
debugSource('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
devtools::use_vignette("CausalFX")
install.packages("rmarkdown")
devtools::use_vignette("CausalFX")
devtools::load_all(".")
?CausalFX
?CausalFX
?rje
?CausalFX
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
?CausalFX
ff <- runif(3)
ff[1:3]
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
devtools::load_all(".")
epsilons <- c(0.2, 0.2, 0.2, 0.2, 0.9, 1.1)
p <- 4
q <- 4
par_max <- 3
sample_size <- 1000
num_monte_carlo <- 1000
hardness_factor <- 0.10
N <- 1000; i <- 1
while (TRUE) {
problem <- simulateWitnessModel(p, q, par_max, sample_size)
effects <- synthetizeCausalEffect(problem)
out <- effects[[1]] - effects[[2]]
if (abs(out) > hardness_factor) break()
printPercentage(i, N)
i <- i + 1
}
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
wpp_sol <- wpp(problem, epsilons, M = 1000, prior_ind = 0.5, prior_table = 10, cred_calc = TRUE, analytical_bounds = TRUE, verbose = FALSE)
summary(wpp_sol)
?summary
?print
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
devtools::load_all(".")
?print.summary
devtools::load_all(".")
?summary
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
devtools::load_all(".")
library(igraph)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
?print
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
devtools::load_all(".")
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
devtools::load_all(".")
devtools::run_examples()
devtools::load_all(".")
devtools::load_all(".")
devtools::run_examples()
sol_iv <- iv(problem, w, Z, prior_table = 10, M = 1000)
while (TRUE) {
+ problem <- simulateWitnessModel(p = 4, q = 4, par_max = 3, M = 1000)
+ s <- covsearch(problem, pop_solve = TRUE)
+ if (length(s$witness) > 0) {
+ w <- s$witness[1]
+ Z <- s$Z[[1]]
+ break
+ }
+ }
validateData
sol_iv <- iv(problem, w, Z, prior_table = 10, M = 1000)
devtools::run_examples()
devtools::run_examples()
devtools::run_examples(iv)
devtools::run_examples("iv")
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
devtools::run_examples("iv")
devtools::run_examples(3)
devtools::run_examples(5)
?require
library(CausalFX)
devtools::run_examples()
library(igraph)
library(rje)
library(rcdd)
devtools::run_examples()
devtools::load_all(".")
?covsearch
p2 <- simulateWitnessModel(p = 4, q = 4, par_max = 3, M = 1000)
problem
sol_pop <- covsearch(p2, pop_solve = TRUE)
covariate_hat <- covsearch(p2, cred_calc = TRUE, M = 1000)
summary(p2)
p2
summary.covsearch(p2)
class(p2)
summary.covsearch(covariate_hat)
names(covariate_hat)
traceback()
summary.covsearch(covariate_hat)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/search.R')
summary.covsearch(covariate_hat)
devtools::load_all(".")
devtools::run_examples()
validateDta
validateData
covariate_hat <- covsearch(problem, cred_calc = TRUE, M = 1000)
covariate_hat <- covsearch(p2, cred_calc = TRUE, M = 1000)
devtools::run_examples()
devtools::load_all(".")
devtools::run_examples()
?dev_tools:run_examples
?run_examples
library(CausalFX)
library(CausalFX)
?dev_tools:run_examples
?dev_tools:run_examples()
dev_tools:run_examples()
devtools:run_examples()
library(dev_tools)
library(devtools)
devtools:run_examples()
dev_tools:run_examples()
devtools::run_examples()
library(igraph)
library(rje)
library(rcdd)
devtools::run_examples()
p2 <- simulateWitnessModel(p = 4, q = 4, par_max = 3, M = 1000)
probl
epsilons <- c(0.2, 0.2, 0.2, 0.2, 0.95, 1.05)
sol_wpp <- wpp(problem, epsilons, M = 500)
sol_wpp <- wpp(p2, epsilons, M = 500)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
devtools::run_examples()
library(rje)
library(igraph)
library(rcdd)
devtools::run_examples()
devtools::run_examples()
devtools::run_examples()
devtools::run_examples()
devtools::run_examples()
devtools::run_examples()
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/wpp.R')
devtools::run_examples()
library(CausalFX)
devtools::run_examples()
devtools::run_examples()
devtools::run_examples()
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
return()
return
quantile(NULL, probs = seq(0, 1, 0.25), na.rm = TRUE)
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
devtools::run_examples()
devtools::run_examples()
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
devtools::run_examples()
devtools::load_all(".")
devtools::load_all(".")
devtools::run_examples()
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/iv.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/distrib/CausalFX/R/search.R')
library(CausalFX)
f <- randn(10, 100)
f <- rnorm(10, 100)
f
f <- rnorm(1000)
f <- matrix(f, ncol = 1000)
f
f <- matrix(rnorm(1000), ncol = 100)
f
M <- f * t(f)
dim(f)
t(f)
M <- f %*% t(f)
M
m <- diag(M)
m
M / (t(m) %*% m)
M / (m %*% t(m)
)
M / sqrt(m %*% t(m)
)
M1 <- M / sqrt(m %*% t(m))
M1
inv(M1)
solve(M1)
R <- matrix(c(1, 0.5, 0.5, 1), ncol=2)
R
solve(R)
0.5^2 / (1 - 0.5^2)
R %*% solve(R)
solve(R) - matrix(c(1, 0, 0, 1), ncol=2)
det(solve(R) - matrix(c(1, 0, 0, 1), ncol=2))
68 * 0.4 + 0.4 * 72
68 * 0.6 + 0.4 * 72
0.6 * 85 + 0.4 * 81
0.6 * 85 + 0.4 * 82
source('Z:/docs/ProjectsOfficial/papers/WPP/package/CausalFX/R/search.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/CausalFX/R/search.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/CausalFX/R/search.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/CausalFX/R/search.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/CausalFX/R/search.R')
source('Z:/docs/ProjectsOfficial/papers/WPP/package/CausalFX/R/search.R')
devtools::build()
devtools::load_all(".")
library(ggplot2)
pwd()
setwd()
dir()
app_data <- read.table("../../WPP_final/dat/flu_data_tsr.dat", header = T, row.names = NULL)
app_data
cat("Data loaded, number of variables =", ncol(app_data), "\n")
var_names <- colnames(app_data)
app_data <- as.matrix(app_data)
app_data[which(app_data[, 4] < 60), 4] <- 0 # "Age" is in column 4, we dichotomize it
app_data[which(app_data[, 4] >= 60), 4] <- 1
flu_cfx <- cfx(x = 2, y = 3, dat = app.data)
flu_cfx <- cfx(x = 2, y = 3, dat = app_data)
flu_cfx
var_names
num_monte_carlo <- 5000
epsilons <- c(0.2, 0.2, 0.2, 0.2, 0.9, 1.1)
sol_wpp <- wpp(flu_cfx, epsilons, M = num_monte_carlo, verbose = TRUE)
summary(sol_wpp)
data_alt <- as.numeric(matrix(runif(50000) > 0.5, nrow = 1000))
data_alt
data_alt <- (matrix(runif(50000) > 0.5, nrow = 1000))
data_alt
data_alt <- numeric(matrix(runif(50000) > 0.5, nrow = 1000))
data_alt <- (matrix(runif(50000) > 0.5, nrow = 1000) == TRUE
)
data_alt
dim(data_alt)
as.numeric(TRUE)
as.numeric(data_alt)
data_alt <- matrix(as.numeric(runif(50000) > 0.5), nrow = 1000)
data_alt
problem <- cfx(1, 2, dat = data_alt)
sol_wpp <- wpp(problem, epsilons, M = num_monte_carlo, verbose = TRUE)
summary(sol_wpp)
?CausalFX
?CausalFX
library(CausalFX)
?CausalFX
?wpp
ver()
version()
R.Version()