<p>You can find excellent examples of codes for DSGE models as well as VAR on <a href="https://quantecon.org" rel="nofollow noreferrer">QuantEcon</a>.</p>
<p>For example, here is an example of VAR model in <a href="https://notes.quantecon.org/submission/5db25b54831cf4001af7e506" rel="nofollow noreferrer">Python</a>, and here is an example of some simple <a href="https://notes.quantecon.org/submission/5b3ec499b9eab00015b89f97" rel="nofollow noreferrer">DSGE model</a>.</p>
<p>The above are just examples, you can find different models on the site that might suit you better.</p>
<p>In addition, you should note that in every case you will have to do some parametrization yourself. Very rarely you can just completely copy paste something that was done by someone else.</p>
<p>Even if someone else built VAR or DSGE for the specific country you are looking for there might be some special data challenges (e.g. structural breaks and so on) that you will have to deal on case by case basis.</p>
<p>Consequently, you should not expect to find code that you can reuse just as is, but generally QuantEcon has a lot of very good examples upon which you can build your model and which will save you a lot of time.</p>

CC BY-SA 4.0
2021-05-28T05:22:36.573Z
Thanks. The dream is to have some plug and play model I can adjust, but I understand nothing is that simple. The QuantEcon source is brilliant.
Jamzy
CC BY-SA 4.0
2021-05-27T08:49:41.580Z
2021-05-27T08:49:41.580Z
1muflon1
<p>For forecasting with VAR in R there are some good tutorials on <a href="https://www.econometrics-with-r.org/16-1-vector-autoregressions.html" rel="nofollow noreferrer">econometrics with R</a>. This tutorial from <a href="https://towardsdatascience.com/a-deep-dive-on-vector-autoregression-in-r-58767ebb3f06" rel="nofollow noreferrer">Justin Eloriaga</a> also helped me when we had to make VAR for our quantitative macro assignment. PenState also has good sources for econometrics, <a href="https://online.stat.psu.edu/stat510/lesson/11/11.2" rel="nofollow noreferrer">here</a> are their sources for VAR.</p>

CC BY-SA 4.0
2021-05-27T09:19:13.463Z
2021-05-27T09:19:13.463Z
csilvia
<p>What publicly available resources are there, with sample code, that can be used to build my own macroeconomic model? A search on Github shows that some people have posted code, but I think we can do better.</p>
<p>Ultimately, I am looking to use this model to forecast key economic indicators such as components of GDP and the labour market.</p>
<p>I am method agnostic, so would be happy to see VARs, DSGEs and machine learning examples.</p>

CC BY-SA 4.0
2021-05-27T07:20:58.607Z
How far into the project are you? Have you secured any funding?
Jesper Hybel
CC BY-SA 4.0
2021-05-27T09:54:45.900Z
For DSGE dynare is pretty used https://www.dynare.org/ .
Jesper Hybel
CC BY-SA 4.0
2021-05-27T09:55:44.273Z
Applied General Equilirium models are best developed in GAMS.
Jesper Hybel
CC BY-SA 4.0
2021-05-28T05:26:16.387Z
@JesperHybel - Should it go ahead, there will be funding. I'd not looked at GAMS before. Looks interesting.
Jamzy
CC BY-SA 4.0
2021-05-28T06:06:24.487Z
OxMetrics for timeseries (financial forecasting), but latest review was in 2005, Structural time series modelling with STAMP 6.02, by Gilles Teyssière. Journal of Applied Econometrics, 20, 2005, pp. 571-577. But used to be the best (better than what you could get in R and Python). Very fast.
Jesper Hybel
<dynamic-programming><software><forecasting><linear-programming>
Resources to derive economic forecasts
Jamzy
# Resources to derive economic forecasts

(Asked by: username_0 on 2021-05-27)

What publicly available resources are there, with sample code, that can be used to build my own macroeconomic model? A search on Github shows that some people have posted code, but I think we can do better.

Ultimately, I am looking to use this model to forecast key economic indicators such as components of GDP and the labour market.

I am method agnostic, so would be happy to see VARs, DSGEs and machine learning examples.

**Tags:** dynamic-programming, software, forecasting, linear-programming

> **Comments:**
> **username_1**: How far into the project are you? Have you secured any funding?  
> **username_1**: For DSGE dynare is pretty used https://www.dynare.org/ .  
> **username_1**: Applied General Equilirium models are best developed in GAMS.  
> **username_0**: @JesperHybel - Should it go ahead, there will be funding. I'd not looked at GAMS before. Looks interesting.  
> **username_1**: OxMetrics for timeseries (financial forecasting), but latest review was in 2005, Structural time series modelling with STAMP 6.02, by Gilles Teyssière. Journal of Applied Econometrics, 20, 2005, pp. 571-577. But used to be the best (better than what you could get in R and Python). Very fast.  

---

## 2 answers

### Answer by username_2 on 2021-05-27. Score: 3

You can find excellent examples of codes for DSGE models as well as VAR on [QuantEcon](https://quantecon.org).

For example, here is an example of VAR model in [Python](https://notes.quantecon.org/submission/5db25b54831cf4001af7e506), and here is an example of some simple [DSGE model](https://notes.quantecon.org/submission/5b3ec499b9eab00015b89f97).

The above are just examples, you can find different models on the site that might suit you better.

In addition, you should note that in every case you will have to do some parametrization yourself. Very rarely you can just completely copy paste something that was done by someone else.

Even if someone else built VAR or DSGE for the specific country you are looking for there might be some special data challenges (e.g. structural breaks and so on) that you will have to deal on case by case basis.

Consequently, you should not expect to find code that you can reuse just as is, but generally QuantEcon has a lot of very good examples upon which you can build your model and which will save you a lot of time.

> **Comments:**
> **username_0**: Thanks. The dream is to have some plug and play model I can adjust, but I understand nothing is that simple. The QuantEcon source is brilliant.  

---

### Answer by username_3 on 2021-05-27. Score: 3

For forecasting with VAR in R there are some good tutorials on [econometrics with R](https://www.econometrics-with-r.org/16-1-vector-autoregressions.html). This tutorial from [Justin Eloriaga](https://towardsdatascience.com/a-deep-dive-on-vector-autoregression-in-r-58767ebb3f06) also helped me when we had to make VAR for our quantitative macro assignment. PenState also has good sources for econometrics, [here](https://online.stat.psu.edu/stat510/lesson/11/11.2) are their sources for VAR.


---

