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:
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.
A Ricardian Two-Sector Model
This codes simulates a more complex Ricardian distribution and growth model with two sectors.
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.
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.
A New Keynesian 3-Equation Model
This code simulates the Carlin-Soskice version of a New Keynesian 3-Equation model for monetary policy analysis.
A Post-Keynesian Macro Model with Endogenous Money
This code simulates a post-Keynesian macro model with endogenous money creation.
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.
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.