☕
An Introduction to MATLAB
  • An Introduction to MATLAB
  • Where do I start?
  • 1. Crashcourse
    • Intro to Crashcourse
    • Graphical User Interface
    • Essential commands
      • Matrix Input and Access
      • Matrix Algebra
      • Logical Operations
    • Best practices
    • Self-Assessment
    • Applied exercises
  • 2. MATLAB Programming
    • Intro to MATLAB Programming
    • Programming Fundamentals
    • Conditions
    • Loops
    • Custom Functions
    • Debugging
    • Applied Exercises
  • 3. Data, Graphics & Reporting
    • Intro to Data, Graphics & Reporting
    • Working with Datasets
    • Creating Graphs
    • Applied Exercises
  • 4. RNGs & Simulations
    • Intro to RNGs & Simulations
    • Random Number Generation
    • Monte-Carlo Simulations
    • Applied Exercises
  • 5. Numerical Methods
    • Intro to Numerical Methods
    • Numerical Optimization
    • Numerical Solvers
    • Applied Exercises
Powered by GitBook
On this page
  • 1. Getting familiar with data imports and descriptive analysis
  • 2. Plotting the evolution of the economy in the canonical OLG model
  • Theory

Was this helpful?

  1. 3. Data, Graphics & Reporting

Applied Exercises

This section provides some exercises that are meant to deepen your knowledge in the topics covered in this section and to gain experience solving real-world problems.‌

PreviousCreating GraphsNextIntro to RNGs & Simulations

Last updated 5 years ago

Was this helpful?

1. Getting familiar with data imports and descriptive analysis

In this exercise you will download some data of your choice from popular statistical databases and conduct descriptive analysis using MATLABs graphical engine. Try this exercise multiple times varying data source, the dataset and the data format until you get comfortable with handling and plotting data in MATLAB.

1) Download a dataset of your choice in either .csv or .xls/.xlsx format from one of the following statistical databases.

2) Inspect the file using a text editor and decide which is the best way to import it into MATLAB?

3) Use the commands you learned in this unit to import the data.

4) Use MATLABs graphical engine to generate interesting plots of varying plot type etc. Make sure your label your axis appropriately, add titles and legends etc.

2. Plotting the evolution of the economy in the canonical OLG model

In this exercise you will extend the exercise from the previous section to calculating the evolution of multiple variables characterizing the OLG economy and plotting the generated series.

Simulate the evolution of the economy for each variable, saving it in a different vector when the initial capital stock per worker is k0=0.1k_0=0.1k0​=0.1 and initial population size is L1=1L_1=1L1​=1. Create a 2 by 2 plot that shows the evolution of capital per worker, output, wages and return to capital side by side. For each plot, label the variable and axis appropriately.

Use the following parameter values.

Parameter

Value

4

0.4

0.9

0.02

0.5

Tip: Use the subplot command to create the 2x2 plot matrix.

Theory

In the canonical overlapping-generations (OLG) model, the evolution of the capital stock per worker is described by the following law of motion.

kt+1=11+nβ1+β  (1−α)  A  ktαk_{t+1} = \frac{1}{1+n} \frac{\beta}{1+\beta} \; (1-\alpha) \; A \; k_t^\alphakt+1​=1+n1​1+ββ​(1−α)Aktα​

where kkk is the capital per worker, nnn is the population growth rate, β\betaβ is the discount factor, α\alphaα is the capital share in the production function and AAA is the TFP parameter from the production function.

The population stock LLL is described by the following law of motion.

Lt+1=(1+n)  LtL_{t+1} = (1+n) \; L_tLt+1​=(1+n)Lt​

Output of the economy (YYY), wages of the workers (www) and return to capital RRR are described by the following equations.

Y=AL1−αKαY = A L^{1-\alpha} K^\alphaY=AL1−αKα

w=(1−α)YLw = (1-\alpha) \frac{Y}{L}w=(1−α)LY​

R=(1−δ)+αYKR = (1-\delta) + \alpha \frac{Y}{K}R=(1−δ)+αKY​

AAA
α\alphaα
β\betaβ
nnn
δ\deltaδ
FRED (Federal Reserve Bak of St. Louis)
BLS (US Bureau of Labor Statistics)
ECB Statistical Data Warehouse
EUROSTAT
FRED-MD/FRED-QD
World Bank Database
IMF (International Monetary Fund)