Below are several R codes accompanied by short notes that provide numerical simulations of seminal economic models. These were mostly developed for my teaching. I plan to make more codes available over time. Comments and questions are welcome!
I took inspiration from Marco Veronese Passarella (Link Campus University of Rome) on whose excellent website you can find further R codes. This Cheat Sheet provides a useful overview of key functions in Base R.
Here is a general introduction into how to simulate simple economic models in (Base) R:
R Code How to Simulate Simple Economic Models (txt)
A Malthusian Model
This code simulates a simple model of Malthusian population dynamics.
A Ricardian One-Sector Model
This codes simulates a simple Ricardian distribution and growth model.
R code Ricardian One-Sector Model (txt)
A Ricardian Two-Sector Model
This codes simulates a more complex Ricardian distribution and growth model with two sectors.
R code Ricardian Two-Sector Model (txt)
A Neoclassical Macromodel
This code simulates a simple neoclassical macromodel of output and employment determination. It captures some key neoclassical ideas such as the Classical Dichotomy (money neutrality), the Quantity Theory of Money, Ricardian Equivalence, and the market for loanable funds.
R code Neoclassical Model (txt)
An IS-LM Model
This code simulates a linear version of the well-known IS-LM model.
A Neoclassical Synthesis Model (IS-LM-AS-AD)
This code simulates a version of the Neoclassical Synthesis model. The model introduces a neoclassical labour market with Keynesian frictions into the IS-LM model and gives rise to the well-known AS-AD framework.
R code Neoclassical Synthesis Model (txt)
A New Keynesian 3-Equation Model
This code simulates the Carlin-Soskice version of a New Keynesian 3-Equation model for monetary policy analysis.
R code New Keynesian 3-Equation Model (txt)
A Post-Keynesian Macro Model with Endogenous Money
This code simulates a post-Keynesian macro model with endogenous money creation.
R code Post-Keynesian Endogenous Money Model
A Post-Kaleckian Growth Model
This code simulates a post-Kaleckian model to study the effects of a change in income distribution on economic growth. The model encompasses both wage- and profit-led demand and growth regimes.
R code Post-Kaleckian Growth Model
A Sraffian Supermultiplier Model
This code simulates a Sraffian supermultiplier model to study the effects of a change in autonomous demand on economic activity and growth. The model is written in continuous time.