1

I have the following xts dataset in R, which I'm using to build an SVAR model.

data <- structure(c(1.54054238132604, 5.22775636647117, 1.75154671443607, 
-4.00396437623925, -4.99849595390862, -3.58991362838901, -2.08646214793927, 
4.38408682550573, -1.32609419137286, -10.0477865139619, -10.5789067079456, 
3.53586648125426, 3.80285045230506, 4.54214390385599, 5.25998848716807, 
4.53265591355598, 4.18968593558051, 3.53167443997122, 2.68286514861102, 
2.28625948262682, 1.9539414753903, 2.30401026783675), .Dim = c(11L, 
2L), .Dimnames = list(NULL, c("GDP", "CPI")), index = structure(c(1514764800, 
1522540800, 1530403200, 1538352000, 1546300800, 1554076800, 1561939200, 
1569888000, 1577836800, 1585699200, 1593561600), tzone = "UTC", tclass = "Date"), class = c("xts", 
"zoo"))

Here is the code for my model.

library(vars)

var.model <- vars::VAR(data, p=1, type = 'cons')
svar.model <- vars::BQ(var.model)

I'm looking to replicate this example by running a historical decomposition on my SVAR model. The function in this example is for a VAR model and I'm looking for advice on how to amend this function for it to work on my SVAR model. Any ideas?

Tanga94
  • 695
  • 6
  • 27
  • 2
    You might want to explore how `svars` functions are implemented in source code to get ideas for what you want to accomplish. See https://stackoverflow.com/a/19226817 for tips on looking under-the-hood. – SEAnalyst Jan 28 '21 at 01:00
  • 1
    Thanks @SEAnalyst, I'm looking at the source code now and a bit unsure on how to apply it to my example. So I'll edit my post with the source code in case anyone has an idea on how to approach it – Tanga94 Jan 28 '21 at 01:21
  • 1
    This might be useful :https://rdrr.io/cran/svars/man/hd.html – Waldi Jan 31 '21 at 16:03
  • 1
    Thanks @Waldi , I know about this function however it only works on SVAR objects from the ```svars``` package and not the ```vars``` one, so I'm trying to figure out a way to do it manually in my case – Tanga94 Jan 31 '21 at 18:07
  • 1
    @Tanga94 have you tried reading https://cran.r-project.org/web/packages/svars/vignettes/svars.pdf ? On page 14 there is a table describing how the creators structured the process to identify shocks/breaks there; – Diego Queiroz Feb 02 '21 at 12:34
  • Thanks @DiegoQueiroz, realised it might be a simpler solution to just run this in EViews and export the results to R – Tanga94 Feb 03 '21 at 00:14

0 Answers0