-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_estimate_bsvar_sv.R
56 lines (45 loc) · 1.58 KB
/
test_estimate_bsvar_sv.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
data(us_fiscal_lsuw)
set.seed(1)
suppressMessages(
specification_no1 <- specify_bsvar_sv$new(us_fiscal_lsuw)
)
run_no1 <- estimate(specification_no1, 3, 1, show_progress = FALSE)
set.seed(1)
suppressMessages(
specification_no2 <- specify_bsvar_sv$new(us_fiscal_lsuw)
)
run_no2 <- estimate(specification_no2, 3, 1, show_progress = FALSE)
set.seed(1)
run_no3 <- us_fiscal_lsuw |>
specify_bsvar_sv$new() |>
estimate(S = 3, thin = 1, show_progress = FALSE)
expect_identical(
run_no1$last_draw$starting_values$B[1,1],
run_no2$last_draw$starting_values$B[1,1],
info = "estimate_bsvar_sv: the last_draw(s) of two runs to be identical."
)
expect_identical(
run_no1$posterior$B[1,1,1],
run_no2$posterior$B[1,1,1],
info = "estimate_bsvar_sv: the first draws of two runs to be identical."
)
expect_identical(
run_no1$last_draw$starting_values$B[1,1],
run_no3$last_draw$starting_values$B[1,1],
info = "estimate_bsvar_sv: the last_draw(s) of a normal and pipe run to be identical."
)
set.seed(1)
suppressMessages(
specification_no1 <- specify_bsvar_sv$new(us_fiscal_lsuw, centred_sv = TRUE)
)
run_no1 <- estimate(specification_no1, 3, 1, show_progress = FALSE)
set.seed(1)
suppressMessages(
specification_no2 <- specify_bsvar_sv$new(us_fiscal_lsuw, centred_sv = TRUE)
)
run_no2 <- estimate(specification_no2, 3, 1, show_progress = FALSE)
expect_identical(
run_no1$last_draw$starting_values$B[1,1],
run_no2$last_draw$starting_values$B[1,1],
info = "estimate_bsvar_sv centred: the last_draw(s) of two runs to be identical."
)