Skip to content

Commit

Permalink
quick updates
Browse files Browse the repository at this point in the history
  • Loading branch information
donotdespair committed Aug 1, 2024
1 parent 31f501a commit 7b0e82e
Showing 5 changed files with 38 additions and 47 deletions.
30 changes: 13 additions & 17 deletions index-speaker.html
Original file line number Diff line number Diff line change
@@ -498,13 +498,13 @@ <h3 id="workflow-with-the-pipe">- workflow with the pipe</h3>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">estimate</span>(<span class="at">S =</span> <span class="dv">1000</span>) <span class="sc">|&gt;</span> </span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">estimate</span>(<span class="at">S =</span> <span class="dv">10000</span>) <span class="ot">-&gt;</span> post</span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_impulse_responses</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_variance_decompositions</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_historical_decompositions</span>() <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_structural_shocks</span>() <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_conditional_sd</span>() <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">forecast</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">verify_identification</span>() <span class="ot">-&gt;</span> <span class="fu">summary</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_impulse_responses</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_variance_decompositions</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_historical_decompositions</span>() <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_structural_shocks</span>() <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_conditional_sd</span>() <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">forecast</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">verify_identification</span>() <span class="sc">|&gt;</span> <span class="fu">summary</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="bsvars-package-features-7" class="slide level2">
@@ -1087,24 +1087,20 @@ <h3 id="svar-t-structural-shocks.">SVAR-t: Structural shocks.</h3>
<section id="bsvars-modeling-of-monetary-policy-17" class="slide level2">
<h2><a href="https://cran.r-project.org/package=bsvars" style="color:#FFD800;">bsvars</a> modeling of monetary policy</h2>
<h3 id="svar-t-normality-verification.">SVAR-t: Normality verification.</h3>
<div class="cell" data-layout-align="center" data-hash="index_cache/revealjs/bs01vv_f9551744403b20bf19e33845792c6e36">
<div class="sourceCode cell-code" id="cb27"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">verify_identification</span>() <span class="sc">|&gt;</span> <span class="fu">summary</span>( )</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell" data-layout-align="center" data-hash="index_cache/revealjs/bs01vv_7f93482a4b3f89eadffd37d82861eee2">
<div class="sourceCode cell-code" id="cb27"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">verify_identification</span>() <span class="sc">|&gt;</span> <span class="fu">summary</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code> **************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
Summary of identification verification |
H0: omega_n = 0 [homoskedasticity] |
H1: omega_n != 0 [heteroskedasticity] |
H0: df = Inf [normal shocks] |
H1: df != Inf [Student-t shocks] |
**************************************************|</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code> log(SDDR) NSE Pr[H0|data] Pr[H1|data]
shock 1 -139.2066904 56.2061755 3.493836e-61 1.0000000
shock 2 -77.3357623 60.4382345 2.591225e-34 1.0000000
shock 3 -20.9783035 20.5683812 7.748873e-10 1.0000000
shock 4 -0.2606003 0.5270637 4.352162e-01 0.5647838
shock 5 -2.5190196 1.9091024 7.453555e-02 0.9254645</code></pre>
<pre><code> log(SDDR) SDDR Pr[H0|data] Pr[H1|data]
-Inf 0 0 1</code></pre>
</div>
</div>
</section>
30 changes: 13 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
@@ -498,13 +498,13 @@ <h3 id="workflow-with-the-pipe">- workflow with the pipe</h3>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">estimate</span>(<span class="at">S =</span> <span class="dv">1000</span>) <span class="sc">|&gt;</span> </span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">estimate</span>(<span class="at">S =</span> <span class="dv">10000</span>) <span class="ot">-&gt;</span> post</span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_impulse_responses</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_variance_decompositions</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_historical_decompositions</span>() <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_structural_shocks</span>() <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_conditional_sd</span>() <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">forecast</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="ot">-&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">verify_identification</span>() <span class="ot">-&gt;</span> <span class="fu">summary</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_impulse_responses</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_variance_decompositions</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_historical_decompositions</span>() <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_structural_shocks</span>() <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">compute_conditional_sd</span>() <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">forecast</span>(<span class="at">horizon =</span> <span class="dv">12</span>) <span class="sc">|&gt;</span> <span class="fu">plot</span>()</span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">verify_identification</span>() <span class="sc">|&gt;</span> <span class="fu">summary</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="bsvars-package-features-7" class="slide level2">
@@ -1087,24 +1087,20 @@ <h3 id="svar-t-structural-shocks.">SVAR-t: Structural shocks.</h3>
<section id="bsvars-modeling-of-monetary-policy-17" class="slide level2">
<h2><a href="https://cran.r-project.org/package=bsvars" style="color:#FFD800;">bsvars</a> modeling of monetary policy</h2>
<h3 id="svar-t-normality-verification.">SVAR-t: Normality verification.</h3>
<div class="cell" data-layout-align="center" data-hash="index_cache/revealjs/bs01vv_f9551744403b20bf19e33845792c6e36">
<div class="sourceCode cell-code" id="cb27"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">verify_identification</span>() <span class="sc">|&gt;</span> <span class="fu">summary</span>( )</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell" data-layout-align="center" data-hash="index_cache/revealjs/bs01vv_7f93482a4b3f89eadffd37d82861eee2">
<div class="sourceCode cell-code" id="cb27"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>post <span class="sc">|&gt;</span> <span class="fu">verify_identification</span>() <span class="sc">|&gt;</span> <span class="fu">summary</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code> **************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
Summary of identification verification |
H0: omega_n = 0 [homoskedasticity] |
H1: omega_n != 0 [heteroskedasticity] |
H0: df = Inf [normal shocks] |
H1: df != Inf [Student-t shocks] |
**************************************************|</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code> log(SDDR) NSE Pr[H0|data] Pr[H1|data]
shock 1 -139.2066904 56.2061755 3.493836e-61 1.0000000
shock 2 -77.3357623 60.4382345 2.591225e-34 1.0000000
shock 3 -20.9783035 20.5683812 7.748873e-10 1.0000000
shock 4 -0.2606003 0.5270637 4.352162e-01 0.5647838
shock 5 -2.5190196 1.9091024 7.453555e-02 0.9254645</code></pre>
<pre><code> log(SDDR) SDDR Pr[H0|data] Pr[H1|data]
-Inf 0 0 1</code></pre>
</div>
</div>
</section>
19 changes: 9 additions & 10 deletions index.qmd
Original file line number Diff line number Diff line change
@@ -200,13 +200,13 @@ us_fiscal_lsuw |>
estimate(S = 1000) |>
estimate(S = 10000) -> post
post |> compute_impulse_responses(horizon = 12) -> plot()
post |> compute_variance_decompositions(horizon = 12) -> plot()
post |> compute_historical_decompositions() -> plot()
post |> compute_structural_shocks() -> plot()
post |> compute_conditional_sd() -> plot()
post |> forecast(horizon = 12) -> plot()
post |> verify_identification() -> summary()
post |> compute_impulse_responses(horizon = 12) |> plot()
post |> compute_variance_decompositions(horizon = 12) |> plot()
post |> compute_historical_decompositions() |> plot()
post |> compute_structural_shocks() |> plot()
post |> compute_conditional_sd() |> plot()
post |> forecast(horizon = 12) |> plot()
post |> verify_identification() |> summary()
```


@@ -1016,8 +1016,7 @@ post = estimate(burn, 1e4)
```{r load01}
#| echo: false
#| cache: true
load("empiRical/bsvars06.rda")
load("empiRical/bsvars06.rda" )
```

## [bsvars](https://cran.r-project.org/package=bsvars){style="color:#FFD800;"} modeling of monetary policy
@@ -1066,7 +1065,7 @@ post |> compute_structural_shocks() |> plot(col = "#0056B9" )
#| cache: true
#| fig-align: center
#| fig-width: 8
post |> verify_identification() |> summary( )
post |> verify_identification() |> summary()
```


4 changes: 2 additions & 2 deletions w4UKR_bsvars.R
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ data(us_fiscal_lsuw) # upload dependent variables

set.seed(123)
us_fiscal_lsuw |>
specify_bsvar$new(p = 4) |>
specify_bsvar_t$new(p = 4) |>
estimate(S = 1000) |>
estimate(S = 2000) -> post

@@ -22,7 +22,7 @@ h = 4
cf = cbind(rep(NA, h),tail(us_fiscal_lsuw[,2], 1) + mean(diff(us_fiscal_lsuw[,2])) * 1:h,rep(NA, h))
post |>
forecast(horizon = h) |>
plot(data_in_plot = 0.2)
plot(data_in_plot = 0.1)
post |>
forecast(horizon = h, conditional_forecast = cf) |>
plot(data_in_plot = 0.2)
2 changes: 1 addition & 1 deletion w4UKR_bsvars_Granger.R
Original file line number Diff line number Diff line change
@@ -15,5 +15,5 @@ post$last_draw$starting_values$A # study the structure of the A matrix

# verify no Granger causality from ttr to gdp
H0 = matrix(NA, 3, 4)
H0[,] = 0 # modify this line to set appropriate restriction
H0[3,1] = 0 # modify this line to set appropriate restriction
post |> verify_autoregression(hypothesis = H0) |> summary()

0 comments on commit 7b0e82e

Please sign in to comment.