-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.xml
353 lines (331 loc) · 37.4 KB
/
index.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Luca Brugnolini</title>
<link>https://lucabrugnolini.github.io/</link>
<atom:link href="https://lucabrugnolini.github.io/index.xml" rel="self" type="application/rss+xml" />
<description>Luca Brugnolini</description>
<generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><copyright>© 2017 Luca Brugnolini</copyright><lastBuildDate>Mon, 09 Aug 2021 00:00:00 +0000</lastBuildDate>
<image>
<url>https://lucabrugnolini.github.io/img/icon-192.png</url>
<title>Luca Brugnolini</title>
<link>https://lucabrugnolini.github.io/</link>
</image>
<item>
<title>Euro Area Deflationary Pressure Index</title>
<link>https://lucabrugnolini.github.io/publication/article_9_ea_dpi/</link>
<pubDate>Mon, 09 Aug 2021 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/publication/article_9_ea_dpi/</guid>
<description></description>
</item>
<item>
<title>Is Anything Predictable in Market-Based Surprises?</title>
<link>https://lucabrugnolini.github.io/publication/article_5_macro_surprise/</link>
<pubDate>Thu, 13 Aug 2020 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/publication/article_5_macro_surprise/</guid>
<description></description>
</item>
<item>
<title> MEDSEA-FIN: A DSGE model of the Maltese economy with housing and financial frictions,</title>
<link>https://lucabrugnolini.github.io/publication/article_7_medsea_fin/</link>
<pubDate>Wed, 01 Apr 2020 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/publication/article_7_medsea_fin/</guid>
<description></description>
</item>
<item>
<title>IAAE 2019</title>
<link>https://lucabrugnolini.github.io/talk/iaae2019/</link>
<pubDate>Wed, 26 Jun 2019 09:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/talk/iaae2019/</guid>
<description></description>
</item>
<item>
<title>Measuring Euro Area Monetary Policy</title>
<link>https://lucabrugnolini.github.io/publication/article_1-_-monetary_shock/</link>
<pubDate>Fri, 17 May 2019 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/publication/article_1-_-monetary_shock/</guid>
<description></description>
</item>
<item>
<title>RBNZ Conference on Macro-Finance</title>
<link>https://lucabrugnolini.github.io/talk/rbnz_macrofinance_2018/</link>
<pubDate>Thu, 13 Dec 2018 09:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/talk/rbnz_macrofinance_2018/</guid>
<description></description>
</item>
<item>
<title>Central Bank of Sri Lanka</title>
<link>https://lucabrugnolini.github.io/talk/cbsl_conference_2018/</link>
<pubDate>Fri, 07 Dec 2018 09:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/talk/cbsl_conference_2018/</guid>
<description></description>
</item>
<item>
<title>Central Bank of Malta Annual Research Workshop</title>
<link>https://lucabrugnolini.github.io/talk/cbm_workshop_2018/</link>
<pubDate>Mon, 19 Nov 2018 09:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/talk/cbm_workshop_2018/</guid>
<description></description>
</item>
<item>
<title>Bilkent University</title>
<link>https://lucabrugnolini.github.io/talk/bilkent_2018/</link>
<pubDate>Fri, 09 Nov 2018 09:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/talk/bilkent_2018/</guid>
<description></description>
</item>
<item>
<title>About Local Projection Impulse Response Function Reliability</title>
<link>https://lucabrugnolini.github.io/publication/article_2_about_local_projection/</link>
<pubDate>Wed, 01 Aug 2018 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/publication/article_2_about_local_projection/</guid>
<description></description>
</item>
<item>
<title>IAAE 2018</title>
<link>https://lucabrugnolini.github.io/talk/iaae2018/</link>
<pubDate>Tue, 26 Jun 2018 09:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/talk/iaae2018/</guid>
<description></description>
</item>
<item>
<title>CEF 2018</title>
<link>https://lucabrugnolini.github.io/talk/cef2018/</link>
<pubDate>Tue, 19 Jun 2018 09:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/talk/cef2018/</guid>
<description></description>
</item>
<item>
<title>Fiscal Compact and Debt Consolidation Dynamics</title>
<link>https://lucabrugnolini.github.io/publication/article_4_fiscal_compact/</link>
<pubDate>Fri, 01 Jun 2018 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/publication/article_4_fiscal_compact/</guid>
<description></description>
</item>
<item>
<title>Governor's Workshop</title>
<link>https://lucabrugnolini.github.io/talk/gw/</link>
<pubDate>Thu, 31 May 2018 12:30:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/talk/gw/</guid>
<description></description>
</item>
<item>
<title>CBM Research Seminar</title>
<link>https://lucabrugnolini.github.io/talk/cbm_seminar/</link>
<pubDate>Fri, 27 Apr 2018 14:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/talk/cbm_seminar/</guid>
<description></description>
</item>
<item>
<title>I Vienna Workshop on Economic Forecasting</title>
<link>https://lucabrugnolini.github.io/talk/first_vienna_forecasting/</link>
<pubDate>Fri, 16 Feb 2018 09:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/talk/first_vienna_forecasting/</guid>
<description></description>
</item>
<item>
<title>Julia Packages</title>
<link>https://lucabrugnolini.github.io/code/code/</link>
<pubDate>Thu, 11 Jan 2018 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/code/code/</guid>
<description><ol>
<li>
<p><a href="https://github.com/lucabrugnolini/VectorAutoregressions.jl">VectorAutoregressions.jl:</a>
Vector Autoregressive (VAR) models in Julia.</p>
</li>
<li>
<p><a href="https://github.com/lucabrugnolini/NFP.jl">ForecastingCombinations.jl:</a>
forecasting using a combinatoric approach and exploiting parallel computing in Julia.</p>
</li>
</ol>
</description>
</item>
<item>
<title>Flexible Bayesian Local Projection</title>
<link>https://lucabrugnolini.github.io/publication/article_6_bayesian_cubic_local_projection/</link>
<pubDate>Tue, 02 Jan 2018 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/publication/article_6_bayesian_cubic_local_projection/</guid>
<description></description>
</item>
<item>
<title>Macroprudential Policy for Small-Open Economy in a Monetary Union</title>
<link>https://lucabrugnolini.github.io/publication/article_8_macroprudential_in_soe/</link>
<pubDate>Mon, 01 Jan 2018 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/publication/article_8_macroprudential_in_soe/</guid>
<description></description>
</item>
<item>
<title>ForecastingCombinations.jl</title>
<link>https://lucabrugnolini.github.io/code/nfp/</link>
<pubDate>Tue, 01 Aug 2017 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/code/nfp/</guid>
<description><h4 id="forecasting-variables-using-a-combinatoric-approach-and-exploiting-parallel-computing-in-julia-forecastingcombinationsjlhttpsgithubcomlucabrugnoliniforecastingcombinationsjl">Forecasting Variables using a combinatoric approach and exploiting parallel computing in Julia (<a href="https://github.com/lucabrugnolini/ForecastingCombinations.jl">ForecastingCombinations.jl</a>)</h4>
<h2 id="installation">Installation</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-julia" data-lang="julia"><span style="display:flex;"><span>Pkg<span style="color:#f92672">.</span>clone(<span style="color:#e6db74">&#34;https://github.com/lucabrugnolini/ForecastingCombinations.jl&#34;</span>)
</span></span></code></pre></div><h2 id="documentation">Documentation</h2>
<p>The procedure is described in <a href="https://lucabrugnolini.github.io/publication/forecasting_inflation.pdf">Brugnolini L. (2018)</a>. The application in the paper is on predicting the probability of having inflation around the European Central Bank&rsquo;s target.</p>
<h2 id="introduction">Introduction</h2>
<p>Given a (balanced) dataset of <em>K</em> macroeconomic variables, the objective is to select the best model to predict future values of a target variable. The selection procedure consists in (i) select the best <em>iBest</em> variables according to several out-of-sample criteria and then use these variables in models that use their combination. More specifically:</p>
<ol>
<li>
<p>the procedure selects the best <code>iBest</code> variables using two different criteria (mean absolute error (MAE) and root mean squared error (RMSE) included in the model as a vector <em>fLoss</em> of functions in the form <em>f(Prediction,TrueValue)</em>). This selection step is univariate, i.e. the variables are chosen by running a simple out-of-sample regression of the target variable on each variable of the dataset.</p>
</li>
<li>
<p>the <code>iBest</code> variables are combined into set of <em>2, 3, &hellip;, iBest</em> variables. For each of these sets, the model is estimated and then avaluated out-of-sample. The best model is the one with the lowest out-of-sample <code>MSE</code>. We also augment each model with the first principal component of all variable in the dataset. Thus, there are a total of <em>2 (2^iBest)</em> models.</p>
</li>
</ol>
<p>The complexity is <em>O((T-Ts)*2^iBest)</em> where <em>T</em> is the sample size, <em>Ts</em> is the number of observation in the initial estimation window.</p>
<h2 id="example">Example</h2>
<p>Forecasting US non-farm-payroll one and two months ahead <code>H = [1,2]</code> using a dataset containing 116 US variables taken from <a href="https://amstat.tandfonline.com/doi/abs/10.1080/07350015.2015.1086655">McCracken and Ng (2015)</a>. <code>iBest</code> is set to 16. The code below is an example of parallelization on <code>N_CORE</code>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-julia" data-lang="julia"><span style="display:flex;"><span>addprocs(N_CORE)
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">using</span> ForecastingCombinations
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">using</span> CSV, DataFrames, GLM
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> mae(vX<span style="color:#f92672">::</span><span style="color:#66d9ef">Vector</span>,vY<span style="color:#f92672">::</span><span style="color:#66d9ef">Vector</span>) <span style="color:#f92672">=</span> mean(abs<span style="color:#f92672">.</span>(vX<span style="color:#f92672">-</span>vY)) <span style="color:#75715e">## MAE loss function </span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> rmse(vX<span style="color:#f92672">::</span><span style="color:#66d9ef">Vector</span>,vY<span style="color:#f92672">::</span><span style="color:#66d9ef">Array</span>) <span style="color:#f92672">=</span> sqrt(mean((vX<span style="color:#f92672">-</span>vY)<span style="color:#f92672">.^</span><span style="color:#ae81ff">2</span>)) <span style="color:#75715e">## RMSE loss function</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">const</span> fLoss <span style="color:#f92672">=</span> [mae rmse] <span style="color:#75715e">## Vector of loss functions </span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">const</span> sStart_s <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;01/01/15&#34;</span> <span style="color:#75715e">## This is the beginning of the out-of-sample window</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">const</span> iSymbol <span style="color:#f92672">=</span> <span style="color:#e6db74">:NFP</span> <span style="color:#75715e">## Target variable</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">const</span> vSymbol <span style="color:#f92672">=</span> [<span style="color:#e6db74">:Date</span>, <span style="color:#e6db74">:NFP</span>, <span style="color:#e6db74">:NFP_bb_median</span>] <span style="color:#75715e">## Variables to be removed from the dataset (non-numerical and dep. var.)</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">const</span> H <span style="color:#f92672">=</span> [<span style="color:#ae81ff">1</span>,<span style="color:#ae81ff">2</span>] <span style="color:#75715e">## Out-of-sample horizon</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">const</span> iBest <span style="color:#f92672">=</span> <span style="color:#ae81ff">16</span> <span style="color:#75715e">## iBest</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">const</span> ncomb_load <span style="color:#f92672">=</span> iBest <span style="color:#75715e">## TODO: remove this option</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">const</span> dfData <span style="color:#f92672">=</span> CSV<span style="color:#f92672">.</span>read(joinpath(Pkg<span style="color:#f92672">.</span>dir(<span style="color:#e6db74">&#34;ForecastingCombinations&#34;</span>),<span style="color:#e6db74">&#34;test&#34;</span>,<span style="color:#e6db74">&#34;data.csv&#34;</span>), header <span style="color:#f92672">=</span> true)
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">const</span> iStart <span style="color:#f92672">=</span> find(dfData[<span style="color:#e6db74">:Date</span>] <span style="color:#f92672">.==</span> sStart_s)[<span style="color:#ae81ff">1</span>]
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## computes the two steps variable selection</span>
</span></span><span style="display:flex;"><span>l_plot,r <span style="color:#f92672">=</span> sforecast(dfData,vSymbol,iSymbol,H,iStart,iBest,ncomb_load,fLoss)
</span></span><span style="display:flex;"><span><span style="color:#75715e">## `fforecast` uses results previously stored with `sforecast`</span>
</span></span><span style="display:flex;"><span>l_plot,r <span style="color:#f92672">=</span> fforecast(dfData,vSymbol,iSymbol,H,iStart,iBest,ncomb_load,fLoss)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Plot the forecasts</span>
</span></span><span style="display:flex;"><span>l_plot
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## Remove process added</span>
</span></span><span style="display:flex;"><span>rmprocs(<span style="color:#ae81ff">2</span><span style="color:#f92672">:</span>N_CORE)
</span></span></code></pre></div><!-- raw HTML omitted -->
<p>In case one is interested in predicting probabilities, as the US probability of recession, simply include a link function in <code>sforecast</code> or <code>fforecast</code>, and use a binary variable as dependent variable.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-julia" data-lang="julia"><span style="display:flex;"><span><span style="color:#a6e22e">@everywhere</span> <span style="color:#66d9ef">const</span> l <span style="color:#f92672">=</span> ProbitLink() <span style="color:#75715e"># link function for probability model</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## computes the two steps variable selection</span>
</span></span><span style="display:flex;"><span>l_plot,r <span style="color:#f92672">=</span> sforecast(dfData,vSymbol,iSymbol,H,iStart,iBest,ncomb_load,l,fLoss)
</span></span><span style="display:flex;"><span><span style="color:#75715e">## `fforecast` uses results previously stored with `sforecast`</span>
</span></span><span style="display:flex;"><span>l_plot,r <span style="color:#f92672">=</span> fforecast(dfData,vSymbol,iSymbol,H,iStart,iBest,ncomb_load,l,fLoss)
</span></span></code></pre></div><!-- raw HTML omitted -->
<h2 id="references">References</h2>
<p>Brugnolini L. (2018) &ldquo;Forecasting Deflation Probability in the EA: A Combinatoric Approach.&rdquo; <em>Central Bank of Malta Working Paper</em>, 01/2018.</p>
<p>McCracken, Michael W., and Serena Ng.(2016) &ldquo;FRED-MD: A Monthly Database for Macroeconomic Research.&rdquo; Journal of Business &amp; Economic Statistics 34.4:574-589.</p>
</description>
</item>
<item>
<title>VAR.jl</title>
<link>https://lucabrugnolini.github.io/code/var/</link>
<pubDate>Tue, 01 Aug 2017 00:00:00 +0000</pubDate>
<guid>https://lucabrugnolini.github.io/code/var/</guid>
<description><h4 id="vector-autoregressive-models-for-julia-varjlhttpsgithubcomlucabrugnolinivarjl">Vector autoregressive models for Julia (<a href="https://github.com/lucabrugnolini/VAR.jl">VAR.jl</a>)</h4>
<h2 id="installation">Installation</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-julia" data-lang="julia"><span style="display:flex;"><span>Pkg<span style="color:#f92672">.</span>clone(<span style="color:#e6db74">&#34;https://github.com/lucabrugnolini/VectorAutoregressions.jl&#34;</span>)
</span></span></code></pre></div><h2 id="introduction">Introduction</h2>
<p>This package is a work in progress for the estimation and identification of Vector Autoregressive (VAR) models.</p>
<h2 id="status">Status</h2>
<ul>
<li><input checked="" disabled="" type="checkbox"> VAR
<ul>
<li><input checked="" disabled="" type="checkbox"> VAR(1) form</li>
<li><input checked="" disabled="" type="checkbox"> Lag-length selection
<ul>
<li><input checked="" disabled="" type="checkbox"> AIC</li>
<li><input checked="" disabled="" type="checkbox"> AICC</li>
<li><input checked="" disabled="" type="checkbox"> BIC</li>
<li><input checked="" disabled="" type="checkbox"> HQC</li>
</ul>
</li>
<li><input checked="" disabled="" type="checkbox"> VAR impulse response function (IRFs)
<ul>
<li><input disabled="" type="checkbox"> Identification
<ul>
<li><input checked="" disabled="" type="checkbox"> Reduce form</li>
<li><input checked="" disabled="" type="checkbox"> Cholesky</li>
<li><input disabled="" type="checkbox"> Long-run restrictions</li>
<li><input disabled="" type="checkbox"> Sign restrictions</li>
<li><input disabled="" type="checkbox"> Heteroskedasticity</li>
<li><input disabled="" type="checkbox"> External instruments (ex. high-frequency,narrative)</li>
</ul>
</li>
<li><input checked="" disabled="" type="checkbox"> Confidence bands
<ul>
<li><input checked="" disabled="" type="checkbox"> Asymptotic</li>
<li><input checked="" disabled="" type="checkbox"> Bootstrap</li>
<li><input checked="" disabled="" type="checkbox"> Bootstrap-after-bootstrap</li>
</ul>
</li>
</ul>
</li>
<li><input disabled="" type="checkbox"> Forecasting
<ul>
<li><input disabled="" type="checkbox"> BVAR</li>
<li><input disabled="" type="checkbox"> FAVAR</li>
</ul>
</li>
</ul>
</li>
<li><input disabled="" type="checkbox"> Local projection IRFs
<ul>
<li><input disabled="" type="checkbox"> Lag-length selection</li>
<li><input disabled="" type="checkbox"> Confidence bands
<ul>
<li><input disabled="" type="checkbox"> Standard</li>
<li><input disabled="" type="checkbox"> Bootstrap</li>
</ul>
</li>
<li><input disabled="" type="checkbox"> Bayesian Local Projection</li>
</ul>
</li>
</ul>
<h2 id="example">Example</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-julia" data-lang="julia"><span style="display:flex;"><span><span style="color:#75715e">## Example: fit a VAR(`p`) to the data and derive structural IRFs with asymptotic and bootstrap conf. bands.</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">using</span> VectorAutoregressions, Plots
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>y <span style="color:#f92672">=</span> readdlm(joinpath(Pkg<span style="color:#f92672">.</span>dir(<span style="color:#e6db74">&#34;VectorAutoregressions&#34;</span>),<span style="color:#e6db74">&#34;test&#34;</span>,<span style="color:#e6db74">&#34;cholvar_test_data.csv&#34;</span>), <span style="color:#e6db74">&#39;,&#39;</span>) <span style="color:#75715e">#read example file with data</span>
</span></span><span style="display:flex;"><span>intercept <span style="color:#f92672">=</span> false <span style="color:#75715e">#intercept in the estimation</span>
</span></span><span style="display:flex;"><span>p <span style="color:#f92672">=</span> <span style="color:#ae81ff">2</span> <span style="color:#75715e">#select lag-length</span>
</span></span><span style="display:flex;"><span>H <span style="color:#f92672">=</span> <span style="color:#ae81ff">15</span> <span style="color:#75715e"># IRFs horizon</span>
</span></span><span style="display:flex;"><span>nrep <span style="color:#f92672">=</span> <span style="color:#ae81ff">500</span> <span style="color:#75715e">#bootstrap sample</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Fit VAR(2) to data</span>
</span></span><span style="display:flex;"><span>V <span style="color:#f92672">=</span> VAR(y,p,intercept)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Estimate IRFs - Cholesky identification</span>
</span></span><span style="display:flex;"><span>T,K <span style="color:#f92672">=</span> size(y)
</span></span><span style="display:flex;"><span>mIRFa <span style="color:#f92672">=</span> IRFs_a(V,H,intercept) <span style="color:#75715e">#asymptotic conf. bandf</span>
</span></span><span style="display:flex;"><span>mIRFb <span style="color:#f92672">=</span> IRFs_b(V,H,nrep,intercept) <span style="color:#75715e">#bootstrap conf. bands</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Plot irf + asy ci</span>
</span></span><span style="display:flex;"><span>pIRF_asy <span style="color:#f92672">=</span> plot(layout <span style="color:#f92672">=</span> grid(K,K));
</span></span><span style="display:flex;"><span>[plot!(pIRF_asy, [mIRFa<span style="color:#f92672">.</span>CI<span style="color:#f92672">.</span>CIl[i,<span style="color:#f92672">:</span>] mIRFa<span style="color:#f92672">.</span>IRF[i,<span style="color:#f92672">:</span>] mIRFa<span style="color:#f92672">.</span>CI<span style="color:#f92672">.</span>CIh[i,<span style="color:#f92672">:</span>]], color <span style="color:#f92672">=</span> [<span style="color:#e6db74">&#34;red&#34;</span> <span style="color:#e6db74">&#34;red&#34;</span> <span style="color:#e6db74">&#34;red&#34;</span>],
</span></span><span style="display:flex;"><span>line <span style="color:#f92672">=</span> [<span style="color:#e6db74">:dash</span> <span style="color:#e6db74">:solid</span> <span style="color:#e6db74">:dash</span>], legend <span style="color:#f92672">=</span> false, subplot <span style="color:#f92672">=</span> i) <span style="color:#66d9ef">for</span> i <span style="color:#66d9ef">in</span> <span style="color:#ae81ff">1</span><span style="color:#f92672">:</span>K<span style="color:#f92672">^</span><span style="color:#ae81ff">2</span>]
</span></span><span style="display:flex;"><span>gui(pIRF_asy)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Plot irf + bootstraped ci</span>
</span></span><span style="display:flex;"><span>pIRF_boot <span style="color:#f92672">=</span> plot(layout <span style="color:#f92672">=</span> grid(K,K));
</span></span><span style="display:flex;"><span>[plot!(pIRF_boot, [mIRFb<span style="color:#f92672">.</span>CI<span style="color:#f92672">.</span>CIl[i,<span style="color:#f92672">:</span>] mIRFb<span style="color:#f92672">.</span>IRF[i,<span style="color:#f92672">:</span>] mIRFb<span style="color:#f92672">.</span>CI<span style="color:#f92672">.</span>CIh[i,<span style="color:#f92672">:</span>]], color <span style="color:#f92672">=</span> [<span style="color:#e6db74">&#34;blue&#34;</span> <span style="color:#e6db74">&#34;blue&#34;</span> <span style="color:#e6db74">&#34;blue&#34;</span>],
</span></span><span style="display:flex;"><span>line <span style="color:#f92672">=</span> [<span style="color:#e6db74">:dash</span> <span style="color:#e6db74">:solid</span> <span style="color:#e6db74">:dash</span>], legend <span style="color:#f92672">=</span> false, subplot <span style="color:#f92672">=</span> i) <span style="color:#66d9ef">for</span> i <span style="color:#66d9ef">in</span> <span style="color:#ae81ff">1</span><span style="color:#f92672">:</span>K<span style="color:#f92672">^</span><span style="color:#ae81ff">2</span>]
</span></span><span style="display:flex;"><span>gui(pIRF_boot)
</span></span></code></pre></div><p>More in details, <code>y</code> is a matrix with data, <code>p</code> is the lag-length of the VAR we fit to the data and <code>i</code> is a Boolean for including an intercept (default is true). <code>VAR(y,p,intercept)</code> returns a fitted VAR(<code>p</code>) model in <code>V</code> with the following structure:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-julia" data-lang="julia"><span style="display:flex;"><span>type VAR
</span></span><span style="display:flex;"><span> Y<span style="color:#f92672">::</span><span style="color:#66d9ef">Array</span> <span style="color:#75715e"># dep. variables</span>
</span></span><span style="display:flex;"><span> X<span style="color:#f92672">::</span><span style="color:#66d9ef">Array</span> <span style="color:#75715e"># covariates</span>
</span></span><span style="display:flex;"><span> β<span style="color:#f92672">::</span><span style="color:#66d9ef">Array</span> <span style="color:#75715e"># parameters</span>
</span></span><span style="display:flex;"><span> ϵ<span style="color:#f92672">::</span><span style="color:#66d9ef">Array</span> <span style="color:#75715e"># residuals</span>
</span></span><span style="display:flex;"><span> Σ<span style="color:#f92672">::</span><span style="color:#66d9ef">Array</span> <span style="color:#75715e"># VCV matrix</span>
</span></span><span style="display:flex;"><span> p<span style="color:#f92672">::</span><span style="color:#66d9ef">Int64</span> <span style="color:#75715e"># lag-length</span>
</span></span><span style="display:flex;"><span> i<span style="color:#f92672">::</span><span style="color:#66d9ef">Bool</span> <span style="color:#75715e"># true or false for including an intercept (default is true)</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">end</span>
</span></span></code></pre></div><p>You can access to each element writing <code>V.</code> and than the element you are interested in (for example for the covariates <code>V.X</code>).</p>
</description>
</item>
</channel>
</rss>