Closed RightHandOfDoom closed 5 months ago
Hey @RightHandOfDoom
Thanks for the message! No, unfortunately, there isn't! The point here is that the IRFs bsvars is providing are the Impulse Responses to a structural shock that is contemporaneously uncorrelated. These are not the Generalised impulse responses based on the Reduced Form model.
But, your setup easily allows including the df[,4]
amongst the endogenous variables df <- as.matrix(df[,1:4])
and getting IRFs from the fourth shock as the IRFs to the (conditionally) independent shock to this variable. Usually, a lower-triangular identification system would work well if you are interested primarily in the last shock. That's bc the last shock would be defined as one that reacts to all variables contemporaneously. So, the IRFs at horizon 0 would not be bounded to 0.
Aha, you'd need to run
plot(ts(apply(irf_res[3,1,,],1,mean)))
for the 1st shock impact on the third variable. That's bc the IRF at 0-horizon is computed by $B^{-1}$. So, the rows are now columns. I must get the vignette out soon! All will be clear from there. Apologies.
Greetings, T
Hello! Thank you very much for the explanation, much appreciated !! Just to make sure:
_apply(irfres[i,j,,],1,mean) calculates the the response of variable i to a shock from variable j?
Sorry for the confusion and thanks again !!
Great! Yes, it does so! Cheers and good luck with your projects! T
Hello! I was very happy to see the latest changes to the package & that it's making great progress!! One question though: is it possible to calculate impulse responses from exogenous variables? Here is my simple workflow:
df<-as.matrix(df[,1:3]) ex<-as.matrix(df[,4]) df%>%specify_bsvar_sv$new(p=6,exogenous=ex)%>%
estimate(S = 100) %>%
estimate(S = 5000) -> post
irf_res<-compute_impulse_responses(post, horizon = 20,standardise = TRUE)
to get e quick & dirty impulse response plot, I usually do: plot(ts(apply(irf_res[1,3,,],1,mean))) (for the 1st variable on the third)
str(irf_res) yields: " 'PosteriorIR' num [1:3, 1:3, 1:21, 1:500]".
Please let me know if there is a way to extract impulse responses to shocks from the exogenous variable (similar to the analogous functionality in the MTS-package for instance).
Thank you very much !!