-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GIRF: add regime-specific option #45
Comments
Hi Matthieu, As I wrote https://groups.google.com/g/tsdyn/c/NTwuPN2g4AE for the regime-specific GIRF one would refer to the Baum and Koester, 2011 algorithm. In the algorithm, I think the shock epslion0 refers to the shock of the current period. So I think it would be important to extend the function TVAR.sim for the external threshold, as it is a part of the calculation of the GIRF Thank you, |
I believe you have most, if not all, elements in the output of Now this is about regime-specific GIRF. Indeed, you will not be able to use it directly with To do:
Example of useful plots: library(tsDyn)
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
library(tidyverse, warn.conflicts = FALSE)
set <- setar.sim(B = c(0.5, 0.2, 0.5, 0.5), lag = 1, Thresh = 0.5, n = 500)
set_estim <- setar(set, m = 1)
## GIRF
girf_out <- GIRF(set_estim, n.hist = 10, n.shock = 10,
n.ahead = 10, R=10) %>%
as_tibble()
nrow(girf_out)
#> [1] 1100
girf_out %>%
count(hist_x1_l1, shock_var1)
#> # A tibble: 100 × 3
#> hist_x1_l1 shock_var1 n
#> <dbl> <dbl> <int>
#> 1 -1.21 -1.58 11
#> 2 -1.21 -1.10 11
#> 3 -1.21 -1.08 11
#> 4 -1.21 -0.925 11
#> 5 -1.21 -0.689 11
#> 6 -1.21 -0.477 11
#> 7 -1.21 -0.363 11
#> 8 -1.21 -0.254 11
#> 9 -1.21 0.283 11
#> 10 -1.21 0.747 11
#> # … with 90 more rows
#> # ℹ Use `print(n = ...)` to see more rows
girf_out %>%
mutate(group = paste(hist_x1_l1, shock_var1)) %>%
ggplot(aes(x= n.ahead, y=girf, group=group)) +
geom_line(alpha=0.6)+
ggtitle("All GIRF") girf_out %>%
slice_max(hist_x1_l1, n=1) %>%
ggplot(aes(x= n.ahead, y=girf, color=factor(shock_var1))) +
geom_line(alpha=0.6)+
ggtitle("All GIRF for same history") girf_out %>%
slice_max(shock_var1, n=1) %>%
ggplot(aes(x= n.ahead, y=girf, color=factor(hist_x1_l1))) +
geom_line(alpha=0.6)+
ggtitle("All GIRF for same shock") Created on 2022-10-16 by the reprex package (v2.0.1) |
Many users have been inquiring about a regime-specific GIRF plot. I believe the function GIRF contains all the output to do so, but it seems to be complex enough to deter users from using the raw output.
First step is to find the definition of the regime-specific GIRF. I guess one needs to define first a "regime-specific trajectory". Is that a trajectory whose:
Then, is the regime-specific GIRF history/shock-trajectory dependent? Or can be aggregated over the trajectories? Over shocks or histories?
To do:
The text was updated successfully, but these errors were encountered: