Skip to content

Commit

Permalink
v1
Browse files Browse the repository at this point in the history
  • Loading branch information
donotdespair committed Dec 18, 2024
1 parent 89906fd commit bae55c3
Show file tree
Hide file tree
Showing 23 changed files with 3,321 additions and 168 deletions.
File renamed without changes.
Binary file added bsvarSIGNs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bsvarSIGNs_cran.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bsvarSIGNs_progress.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bsvars.org.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bsvars_cran.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions bsvars_oz.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@

library(bsvars)
set.seed(123)



# Download data using the readrba package
############################################################

# Gross domestic product (GDP); Chain volume
rgdp_dwnld = readrba::read_rba(series_id = "GGDPCVGDP")
rgdp_tmp = xts::xts(rgdp_dwnld$value, rgdp_dwnld$date, tclass = 'yearqtr')
drgdp = na.omit(400 * diff(log(rgdp_tmp)))
drgdp = xts::to.quarterly(drgdp, OHLC = FALSE)

# Consumer price index; All groups; Quarterly change (in per cent)
picpi_dwnld = readrba::read_rba(series_id = "GCPIAGSAQP")
pi = 4 * xts::xts(picpi_dwnld$value, picpi_dwnld$date, tclass = 'yearqtr')
pi = xts::to.quarterly(pi, OHLC = FALSE)

# Interbank Overnight Cash Rate
cr_dwnld = readrba::read_rba(series_id = "FIRMMCRID") # Cash Rate Target
cr_tmp = xts::xts(cr_dwnld$value, cr_dwnld$date)
cr = xts::to.quarterly(cr_tmp, OHLC = FALSE)

# Real Trade-Weighted Index
rtwi_dwnld = readrba::read_rba(series_id = "FRERTWI")
rtwi_tmp = xts::xts(rtwi_dwnld$value, rtwi_dwnld$date, tclass = 'yearqtr')
rtwi = 100 * na.omit(diff(log(rtwi_tmp)))
drtwi = xts::to.quarterly(rtwi, OHLC = FALSE)

y = na.omit(merge(drgdp, pi, cr, drtwi))
plot(y, main = "Australian monetary system",
legend.loc = "bottomleft", col = c("#FF00FF","#990099","#77001b","#330033"))




# Estimation setup
############################################################
N = ncol(y)
p = 4
S_burn = 1e3
S = 5e3


# estimation - lower-triangular model
############################################################
# specify a model
spec = specify_bsvar$new(
as.matrix(y),
p = p,
stationary = rep(TRUE, N)
)

# estimate a model
spec |>
estimate(S = S_burn) |>
estimate(S = S) -> post

# compute and plot impulse responses
post |>
compute_impulse_responses(horizon = 20) |>
plot()

# compute and plot forecast error variance decompositions
post |>
compute_variance_decompositions(horizon = 20) |>
plot()

# compute and plot structural shocks
post |>
compute_structural_shocks() |>
plot()

# compute and plot fitted values
post |>
compute_fitted_values() |>
plot()

# compute and plot forecasts
post |>
forecast(horizon = 8, data_in_plot = 0.3) |>
plot()

Binary file added bsvars_progress.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,035 changes: 976 additions & 59 deletions index-speaker.html

Large diffs are not rendered by default.

1,035 changes: 976 additions & 59 deletions index.html

Large diffs are not rendered by default.

Loading

0 comments on commit bae55c3

Please sign in to comment.