-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b98ae6c
commit 5a05972
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
data(ilo_cubic_panel) | ||
|
||
# for bsvar | ||
set.seed(1) | ||
suppressMessages( | ||
specification_no1 <- specify_bvarPANEL$new(ilo_cubic_panel) | ||
) | ||
run_no1 <- estimate(specification_no1, 3, 1, show_progress = FALSE) | ||
ff <- forecast(run_no1, horizon = 2) | ||
|
||
set.seed(1) | ||
suppressMessages( | ||
ff2 <- ilo_cubic_panel |> | ||
specify_bvarPANEL$new() |> | ||
estimate(S = 3, thin = 1, show_progress = FALSE) |> | ||
forecast(horizon = 2) | ||
) | ||
|
||
|
||
expect_identical( | ||
ff$forecasts[1,1,1,1], ff2$forecasts[1,1,1,1], | ||
info = "forecast: forecast identical for normal and pipe workflow." | ||
) | ||
|
||
expect_true( | ||
is.numeric(ff$forecasts) & is.array(ff$forecasts), | ||
info = "forecast: returns numeric array." | ||
) | ||
|
||
|
||
expect_error( | ||
specify_bvarPANEL$new(ilo_cubic_panel) |> forecast(horizon = 3), | ||
info = "forecast: wrong input provided." | ||
) | ||
|
||
expect_error( | ||
forecast(run_no1, horizon = 1.5), | ||
info = "forecast: specify horizon as integer." | ||
) |