0% found this document useful (0 votes)
24 views

Macro II Notes - Topic 3 - Update 8

This document is a set of notes for the Macroeconomic Analysis II course at Columbia University, authored by Pablo De Llanos. It covers various topics in macroeconomics, including the distinction between short-run and long-run economic factors, the quantitative theory of growth, and business cycles. The document includes mathematical appendices and MATLAB instructions for solving economic models.

Uploaded by

tw3066
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Macro II Notes - Topic 3 - Update 8

This document is a set of notes for the Macroeconomic Analysis II course at Columbia University, authored by Pablo De Llanos. It covers various topics in macroeconomics, including the distinction between short-run and long-run economic factors, the quantitative theory of growth, and business cycles. The document includes mathematical appendices and MATLAB instructions for solving economic models.

Uploaded by

tw3066
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

Macroeconomic Analysis II

Pablo De Llanos∗
Columbia University

February 26, 2025

∗ These notes extensively draw upon the content covered in the Macroeconomics Analysis II
graduate course instructed by Irasema Alonso at Columbia University. If you find a typo or an
error, please send me an email at [email protected].
Contents
1 Introduction 1
1.1 The Short Run and the Long Run . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Per-Capita GDP vs. Welfare . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Consumption-Equivalent Welfare . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Quantitative Theory of Growth 6


2.1 Kaldor’s Growth Facts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Neoclassical-Type Model Set Up . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.1 Balanced Growth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.2 Production . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.3 Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.4 Factor Prices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.5 Factor Shares of Income . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.6 Cobb-Douglas Production Function . . . . . . . . . . . . . . . . . . . 13
2.2.7 Consumer Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.8 The Constant-Elasticity World . . . . . . . . . . . . . . . . . . . . . . 16
2.3 Labor Supply and Productivity Growth . . . . . . . . . . . . . . . . . . . . . 18
2.3.1 MaCurdy Utility Function . . . . . . . . . . . . . . . . . . . . . . . . 19
2.4 Cross-Country Income Per-Capita Comparisons (additional) . . . . . . . . . 22

3 Business Cycles 27
3.1 Trends and Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.1.1 HP-Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.1.2 Comovements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.2 The Real Business Cycle Model . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2.1 A Simple RBC Model . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.2.2 Recursive Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.2.3 Numerical Model Solving . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.2.4 Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.2.5 Impulse Response Functions . . . . . . . . . . . . . . . . . . . . . . . 37
3.2.6 Quantitative Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.2.7 Higher-Order Perturbations (additional) . . . . . . . . . . . . . . . . 39

A Mathematical Appendix 41
A.1 Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

1
A.1.1 Derivative Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
A.1.2 L’Hôpital’s Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
A.1.3 Higher-Order Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 43
A.1.4 Taylor’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
A.1.5 Log-Linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
A.2 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
A.2.1 Constrained Optimization: Equality Constraints . . . . . . . . . . . . 46
A.3 Homogeneous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
A.3.1 Partial Derivatives of Homogeneous Functions . . . . . . . . . . . . . 47
A.3.2 Euler’s Homogeneous Function Theorem . . . . . . . . . . . . . . . . 47
A.4 Implicit Function Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
A.5 Convexity and Concavity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
A.6 Growth Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
A.6.1 Growth Rate Properties . . . . . . . . . . . . . . . . . . . . . . . . . 49
A.6.2 Cummulative Average Growth Rate . . . . . . . . . . . . . . . . . . . 50
A.6.3 Geometric Average Growth Rate . . . . . . . . . . . . . . . . . . . . 50
A.6.4 Continuously Compounded Growth Rates . . . . . . . . . . . . . . . 51
A.6.5 Percent Changes vs. Compounded Growth Rates . . . . . . . . . . . 51

B MATLAB 52
B.1 Introduction to MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
B.2 Solving DSGE Models with DYNARE . . . . . . . . . . . . . . . . . . . . . 60
B.2.1 DYNARE Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 61
B.2.2 Solving the RBC Model . . . . . . . . . . . . . . . . . . . . . . . . . 61

C Data Appendix 66
C.1 GDP per Capita and Well-Being . . . . . . . . . . . . . . . . . . . . . . . . . 66
C.2 GDP per Working-Age Adult . . . . . . . . . . . . . . . . . . . . . . . . . . 66
C.3 U.S. Empirical Regularities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
C.4 Recent Trends in Income Shares and Hours Worked . . . . . . . . . . . . . . 69
C.4.1 Hours Worked per Worker . . . . . . . . . . . . . . . . . . . . . . . . 70
C.5 U.S. Business Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

References 73
1 Introduction
Macroeconomists construct mathematical models to study several issues.

• The values of endogenous variables are determined within the model.

• The values of exogenous variables are determined outside the model. In particular, the
model takes their values and behavior as given.

1.1 The Short Run and the Long Run


Let Yt denote aggregate output, or gross domestic product (GDP).1 We can “model” the time
series for output, {Y1 , Y2 , . . . , YT } as a stochastic process; i.e. as, in part, random.
More specifically, this process can be decomposed into (i) a slowly moving part - the trend
(or low-frequency movement), and (ii) a more volatile part - the cycle (or high-frequency
movement). The trend is about long-run growth in Yt , and the cycle is about short-run
fluctuations.
To illustrate, suppose that Yt is determined as:

Yt = (1 + g)t (Y + ϵt ) (1)

where g is the average growth rate (the trend) and is assumed to be deterministic, whereas
ϵt models the short-run deviations from the trend, and is random. In other words, the long
run is about how g and Y are determined, and the short run is about how the properties of
ϵt are determined.
For instance, suppose that Y = 1, and ϵt follows a flip coin process, where it takes value
+0.2 if the coin shows heads (with probability 0.5) and -0.2 otherwise. That is, ϵt increases
or decreases Yt by approximately 20% relative to the trend with equal probability. To see
this, take logs of equation (1) and note that:

ln Yt = t ln (1 + g) + ln (1 + ϵt ) ≈ tg + ϵt (2)

for small values of g and ϵt .2

1
The market value of all goods and services produced within a country in a given period.
2
You can refer to Math Appendix A.6 for an overview of growth rates.

1
Graphically:
8

log Yt 3

1 Trend
log Yt

-1
0 10 20 30 40 50 60 70 80 90 100
Period t

Now, suppose that recessions are more severe than booms. For example, let ϵt take value
-0.4 if the coin shows tails. That is, during recessions ϵt decreases Yt by approximately 40%
relative to the trend:
8

4
log Yt

3
Normal Recessions
2 Stronger Recessions

-1
0 10 20 30 40 50 60 70 80 90 100
Period t

Business cycles frequently make headlines, whether due to recession fears, subprime mort-
gage crises, changes in monetary and fiscal policy, pandemics, or other factors. However, in
the long run, it may be more beneficial to focus on uplifting the overall trend rather than
solely smoothing out fluctuations around it, as illustrated by the following figure:

2
12

10

log Yt
4

2
Normal Growth Rate
Faster Growth Rate
0

-2
0 10 20 30 40 50 60 70 80 90 100
Period t

1.2 Per-Capita GDP vs. Welfare


Macroeconomists prioritize evaluating the economy by focusing on GDP per capita because
it strongly correlates with various indicators associated with welfare. These include lower
poverty rates, improved access to electricity, reduced child mortality, higher human devel-
opment, increased life expectancy, enhanced labor productivity, lower crime rates, improved
learning outcomes, higher democratic quality, and greater gender equality, amongst others
(see Data Appendix C.1). However, we can go beyond GDP per capita and construct more
comprehensive measures of welfare for cross-country comparisons.

1.3 Consumption-Equivalent Welfare


Jones and Klenow (2016) construct a model-based measure of welfare that incorporates con-
sumption, leisure, mortality, and inequality. To this end, although people in different coun-
tries may have different preferences, they compare welfare across countries using a common
specification for preferences.

Expected Lifetime Utility

Let C denote an individual’s annual consumption and ℓ denote leisure plus time spent in
home production. Expected lifetime utility is then:
" #
U =E β u(Ca , ℓa )S(a)
a
(3)
X

3
where β is the discount factor, S(a) is the probability an individual survives to age a, and
the expectations operator applies to the uncertainty concerning consumption and leisure.

Welfare Calculation

Let Ui (λ) denote expected lifetime utility in country i if consumption is multiplied by a factor
λ at each age: " #
Ui (λ) = Ei β a u(λCa,i , ℓa,i )Si (a) (4)
X

What proportion of a consumer’s annual consumption living his life in the US would make
them indifferent to living in e.g. China or France? Call the answer to this question λChina or
λF rance . More specifically, the answer to this question for country i satisfies:

UUS (λi ) = Ui (5)

where Ui := Ui (1).

• If λi = 0.7, the consumer is indifferent between living as an average person in country


i or living in the US with 70% of the average US consumption.

• If λi = 1.3, the consumer is indifferent between living as an average person in coun-


try i or living in the US with a consumption level 30% higher than the average US
consumption.

• λi = 1, the consumer is indifferent between living as an average person in the US and


country i (i.e. UUS = Ui ).

Jones and Klenow implement this calculation across countries using cross-sectional data
on consumption and leisure and cross-sectional data on the age distribution, treating indi-
viduals as drawing from this cross-section over their lifetime.
Assume the utility function is given by:

u(C, ℓ) = u + log C + v(ℓ) (6)

Suppose that consumption in each country is lognormally distributed across people at a


point in time, independent of age, with arithmetic mean ci = E[Ci ] and a variance of log
consumption of Var[log Ci ] = σi2 . That is, C ∼ Lognormal(µ, σ 2 ) with µ = E[log C] and

4
C ∈ (0, ∞), while log C ∼ N (µ, σ 2 ).3 Therefore,

1 2
c ≡ E[C] = eµ+ 2 σ (7)

Taking logs and rearranging:


1
µ = log c − σ 2 (8)
2
Finally, assume that leisure is certain and constant across ages.4 Hence, taking expectations
of (6) yields:

E[u(C, ℓ)] = u + E[log C] +v(ℓ) (9)


| {z }

1
= u + log c − σ 2 + v(ℓ) (10)
2

Therefore, under these assumptions, expected lifetime utility in country i is given by:

1
 
Ui = β Si (a) · u + log ci + v(ℓi ) − σi2
a
(11)
X

a | {z
2 }
Ei u(Ci ,ℓi )

For simplicity, consider the special case in which β = 1. Then, the term β a Si (a) simplifies
P
a
to ei ≡ a Si (a), which equals life expectancy at birth. Accordingly,
P

1
 
Ui = ei · u + log ci + v(ℓi ) − σi2 (12)
2

That is, lifetime utility is the product of life expectancy and expected flow utility from
each year. Similarly,

1
 
Ui (λi ) = ei · u + log λi + log ci + v(ℓi ) − σi2 (13)
2

where I simply used the fact that log(λC) = log λ + log C, and thus u(λC, ℓ) = u + log λ +
log C + v(ℓ), so E[u(λC, ℓ)] = u + log λ + log c − 21 σ 2 + v(ℓ).

3
We say a random variable Y is log-normally distributed with parameters (µ, σ 2 ) when log Y follows a
Normal distribution with mean µ and variance σ 2 . That is, Y ∼ Lognormal(µ, σ 2 ) ⇐⇒ log Y ∼ N (µ, σ 2 ).
4
In the data, however, both C and ℓ vary systematically with age, so ∀a, Ca,i ̸= Ci , ℓa,i ̸= ℓi . The
calculations in Jones and Klenow (2016) could be improved.

5
Consumption-Equivalent Welfare

To compare the welfare in country i with the welfare in the US, we need to impose the
condition UUS (λi ) = Ui :

1 2 1
   
eUS · u + log λi + log cUS + v(ℓUS ) − σUS = ei · u + log ci + v(ℓi ) − σi2 (14)
2 2

ei 1 1 2
   
=⇒ log λi = · u + log ci + v(ℓi ) − σi2 − u + log cUS + v(ℓUS ) − σUS (15)
eUS 2 2

Therefore,

ei − eUS 1 1 2
 
(16)

log λi = · u + log ci + v(ℓi ) − σi2 + log ci − log cUS + v(ℓi ) − v(ℓUS ) − 2
σi − σUS
eUS 2 | {z } | {z } 2
| {z } consumption leisure
| {z }
life expectancy inequality

This expression provides an easy-to-implement additive decomposition of the forces that


determine welfare in country i relative to the US. The first term captures the effect of dif-
ferences in life expectancy: it is the percentage difference in life expectancy weighted by
how much a year of life is worth – the flow utility in country i, Ei u(Ci , ℓi ). The remaining
three terms denote the contributions of differences in consumption, leisure, and inequality
(as measured by the standard deviation of log consumption).

2 Quantitative Theory of Growth


2.1 Kaldor’s Growth Facts
The Kaldor facts refer to the standard stylized facts, or empirical regularities, of the US
economy, established based on pre-1950 economic data.5

1. Output per capita grows at a roughly constant rate.

2. The capital-output ratio remains approximately constant.

3. The consumption-output ratio is relatively stable.


5
Overall, the Kaldor facts continue to hold in the sense that constant trends provide a reasonable first-
order description of most data (see Data Appendix C.3). However, there are sizable short- and medium-term
fluctuations around these trends.

6
4. Real wages grow at a roughly constant rate that matches the growth rate of output.

5. The real interest rate fluctuates but exhibits no clear upward or downward trend.

6. Labor income as a share of output remains approximately constant.6

7. Hours worked per capita have been roughly stable over the past half-century.7

Our goal is to develop a model that accurately reflects the seven Kaldor facts. While the
field of economic growth has advanced significantly since Kaldor’s original work, consistency
with these fundamental facts remains the minimum requirement for a credible model of
economic growth.

2.2 Neoclassical-Type Model Set Up


A growth model has to satisfy three equations: a production function, a resource constraint,
and a capital accumulation equation.

(i) Production Function

Our neoclassical aggregate production will take the form:

Y
|{z} = F ( |{z} L )
K , |{z} (17)
output physical labor
capital

and it will satisfy the following three conditions:

1. Constant returns to scale (CRS), or homogeneity of degree one,8 in rival inputs:9

F (λK, λL) = λF (K, L) (18)

2. Positive returns in each input:


∂F ∂F
, >0 (19)
∂K ∂L
3. Strict quasiconcavity (see Math Appendix A.5).
6
Recently, however, a downward trend in the labor income share has been observed (see Data Appendix
C.4).
7
In the US post-WWII period, hours worked per capita have been roughly constant. Yet, most other rich
countries have experienced a decline in hours worked per capita.
8
Refer to Math Appendix A.3 for an overview of homogeneous functions.
9
Rival inputs are those that cannot be consumed by multiple firms simultaneously. K represents tangible
assets like machinery, equipment (e.g. computers), buildings, and infrastructure that are considered rival.

7
(ii) Resource Constraint

We assume the economy is closed and there is no government. Therefore, in each period t:

Yt = C t + It (20)
|{z} |{z}
consumption investment

(iii) Capital Accumulation

The stock of physical capital evolves according to the following capital acummulation equa-
tion:
Kt+1 = (1 − δ)Kt + It (21)

where δ is the depreciation rate of the existing capital, which can be thought of as the
probability that existing capital breaks.

2.2.1 Balanced Growth

We want to consider long-run growth in terms of balanced growth, meaning that all economic
variables in our model experience growth at constant rates, where these rates might differ
for various variables.

Uzawa’s Theorem

Consider the production function Yt = F (At , Kt , L), where growth in A represents tehcno-
logical progress, or total factor productivity (TFP),10 and L is constant.
Uzawa (1961) showed that if Kt and Yt grow at constant rates and F (·) has CRS in Kt
and L, it must be that:
gY = gK = gA (22)

10
A represents TFP, encompassing elements like technology, innovation, and institutions. Unlike tangible
assets, TFP is non-rival.

8
where gx indicates the growth rate of variable x. Moreover, the production function must be
of the labor-augmenting type:

F (At , Kt , L) = F (Kt , At L) (23)

For example, F (Kt , At L) = Ktα (At L)1−α , α ∈ (0, 1).

2.2.2 Production

Consider a CRS production function with labor-augmenting growth at the rate γ: At = γ t .


For now, we assume that the labor input remains fixed over time, consistent with Kaldor
fact 7: Hours worked per capita have been roughly stable over the past half-century:

Yt = F (Kt , γ t L) (24)

Given the CRS,


Kt 1
F( , L) = F (Kt , γ t L) (25)
γt γt
Hence,
Kt
F (Kt , γ t L) = γ t F ( , L) (26)
γt
Note that if Yt grows at a constant rate γ (Kaldor fact 1: Output per capita, Yt /L, grows at
a roughly constant rate) and we want the capital-output ratio to be constant (Kaldor fact
2: The capital-output ratio, K Yt
t
, remains approximately constant), Kt must also grow at the
rate γ as well. Therefore, in the right-hand-side (RHS) of (26), both arguments of F (·) are
constant, verifying that Yt indeed grows at the rate γ. Accordingly, Uzawa’s theorem is also
satisfied: gY = gK = gA = γ.
In addition, notice that It must also grow at the same rate γ because Kt+1 = (1−δ)Kt +It .
Likewise, gC = γ as well because Yt = Ct + It , verifying Kaldor fact 3: The consumption-
output ratio, CYtt , is relatively stable.11

11
Refer to Math Appendix A.6.1 for an overview of growth rate properties.

9
Yt , Kt , It , Ct all grow at the same constant rate γ. Therefore, assuming the economy is on
its balanced-growth path (BGP):

(BGP )
Yt = γ t Y0
(BGP )
Kt = γ t K0
(BGP )
(27)
It = γ t I0
(BGP )
Ct = γ t C0

Hence, the resource constraint is satisfied in all periods as long as F (K0 , L) = C0 + I0 , and
the capital accumulation equation holds in all periods provided that K0 = (1 − δ)K0 + I0 .
This gives us two restrictions on the initial values of all variables:

I0 = (γ + δ − 1)K0 (28)

C0 = F (K0 , L) − (γ + δ − 1)K0 (29)

Thus, for each value of K0 , there is an associated level of investment, consumption (and
output), allowing different BGPs to be followed—though at different levels.
For any given initial capital stock, exact balanced growth requires a specific initial value
of investment (or, equivalently, consumption).

Constant Savings Rate

It is also an empirical regularity that saving rates remain approximately constant. Accord-
ingly, we assume a constant savings rate s ∈ [0, 1]. Moreover, since Yt = Ct + It , investment
is simply the portion of output that is not consumed: It = Yt − Ct . But the unconsumed
portion is also the amount that is saved. Hence, It = sYt . Accordingly:

Kt+1 = (1 − δ)Kt + sYt (30)


= (1 − δ)Kt + sF (Kt , γ t L) (31)
Kt
= (1 − δ)Kt + sγ t F ( t , L) (32)
γ

Kt
Defining K̂t := , we have:
γt

Kt+1 = (1 − δ)Kt + sγ t F (K̂t , L) (33)

10
Dividing both sides by γ t :

Kt+1 Kt
t
= (1 − δ) t + sF (K̂t , L) (34)
γ γ

Kt+1
⇐⇒ γ = (1 − δ)K̂t + sF (K̂t , L) (35)
γ t+1
=⇒ γ K̂t+1 = (1 − δ)K̂t + sF (K̂t , L) (36)

2.2.3 Convergence

Since Kt grows at a constant rate γ at the BGP, we should expect that K̂t = K t
γt
converges
to some specific value in the long run.12 That’s the steady state, where K̂t = K̂ss for all t.
Therefore,
γ K̂ss = (1 − δ)K̂ss + sF (K̂ss , L) (37)

=⇒ (γ + δ − 1)K̂ss = sF (K̂ss , L) (38)

and
(BGP )
Kt = γ t K̂ss (39)

That is, as K̂t converges to its steady state, Kt will move closer to its long-run BGP.

2.2.4 Factor Prices

Our model so far is consistent with Kaldor facts 1–3 and 7, which pertain to factor quantities.
We now need to incorporate Kaldor facts 4–5, which relate to factor prices.13 In the next
section, we will incorporate Kaldor fact 6, which pertains to factor shares of income.

Perfect Competition

Assume that firms operate in a perfectly competitive environment, where they are price
takers. Then, since F (·) exhibits CRS, firms earn zero profits in equilibrium. Moreover,
firms face a static profit maximization problem each period:

max F (kt , At lt ) − rt kt − wt lt (40)


kt ,lt

12
Under some reasonable assumptions on the primitives, (γ, s, F, δ), the dynamics imply convergence to a
steady state for K̂t . That is, limt→∞ K̂t = K̂ss for all K0 > 0.
13
All prices are denominated in terms of a numeraire, representing the final good in the economy (e.g.
“cookies”), whose price is normalized to one.

11
where rt is the rental price for capital, and wt denotes the real wage.
Therefore, in equilibrium, the sufficient first-order conditions (FOCs) evaluated at equi-
librium quantities are given by:

rt = F1 (Kt , At L) (41)
wt = At F2 (Kt , At L) (42)

where the partial derivatives F1 = ∂F (·)/∂Kt and F2 = ∂F (·)/∂At L, are homogeneous


of degree 0 (because F (·) is homogeneous of degree one), meaning that ∀i ∈ {1, 2}, λ >
0, Fi (λKt , λAt L) = Fi (Kt , At L).14 Accordingly, for λ = A1t L , we can rewrite the FOCs as:

Kt
 
rt = F1 ,1 (43)
At L
Kt
 
wt = At F2 ,1 (44)
At L

Therefore, on the BGP, as At and Kt grow at the constant rate γ, rt is constant; i.e. rt = r for
all t, satisfying Kaldor fact 5: The real interest rate, r, exhibits no clear upward or downward
trend. Similarly, wt grows at the constant rate gA = γ, satisfying Kaldor fact 4: Real wages,
wt , grow at a roughly constant rate that matches the growth rate of output, Yt .

2.2.5 Factor Shares of Income

The capital income share is also constant on the BGP:


   
rt Kt F1 Kt
At L
,1 Kt Kt F 1 Kt
A L
,1
= =  t (45)
F (Kt , At L) |{z} At LF

Yt
CRS
Kt
At L
, 1
 
This is because, as At and Kt grow at the constant rate γ, we have that Kt
At L
, F1 Kt
At L
,1 ,
 
and F Kt
,1
are constant.
At L
Likewise, the labor income share can also be showed to be constant on the BGP:
   
wt L At F2 AKt tL , 1 L At LF2 AKt tL , 1
= = (46)
F (Kt , At L) |{z} At LF Kt , 1
 
Yt
CRS At L

Therefore, we also verify Kaldor fact 6: Labor income as a share of output, wt L


Yt
, remains
approximately constant.

14
See Math Appendix A.3.

12
2.2.6 Cobb-Douglas Production Function

The Cobb-Douglas function is the only production function where the shares of capital income
and labor income remain constant. Therefore, we must confine our function F (·) to a Cobb-
Douglas form:
F (Kt , γ t L) = Ktα (γ t L)1−α , α ∈ (0, 1) (47)

In perfectly competitive markets, each factor input is paid its marginal product (i.e. r =
M P K and w = M P L):15

∂Yt  1−α Yt
rt = M P Kt = = αKtα−1 γ t L =α (48)
∂Kt Kt

∂Yt  −α Yt
wt = M P L t = = (1 − α)Ktα γ t L γ t = (1 − α)Ktα (γ t )1−α L−α = (1 − α) (49)
∂L L
Accordingly, for all t:

K income rKt Yt Kt
 
K share
= t = = α =α (50)
Yt Yt Kt Yt

Lincome wt L Yt L
 
L share
= t = = (1 − α) =1−α (51)
Yt Yt L Yt

Capital Accumulation and BGP

Note also that if the production function is given by a Cobb-Douglas, the steady state is
found by solving equation (38) as:

(γ + δ − 1)K̂ss = sK̂ss
α 1−α
L (52)

sL1−α
1−α
⇐⇒ K̂ss = (53)
γ+δ−1
! 1
s 1−α
=⇒ K̂ss = L (54)
γ+δ−1

15
Intuitively, firms hire labor and physical capital until their cost do not exceed their benefit. That is,
until r = M P K and w = M P L.

13
2.2.7 Consumer Preferences

We assume households to have utility functions that are time-additive:



β t u (ct , 1 − lt ) (55)
X

t=0

where u(·) is strictly increasing in both arguments and strictly concave,16 and the discount
factor β ∈ (0, 1) captures impatience (the lower the β the more impatient the agent is).17
Given that consumers want to consume as much as possible and that they like variety,
they will aim to maximize ct , ct+1 , . . ., while smoothing consumption over time. This
means that consumers prefer maintaining a relatively consistent level of consumption today
and tomorrow, rather than experiencing significant fluctuations between different periods; i.e.
consumers prefer avoiding scenarios of high consumption today and minimal consumption
tomorrow, or vice versa.

Consumption and Leisure

Consumers make two decisions:

1. Consuming (vs. saving).

2. Supplying labor (vs. enjoying leisure time).

In particular, given their budget constraint (B.C.),

t c + i
t = rt kt + wt lt (56)
|{z} |{z} |{z} |{z}
consumption investment capital wage
income income

consumers choose ct , lt , and kt+1 so as to maximize their lifetime utility:



max β t u (ct , 1 − lt )
X
E0
{ct ,lt ,kt+1 }∞
t=0 t=0 (57)
s.t. ct + kt+1 = rt kt + wt lt + (1 − δ)kt ∀t

where E denotes expectations over future uncertainty, and where the original B.C. (56) has
been rewritten by substituting it using the capital accumulation equation.

16
We make two key assumptions to obtain “well-behaved” preferences: (i) Monotonicity (more consump-
tion is better), and (ii) Convexity of preferences (preference for variety).
17
In general, utils are valued less the later they are received.

14
The condition that guarantees the optimality of the consumption (vs. saving) decision is
given by the Euler equation:

uc (ct , 1 − lt ) = βEt uc (ct+1 , 1 − lt+1 ) Rt+1 ∀t (58)

where Rt = 1 − δ + rt is the gross real interest rate on capital investment, and uc (ct , 1 − lt ) =
∂u(·)/∂ct .
The Euler equation has a highly intuitive interpretation: At the optimal point, the con-
sumer must be equally satisfied between consuming one additional unit of the consumption
good today or saving it to consume in the next period.

• If the consumer chooses to consume one more unit today, their utility increases by
uc (ct , lt ), which corresponds to the left-hand side (LHS) of the Euler equation.

• Alternatively, if the consumer saves this unit for the next period, they will have Rt+1
units, leading to a utility gain of uc (ct+1 , lt+1 ) Rt+1 . However, due to impatience, future
utility is discounted by β. Thus, the additional utility gain from saving the unit is
βuc (ct+1 , lt+1 ) Rt+1 , which constitutes the RHS of the Euler equation.

Similarly, the condition that guarantees the optimality of the labor supply (vs. leisure)
decision is given by the labor-supply equation:

−ul (ct , 1 − lt ) = wt uc (ct , 1 − lt ) ⇐⇒ u1−l (ct , 1 − lt ) = wt uc (ct , 1 − lt ) ∀t (59)

where uc (ct , 1 − lt ) is the utility gain from additional consumption, and wt is the real wage.
Intuitively, the optimal allocation of time is such that the marginal utility cost of an additional
hour of work (in terms of forgone leisure 1 − lt ), u1−l (ct , 1 − lt ) = ∂u(·)/∂[1 − lt ], equals its
marginal benefit, wt uc (ct , 1 − lt ).18
The results (58) and (59) follow from setting up the Lagrangian of the consumer’s maxi-
mization problem and solving for the sufficient FOCs:

L = E0 β t {u (ct , 1 − lt ) + λt [rt kt + wt lt + (1 − δ)kt − ct − kt+1 ]} (60)
X

t=0

∂L
= β t [uc (ct , 1 − lt ) − λt ] = 0 =⇒ λt = uc (ct , 1 − lt ) (61)
∂ct

18
Observe that, as lt = 1 − (1 − lt ), we have that u1−l (ct , 1 − lt ) = ∂u(·)/∂[1 − lt ] = −∂u(·)/∂lt =
−ul (ct , 1 − lt ).

15
∂L
= β t [ul (ct , 1 − lt ) + λt wt ] = 0 =⇒ −ul (ct , 1 − lt ) = λt wt (62)
∂lt
∂L
= β t [−λt + βEt λt+1 (rt+1 + (1 − δ))] = 0 =⇒ λt = βEt λt+1 Rt+1 (63)
∂kt+1
The Euler equation follows from combining the first and the third FOCs, (61) and (63), while
the labor-supply equation follows from combining the first and the second, (62), FOCs.
Note that an alternative way to express the second FOC (62) for the leisure “good” (1−lt ),
instead of lt , is to substitute lt = 1 − (1 − lt ) into the budget constraint so that:

∂L
= β t [u1−l (ct , 1 − lt ) − λt wt ] = 0 =⇒ u1−l (ct , 1 − lt ) = λt wt (64)
∂(1 − lt )

2.2.8 The Constant-Elasticity World

Remember that we require balanced growth in consumption along with a constant labor
supply in the long run. There exists a unique class of utility functions that, in equilibrium,
yields a constant saving rate and a fixed amount of hours worked. These conditions are
satisfied if and only if the utility function is of the following form:

(ct · v(1 − lt ))1−σ − 1


u(ct , 1 − lt ) = (65)
1−σ

where v(·) is strictly increasing and such that ct · v(1 − lt ) is strictly quasiconcave. The
above preferences are known as the isoelastic utility form within the King–Plosser–Rebelo
(KPR) preferences, where σ > 0 regulates the desire for consumption smoothing, or how
much we dislike fluctuations in c. More specifically, the parameter σ governs the propensity
to substitute consumption across periods. Note, in addition, that as σ → 1, converges to
logarithmic utility,19 for which the income effect and substitution effect of saving exactly
offset.
The isoelastic utility function is a special case of hyperbolic absolute risk aversion and
at the same time is the only class of utility functions with constant relative risk aversion,
′′ (c)
defined as −uu′ (c)
, which is why it is also called the constant relative-risk-aversion (CRRA)
utility function.
No other utility function aligns with balanced growth, the Euler equation, and the labor-
supply equation simultaneously. Therefore, we have pinpointed a utility function specification
that is the sole one consistent with maintaining a constant saving rate and a constant labor
supply in the long run.

c1−σ −1 c1−σ −1 −c1−σ ln c


19
This is because limσ→1 1−σ = 00 . So, using l’Hôpital’s rule: limσ→1 1−σ = limσ→1 −1 = ln c.

16
Example 1: v(1 − lt ) = 1 − lt

Suppose that v(1 − lt ) = 1 − lt . Then:

(ct · (1 − lt ))1−σ − 1
u(ct , 1 − lt ) = (66)
1−σ

where

t (1 − lt )
uc (ct , 1 − lt ) = c−σ 1−σ
(67)

Substituting into the Euler equation (58):

t (1 − lt )
c−σ = βc−σ
t+1 (1 − lt+1 ) (1 − δ + rt+1 ) (68)
1−σ 1−σ

With constant labor supply (i.e. lt = l for all t):

c−σ
t = βc−σ
t+1 (1 − δ + rt+1 ) (69)

Notice that, on the BGP, ct+1 = γct and rt = r for all t. Hence:
!−σ
1
= β(1 − δ + r) (70)
γ

which yields the endogenous interest rate:

γσ
r= +δ−1 (71)
β

Moreover, we can combine the fact that gK = γ and rKYt


t
= α, and the capital accumulation
equation (21) to show that:
α(γ − 1 + δ)
s= (72)
r
Similarly, we have that:

u1−l (ct , 1 − lt ) = (1 − lt )−σ c1−σ


t (73)

Substituting into the labor-supply equation (59):

(1 − lt )−σ c1−σ
t = c−σ
t (1 − lt )
1−σ
· wt (74)

17
⇐⇒ ct = (1 − lt )wt (75)
ct
=⇒ wt = (76)
1 − lt
xx
On the BGP, lt = l for all t (Kaldor fact 7: Hours worked per capita have been roughly
stable over the past half-century). Thus, wt will grow at rate γ and, at equilibrium quantities
(or, equivalently, with a unit mass of homogeneous agents):20

(1 − s)yt (1 − s)Yt
wt = = (77)
1−l 1−L

In addition, as in perfectly competitive markets each factor input is paid its marginal product,
we have that wt = 1−α L
Yt . Therefore:

1−α (1 − s)Yt
Yt = (78)
L 1−L

⇐⇒ (1 − L)(1 − α) = L(1 − s) (79)

which implies that:


1−α
L= (80)
2−s−α

2.3 Labor Supply and Productivity Growth


Total hours per working-age person are defined as:

hE
(81)
P

where h represents average hours worked per worker, P is the working-age population, and
E/P is the employment rate.21 Changes in total hours worked reflect adjustments on both the
extensive margin (fluctuations in the employment rate) and the intensive margin (variations
in average hours worked per employed person).
In the data, changes in hours per worker tend to be more pronounced than those in la-
bor force participation. In particular, average hours worked per worker have steadily

20
R1 R1
If agents are indexed by i ∈ [0, 1] and ∀i, li = l, yi,t = yt , then L = 0 li di = l and Yt = 0 yi,t di = yt .
21
Notice that population aging changes the ratio of working-age adults to the total population, a non-trivial
issue faced by many advanced economies today (see Data Appendix C.2).

18
declined in high-income countries (see Data Appendix C.4.1). This decline has gen-
erally followed a consistent rate over long periods, typically between -0.3% and -0.5% per
year, though subject to short-term cyclical variations.22 Therefore, a clear empirical pattern
emerges: richer countries tend to have lower average working hours. As economies grow
steadily, hours worked gradually decline at a slow yet persistent pace.
At the same time, labor productivity has been steadily increasing over long periods. This
long-term productivity growth generates two opposing effects on labor supply:

• Income effect: Higher productivity (and thus higher wages) raises income, leading
individuals to consume more leisure and reduce hours worked.

• Substitution effect: Higher wages increase the opportunity cost of leisure, incentiviz-
ing more work.

As explained, empirical evidence suggests that the income effect slightly outweighs the
substitution effect, leading to a slow but persistent decline in hours worked. This observation
raises a key theoretical question: Is there a utility function that allows consumers to optimally
choose a BGP, where consumption grows at a constant rate while hours worked steadily
decline, given continuous labor productivity growth?

2.3.1 MaCurdy Utility Function

There exists a broader class of KPR preferences allow for a BGP in which hours worked can
change at a constant rate over time.
The standard KPR period utility function takes the form:

(c · v(h))1−σ − 1
u(c, h) = (82)
1−σ

where v(·) is an arbitrary decreasing function. One special case of KPR is:
1
h1+ θ
u(c, h) = log c − ψ (83)
1 + 1θ

1+ 1
 
which follows by setting σ = 1 and v(h) = exp −ψ h1+ 1θ . However, this KPR class does
θ
not allow for hours worked to decline at a constant rate along a BGP. This limitation arises
because standard KPR preferences impose restrictions that prevent the necessary long-run
income and substitution effects from generating a sustained decline in hours worked.

22
At this rate, the number of hours worked per worker halves approximately every 175 years.

19
Contrarily, the MaCurdy (1981) utility function generalizes the standard KPR logarithmic
case by allowing for different curvatures in consumption and labor disutility:

1
c1−σ − 1 h1+ θ
u(c, h) = −ψ (84)
1−σ 1 + 1θ

This formulation is consistent with balanced growth while permitting hours worked to
decline at a constant rate!
Proof: Using the labor-supply equation (59) for the MaCurdy utility, we have that:

−uh (ct , ht ) = wt uc (ct , ht ) , ∀t (85)

That is:
1
ψhtθ = wt c−σ
t , ∀t (86)

Therefore: !1 −σ
ht+1 θ
wt+1 ct+1
 
= , ∀t (87)
ht wt ct
Now, suppose that wages grow at a constant rate γ > 1, consumption at rate γc , and
hours per worker at rate γh , all in gross terms. Then, for the FOC (87) to hold at all points
in time we need:
1
γhθ = γγc−σ (88)

Moreover, we know from the firm’s problem that yt = wt ht + rt kt . In addition, we require


yt to grow at a constant rate (Kaldor fact 1), the capital-output and consumption-output
ratios to remain constant (Kaldor facts 2 and 3), and the real interest rate to be constant as
well (Kaldor fact 5). Accordingly, these conditions hold if and only if the labor income wt ht
and consumption ct (and yt and kt ) grow at the same rate. Thus, we impose the following
condition:
wt+1 ht+1 ct+1
= (89)
wt ht ct
That is:
γγh = γc (90)

Therefore, plugging this condition into equation (88):


1
γhθ = γ(γγh )−σ (91)

20
Rearranging:
1 θ(1−σ)

γhθ = γ 1−σ =⇒ γh = γ 1+θσ (92)

Thus:
γh = γ −ν , γc = γ 1−ν (93)

where ν = θ(σ−1)
1+θσ
. Accordingly, hours per worker will fall over time if σ > 1, and will be
constant if σ = 1. In the former case, we say that the income effect of higher wages is larger
than the substitution effect, while in the latter case, the income and substitution effects
exactly offset each other. Standard KPR preferences correspond to ν = 0, meaning that
labor supply remains constant over time regardless of productivity growth.
ν can be seen as the fraction of a one-percentage-point productivity gain that the represen-
tative household chooses to convert into more leisure as opposed to into more consumption,
along the BGP.

Estimating ν:

In the data productivity and hours grow annually at, say, 2% and -0.4%, respectively. Using
these numbers, would obtain an estimate of ν from .996 = 1.02−ν of ν = .2. With ν = .2
γ = 1.02, the 0.4% fall in hours per year makes per capita consumption grow by 1.6% in the
long run: γ 1−ν = 1.021−.2 = 1.016.

Intuition:

This framework helps explain long-run trends in labor supply. In advanced economies, hours
worked per worker have been gradually declining over time, which aligns with the idea that
the income effect of rising wages is slightly stronger than the substitution effect.
From a macroeconomic perspective, key aggregates like output, investment, and consump-
tion all grow at the gross rate γ 1−ν > 1, which is lower than productivity growth if ν > 0 (i.e.
σ > 1). This implies that part of the productivity gains are absorbed as increased leisure
rather than being fully translated into output growth.
Falling hours worked is not a sign of economic weakness, but rather a natural and expected
outcome of growth under certain preferences. It reflects that as economies develop, people
choose to work less while maintaining rising living standards. Joint output and leisure growth
is what we should expect.
See that this fact illustrates clearly how output growth is an incomplete measure of
improved welfare over time in the development context, in line with Jones and Klenow (2016).
Interestingly, our theory says that growth theory should probably not abstract from labor
supply, which is typically set to “1” in models.

21
2.4 Cross-Country Income Per-Capita Comparisons (additional)
Why are some countries so much richer than others, in terms of GDP per capita? Models
can guide us to explain differences in incomes across countries. Let’s start with a very simple
production function and then build up on it:

Y
Y = ĀK̄ 1/3 L̄2/3 =⇒ y= = Āk̄ 1/3 (94)

It is clear from the above equation that differences in per-capita output will come either
from differences in TFP Ā and/or capital per-capita k̄.

Hypothesis 1: Differences in k alone are sufficient to explain differences in GDP


per capita across countries
1/3
Normalize Ā = 1 for the US, so that yUS = k̄US . What would happen if, given their observed
capital per person k̄ levels, all countries had Ā = 1 like the US? The answer is given in the
table below.

With Ā = 1 for all countries, the model significantly overpredicts y in almost all non-US
countries, given their levels of physical capital per capita. This discrepancy arises because,
according to the model, countries with low k (e.g. Burundi) would have a high M P K, while
countries with abundant k (e.g. the US) would have a low M P K. However, a simple pro-
duction model assuming no productivity differences across countries is, clearly, inadequate.

22
Hypothesis 2: Differences in Ā are key

TFP Ā captures the portion of economic growth that cannot be explained by increases in
labor and capital inputs. In essence, TFP measures the “unexplained” or residual growth,
reflecting how effectively an economy uses its resources. It accounts for the impact of inno-
vations, technological advancements, and other factors on overall productivity and economic
performance.
We can calculate implied TFP Ā for each country because we have data on output and
capital per person, as illustrated in the table below:

A lower level of implied TFP indicates that workers produce less output for any given
level of capital per person. Similarly, there is a strong positive correlation between GDP per
capita and implied TFP:

23
Rich countries are wealthier because they are likely able to use inputs more efficiently. On
the other hand, differences in capital per capita account for roughly one-fourth of the income
disparity, while TFP differences explain the remaining three-fourths. Thus, rich countries
are not only rich due to higher levels of capital per person but, more importantly, because
they use labor and capital more efficiently.
For instance, if China’s TFP were the same as that of the US, we would expect its per-
capita income to be approximately 65% of the US level. However, China’s actual income is
only 28% of the US level:

The model suggests that this lower income can be attributed to China’s TFP being just 43%
of the US level. Even if China had the same amount of capital per person as the US, its
per-capita income would still be expected to reach only 43% of the US level. Thus, according
to this very simple model, TFP Ā is a critical factor in explaining cross-country differences
in income per capita.

Hypothesis 3: Differences in TFP across countries can be explained by workers


having different quantities of human capital

Suppose human capital of person i, here denoted by hi ,23 is defined by:

hi = B · 1.07si (95)

where B > 0 is a constant and si is years of education. Intuitively, one more year in school
increases human capital by 7%.

23
We can think of human capital as the stock of skills individuals accumulate to become more efficient.

24
Let li denote the number of hours worked by person i. Then, we can define the following
aggregate Cobb-Douglas production function:
!1−α
Y = F (A, K, H) = AK H α 1−α
= AK α
(96)
X
hi li
i

Assuming all workers have the same amount of education, hi = h for all i:

Y = AK α (hL)1−α and y = Ak α h1−α (97)

Thus, we can compare GDP per capita in a rich country r and a poor country p using the
following ratio:
!α !1−α
yr Ar kr hr
= (98)
yp Ap kp hp

For example, suppose the average number of years an American spends in school is 13, while
in the poorest countries, the average is around 4. Accordingly, for α = 1/3:
!1−α !2/3
hr B1.0713  2/3
= = 1.079 = 1.5 (99)
hp B1.074

That is, human capital alone would predict the US GDP to be 1.5 times higher than that of
the poorest countries. Yet, US per capita GDP is 64 times higher than that of the poorest
countries. Thus, in this model, differences in TFP still explain a large part of differences in
per-capita income!
Taking logs of equation (98), we obtain a decomposition of the sources of (percent) income
differences between rich and poor countries:

log yr − log yp = (log Ar − log Ap ) + α (log kr − log kp ) + (1 − α) (log hr − log hp ) (100)

Hypothesis 4: Technological progress is human-capital-augmenting

Assume now that the total stock of human capital, Ht , grows at a constant rate of γ (i.e.
Ht = γ t hL). Our production function (97) becomes:
 1−α  1−α
Yt = AKtα γ t hL and yt = Aktα γ t h (101)

25
In addition, assume that people save a constant fraction s of their income, so that the law
of motion for capital is given by:
 1−α
Kt+1 = (1 − δ)Kt + sAKtα γ t hL (102)

Dividing both sides by γ t :

γ K̂t+1 = (1 − δ)K̂t + sAK̂tα (hL)1−α (103)

where K̂t = Kt /γ t . Therefore, in steady state:


! 1
sA 1−α
K̂ss = hL (104)
γ+δ−1
1
(BGP )
γ t K̂ss
!
(BGP ) Kt sA 1−α
=⇒ kt = = = hγ t (105)
L L γ+δ−1
Therefore, assuming that γ and δ are the same for rich and poor countries:

! 1 ! 1
kr(BGP ) sr 1−α
Ar 1−α
hr
(BGP )
= (106)
kp sp Ap hp

Accordingly, differences in capital themselves are also explained by differences in TFP. Sim-
ilarly, the long-run (or BGP) output per capita yt converges to:

! α
(BGP ) 1 s 1−α
yt =A 1−α hγ t (107)
δ+γ−1

Notice that differences in the savings rate now account for part of the variation in per
capita GDP, but the effect of TFP remains substantial. However, the model does not explain
why countries have different levels of TFP. Instead, TFP is taken as given and is often referred
to as “the residual” or “a measure of our ignorance”. In this sense, the neoclassical growth
theory explains everything except growth itself.
What does TFP encompass? It includes factors like technology (e.g. the implementation
of AI), institutions (e.g. property rights, rule of law, government systems, and contract
enforcement), minimal misallocation (i.e. ensuring resources are used in the most efficient
ways possible), etc.

26
3 Business Cycles
3.1 Trends and Cycles
Business cycles are economy-wide fluctuations in production, economic activity, and other
aggregate variables, often measured from the start of one recession to the start of the next.24
Some authors also define business cycles as the fluctuations occurring between two consecutive
economic peaks.
Any time series {yt } can be decomposed into two components:

• Trend: The part of {yt } that can be explained by long-run growth factors.

• Cycle: The deviations of {yt } from its trend.

Let Yt∗ denote the trend of real GDP. To illustrate, panel (a) of the following figure shows
the log of US real GDP (ln Yt ) along its trend (ln Yt∗ ), over time. Panel (b), on the other hand,
shows the detrended series ln Yt − ln Yt∗ ≈ Yt /Yt∗ − 1, sometimes denoted as Yet , representing
the percent deviation of real GDP from its trend, i.e. the cycle:25
10.2 0.04

10
0.02
9.8
0
Detrended Log GDP

9.6
Log Values

9.4 -0.02

9.2 -0.04

9
-0.06
8.8
-0.08
8.6 Log GDP
Trend
8.4 -0.1
1970 1980 1990 2000 2010 2020 1970 1980 1990 2000 2010 2020
Date Date

(a) Log GDP (ln Yt ) and its Trend (ln Yt∗ ) (b) Cycle (Yet = ln Yt − ln Yt∗ )

Different estimates of a trend will produce different estimates of cycles. But what prop-
erties should a cyclical variable exhibit?

1. Its average value should be close to zero over any reasonably long sub-sample, as shown
in panel.
24
An economy is typically considered to be in a recession when the growth rate of real GDP is negative
for two consecutive quarters.
25
Refer to Math Appendix A.6 for an explanation of the relationship between growth rates and log-
differences.

27
2. It should cross the x-axis (zero) relatively frequently.

Both of these features are clearly met in panel (b).


Regarding the trend, defining it as a straight line does not produce cycles that meet these
two criteria. A widely used tool in macroeconomics to ensure the estimated cyclical variables
satisfy these properties is the Hodrick-Prescott (HP) filter, as shown in panel (a).

3.1.1 HP-Filter

For a given choice of the parameter λ, the H-P filter estimates the trend {Yt∗ } of a time series
{yt } by minimizing the following expression:

 

 T
X TX−1   
∗ 2
{yt∗ }Tt=1 = argmin  (ln yt − ln yt ) +λ
∗ 2
∆ ln yt+1 − ∆ ln yt 

(108)


t=1 t=2 
| {z } | {z }
trend fit trend smoothness

where ∆ ln yt∗ ≡ ln yt∗ − ln yt−1



. Intuitively, the first term ensures that the trend ln yt∗ closely
follows the series ln yt . The second term accounts for changes in growth rates (we want a
smooth trend), and λ determines the penalty assigned to those deviations.
For example, if λ = 0, no smoothness is applied. The solution to (108) is ln yt∗ = ln yt ,
which yields a non-informative trend, as no filtering is required to obtain this trend estimate.
On the other hand, if λ → ∞, the extracted trend ln yt∗ becomes linear, with ∆ ln yt+1 ∗
=
∆ ln yt .

As λ < ∞ increases, the trend becomes smoother, leading to larger deviations from the
trend. In other words, the cyclical component moves further away from the actual data,
causing the estimated cycle to become more volatile.
Commonly accepted values for λ are λ = 14, 400 for monthly data, λ = 1, 600 for quarterly
data, and λ = 100 for annual data.

3.1.2 Comovements

Macroeconomic variables fluctuate together in patterns that exhibit strong regularities –


these patterns are called comovements.
To study the comovements between two macroeconomic time series, we transform the two
time series by removing trends, so we are left with the percentage deviations from trend of
the two time series.

28
A macroeconomic variable yt can be classified into one of the following categories based
on its deviations from its trend:

• Procyclical: Their deviation from the trend is positively correlated with the deviation
of GDP from its trend.

• Countercyclical: Their deviation from the trend is negatively correlated with the
deviation of GDP from its trend.

• Acyclical: Neither procyclical nor countercyclical.

Additionally, macroeconomic variables can be classified based on their relationship with real
GDP into:

• Leading: : The variable yt helps predict future movements in real GDP. In particular,
if yt is a leading variable, we expect:

|cor (yt−1 , GDPt )| > |cor (yt , GDPt )|

• Lagging: Real GDP tends to predict future movements of the variable yt . If yt is a


lagging variable, we expect:

|cor (yt , GDPt )| < |cor (yt+1 , GDPt )|

• Coincident: The variable neither leads nor lags real GDP.

Consumption is procyclical and coincident, even though less volatile than GDP. Investment is
is procyclical and coincident as well, but more volatile than GDP. Employment is procyclical
and lagging (see Data Appendix C.5). Finally, government spending is countercyclical26 and
leading.

3.2 The Real Business Cycle Model


The theory of Real Business Cycles (RBC) tries to understand what causes real GDP to
deviate from its trend and what are the consequences of it.

26
Governments usually apply countercyclical policy to generate “automatic stabilizers” that accommodate
shocks to short-run output. These stabilizers align with consumers’ preference to smooth consumption and
avoid large fluctuations in income.

29
3.2.1 A Simple RBC Model

We will study a simple version of the Kydland and Prescott (1982) model that builds on a
stochastic version of the Solow growth model, where consumers choose how much they want
to consume and how much labor they want to supply. Moreover, TFP, here denoted by zt ,
will follow a stochastic AR(1) process:

log zt = ρ log zt−1 + ϵt (109)

iid
where ρ ∈ (0, 1) indicates the degree of persistence of technology shocks, and ϵt ∼ N (0, σ 2 ).
Technology shocks are deviations of technology level from its trend caused by e.g.
good/bad weather, tech innovations, changes in government regulation, changes in energy
prices, etc. and work as the main cause of business cycle phenomenon in the RBC model.

Environment:

• Perfect competition.

• No technology or population growth.

• Discrete infinite time t ∈ {1, 2, . . .}.

• One good, used for consumption and investment, denoted as x:

y t = ct + x t (110)

• Production function:
yt = zt ktα lt1−α (111)

• Law of motion for capital:


kt+1 = (1 − δ)kt + xt (112)

Consumer’s Problem

A representative consumer maximizes lifetime utility subject to their budget constraint (ct +
xt = rt kt + wt lt ):

max β t u (ct , 1 − lt )
X
E0
{ct ,lt ,kt+1 }∞
t=0 t=0 (113)
s.t. ct + kt+1 = rt kt + wt lt + (1 − δ)kt ∀t

30
The solution of which yields the usual Euler and labor-supply equations (58) and (59):

uc (ct , 1 − lt ) = βEt uc (ct+1 , 1 − lt+1 ) Rt+1 (114)

u1−l (ct , 1 − lt ) = wt uc (ct , 1 − lt ) (115)

Firm’s Problem

Firms face a static profit maximization problem each period, with no uncertainty, as they
make their decisions after observing the realization of zt :

max zt ktα lt1−α − rt kt − wt lt (116)


kt ,lt

The corresponding FOCs for capital and labor are:

yt
rt = Fk (zt , kt , lt ) = αzt ktα−1 lt1−α = α (117)
kt
yt
wt = Fl (zt , kt , lt ) = (1 − α)zt ktα lt−α = (1 − α) (118)
lt
As a result of CRS and perfect competition, firms make zero profits in equilibrium, and all
the income in the economy goes to pay for the factor inputs. This result can be proved by
simply combining equations (117) and (118):

yt = rt kt + wt lt (119)

Equilibrium

Given z0 , k0 , and the exogenous realizations {ϵt }∞ t=0 , the equilibrium is defined by a set of
allocations {zt+1 , kt+1 , ct , lt , yt , xt }t=0 and prices {rt , wt }∞

t=0 satisfying the equilibrium condi-
tions:

1. Euler equation: uc (ct , 1 − lt ) = βEt uc (ct+1 , 1 − lt+1 ) (1 − δ + rt+1 )

2. Labor-supply: u1−l (ct , 1 − lt ) = wt uc (ct , 1 − lt )

3. FOC for capital: rt = α kytt

4. FOC for labor: wt = (1 − α) yltt

5. Goods market clearing: y t = ct + x t

6. Law of motion for capital: kt+1 = (1 − δ)kt + xt

31
7. Law of motion for TFP: log zt = ρ log zt−1 + ϵt

8. Production function: yt = zt ktα lt1−α

3.2.2 Recursive Analysis

Kydland and Prescott solved the social planner’s problem using recursive analysis, where
equilibrium processes are expressed as functions of the economy’s state variables.
State variables describe the system’s current condition (or state) when agents make their
decisions, and evolve over time. Notice that, in period t, there are two state variables: kt
and zt .

Bellman Equation

Suppose we solve the consumer’s problem and get the optimal plan {c∗t , lt∗ , kt+1

t=0 given
}∞
some (k0 , z0 ). Then, we can define the value function denoting the value of the maximized
objective starting with the initial conditions (k0 , z0 ) as:

V (k0 , z0 ) = β t u(c∗t , 1 − lt∗ ) (120)
X

t=0

Similarly, V (k1 , z1 ) denotes the value of the (maximized) utility from period 1 onwards
that can be obtained with the beginning-of-period conditions (k1 , z1 ). Therefore, taking
condition (119) from the firm’s problem as given, the consumer’s problem in period 0 can be
written as:
max u(c0 , 1 − l0 ) + βV (k1 , z1 )
c0 ,l0 ,k1

s.t. c0 + k1 = z0 k0α l01−α +(1 − δ)k0 [B.C.] (121)


| {z }
y0

log z1 = ρ log z0 + ϵ1 [law of motion for TFP]


See that as we have defined V (k0 , z0 ) as the maximized objective function for the house-
hold problem, it must satisfy the following:
   

V (k0 , z0 ) = max  α 1−α


u z0 k0 l0

+ (1 − δ)k0 − k1 , 1 − l0 
 + βE0 V (k1 , |e {z0 1})
ρ log z +ϵ 
(122)
l0 ,k1 | {z }
c0 z1

where we allow for uncertainty regarding the value of ϵ1 , and hence the expectation operator
E in front of the next period’s value function.

32
Since the problem is the same each period, we can drop the subscripts and simply write:


h   i
V (k, z) = max

u zk α l1−α + (1 − δ)k − k ′ , 1 − l + βEV (k ′ , eρ log z+ϵ ) (123)
l,k

where the symbols ′ indicate next period values. Using the usual isoelastic utility form
within the KPR preferences, given by equation (65), the consumer’s problem can be written
in recursive formulation as:
 
 [(zk α l1−α 1−σ
+ (1 − δ)k − k ′ ) · v(1 − l)] −1 ρ log z+ϵ′

V (k, z) = max + βEV (k ′ , |e {z }) (124)
′  l,k 1−σ 
z′

for all (k, z). Accordingly, this problem yields two decision rules (or policy functions), denoted
by g(·) and h(·), which map the state variables (k, z) to the optimal choices of the endogenous
variables (k ′ , l):

k ′ = g(k, z) (125)
l = h(k, z) (126)

If we define φ(l, k, k ′ ) := [zk α l1−α + (1 − δ)k − k ′ ] v(1 − l), we can express equation (124)
more compactly, focusing on the terms that depend on the control variables (l, k ′ ):

φ(l, k, k ′ )1−σ − 1 φ(l′ , k ′ , k ′′ )1−σ − 1


( " #)
V (k, z) = max + βE + ... (127)
l,k′ 1−σ 1−σ

Therefore, the FOC for k ′ is:

φ(l, k, k ′ )−σ (−1)v(1 − l)+


n h i o (128)
βE φ(l′ , k ′ , k ′′ )−σ αz ′ (k ′ )α−1 (l′ )1−α + 1 − δ v(1 − l′ ) = 0

That is:
h i−σ
zk α l1−α + (1 − δ)k − k ′ v(1 − l)1−σ =
h i−σ h i (129)
βE z ′ (k ′ )α (l′ )1−α + (1 − δ)k ′ − (k ′′ ) v(1 − l′ )1−σ αz ′ (k ′ )α−1 (l′ )1−α + 1 − δ

Similarly, using the product rule, the FOC for l is:


n h i o
(l, k, k ′ )−σ (1 − α)zk α l−α v(1 − l) + zk α l1−α + (1 − δ)k − k ′ vl (1 − l) = 0 (130)

33
That is:
h i
− zk α l1−α + (1 − δ)k − k ′ vl (1 − l) = (1 − α)zk α l−α v(1 − l) (131)

Equivalently:27
h i
zk α l1−α + (1 − δ)k − k ′ v1−l (1 − l) = (1 − α)zk α l−α v(1 − l) (132)

Thus, plugging the policy functions into the FOCs (129) and (132), we obtain the following
functional equations:
h i−σ
zk α h(k, z)1−α + (1 − δ)k − g(k, z) v(1 − h(k, z))1−σ =
h i−σ
βE z ′ g(k, z)α h(g(k, z), z ′ )1−α + (1 − δ)g(k, z) − g(g(k, z), z ′ ) (133)
h io
v(1 − h(g(k, z), z ′ ))1−σ αz ′ (g(k, z))α−1 h(g(k, z), z ′ )1−α + 1 − δ

h i
zk α h(k, z)1−α + (1 − δ)k − g(k, z) v ′ (1 − h(k, z)) =
(134)
v(1 − h(k, z))(1 − α)zk α h(k, z)−α

It is not possible to find explicit forms for the two unknown functions g(k, z) and h(k, z).
Instead, we need to rely on numerical methods to approximate the policy functions.28

Linearization

The above functional equations describe a nonlinear dynamic system of equations. To solve
it, we will use a local method called Perturbation, a generalization of the log-linearization
method used to solve stochastic differentiable models. This approach replaces the dynamic
equations with first-order (linear) Taylor approximations in the logarithms of the variables
around the deterministic steady state.29

27
Remember that, as lt = 1 − (1 − lt ), we have that ul (ct , 1 − lt ) = ∂u(·)/∂lt = −∂u(·)/∂[1 − lt ] =
−u1−l (ct , 1 − lt ).
28
In a very special case of the model, however, it is possible to obtain a full analytical characterization
of the equilibrium. This occurs when u(c, 1 − l) = (1 − ϕ) log c + ϕ log(1 − l) and δ = 1. In that case, labor
(1−ϕ)(1−α)
supply is constant l = h(k, z) = ¯l = ϕ(1−αβ)+(1−ϕ)(1−α) , and capital next period equals investment, given by
′ α ¯1−α
a constant fraction of output: k = g(k, z) = αβzk l . Nevertheless, this special case is not of interest
from a business-cycle perspective.
29
Refer to Math Appendix A.1.4 and A.1.5 for an overview of Taylor’s Theorem and log-linearization.
Local numerical methods, such as the Perturbation method, approximate models around a focal point (e.g.
the steady state). One implication is that these local methods struggle to accurately handle substantial
deviations from this focal point (e.g. large shocks).

34
The procedure to approximate these functions involves two steps:
1. Solve for the steady state, which delivers the steady-state values k̄ and ¯l.30

2. Find an approximation to the policy functions around the steady state (first-order
Taylor approximation):

g(k, z) ≈ g(k̄, z̄) + gk (k̄, z̄) · (k − k̄) + gz (k̄, z̄) · (z − z̄) (135)

h(k, z) ≈ h(k̄, z̄) + hk (k̄, z̄) · (k − k̄) + hz (k̄, z̄) · (z − z̄) (136)

That is:
k ′ ≈ k̄ + gk · (k − k̄) + gz · (z − 1) (137)

l ≈ ¯l + hk · (k − k̄) + hz · (z − 1) (138)

where gk = gk (k̄, z̄) and hk = hk (k̄, z̄). Finally, to obtain (gk , gz , hk , hz ), we need to
take derivatives of the two functional equations (133) and (134), one with respect to k,
and one with respect to z, thus delivering four equations. Then, we evaluate at steady
state to solve for the slopes of the decision rules at the steady state.

Log-Linearization

Remember that we aim to study business-cycle fluctuations. Therefore, we want to express


variables as percent deviations from their trends. In this model, the trend is given by the
deterministic steady state. Hence, we will express the variables as percent deviations from
their steady-state values:
k − k̄
k̃ := (139)

Then:
k
= 1 + k̃ (140)

Dividing both sides of (137) by k̄:

k′ (k − k̄) (z − 1)
≈ 1 + gk + gz (141)
k̄ k̄ k̄

Therefore, plugging (140), we obtain:

gz
k̃ ′ ≈ gk k̃ + z̃ (142)

30
The steady-state value for z is solved from its law of motion (109) with ϵ̄ = 0, so log z̄ = 0; i.e. z̄ = 1.

35
Similarly:

˜l ≈ k̄ hk k̃ + hz z̃ (143)
¯l ¯l

Alternatively, we can log-linearize the policy functions, k ′ = g(k, z) and l = h(k, z),
∗ ∗ ∗ ∗ ∗ ∗
directly, as shown in Appendix A.1.5. Using the rule f^ (x, y) = fxf(x(x∗,y,y∗)x) xe + fyf(x(x∗,y,y∗)y) ye, for
any (x, y) ≈ (x∗ , y ∗ ), it follows directly that:

gk k̄ gz z̄
k̃ ′ ≈ k̃ + z̃ (144)
k̄ k̄

˜l ≈ hk k̄ k̃ + hz z̄ z̃ (145)
¯l ¯l
where z̄ = 1.

3.2.3 Numerical Model Solving

Remember our estimation problem: given z0 , k0 , and the exogenous realizations {ϵt }∞ t=0 , the

t=0 and prices {rt , wt }t=0


equilibrium is defined by a set of allocations {zt+1 , kt+1 , ct , lt , yt , xt }∞ ∞

satisfying 8 equilibrium conditions: the Euler condition, labor-supply equation, FOCs for
capital and labor, goods market clearing, laws of motion for capital and TFP, and the pro-
duction function. Thus, the problem involves solving a system of 8 unknowns and 8 equations,
for each period.
Appendix B.2.2 shows how to solve the RBC model for the utility function u(ct , 1 − lt ) =
(1 − ϕ) log ct + ϕ log(1 − lt ) using DYNARE and a first-order perturbation.
DYNARE is a software platform designed to handle a broad range of nonlinear models
with forward-looking variables under rational expectations, such as DSGE and OLG models.
DYNARE solves DSGE models in two steps. First, it computes the steady-state equilib-
rium, assuming certainty (i.e. no TFP shocks). Second, it approximates the policy functions
around this steady state using the (local) Perturbation method described earlier.

3.2.4 Calibration

Calibration is a way of selecting values for the model’s parameters. It requires that values
for parameters be selected from sources independent of the phenomenon under study. We
will use the following parameter values in this example: (ϕ, α, δ, ρ, β) = (.7, .32, .025, .95, .9).
But how does one select those values from the data?
Suppose we aim to calibrate the values of the technology parameters, (ρ, σ 2 ). Solow

36
growth accounting defines technological change as: gz = gy − αgk − (1 − α)gl .31 We can
directly measure the growth rates gy , gk , and gl using available data. By computing the
Solow residual, gz , we construct the raw series for the productivity shock, zt , in levels.
Taking the logarithm of this series and applying the HP filter yields a series of percentage
deviations from the trend, denoted as z̃. To estimate the AR(1) process for z̃, we assume
z̃t+1 = ρz̃t + ϵt+1 . We determine ρ by matching it to the first-order autocorrelation of z̃ and
set the variance of ϵ, σ 2 , to match the variance of the residuals in the estimated equation.
Once all parameter values are assigned, the model is fully specified and can be solved nu-
merically. A random number generator is then used to simulate realizations of the stochastic
shock.

3.2.5 Impulse Response Functions

Impulse response functions (IRFs) are used to analyze how the economy responds over time
to exogenous shocks, such as technology shocks. These functions trace the dynamic effects
of a temporary or permanent single shock on key macroeconomic variables like output, con-
sumption, investment, and labor supply. They help analyze shock propagation, persistence,
and the economy’s adjustment back to equilibrium:
Productivity Real Wage
Deviation (%)

Deviation (%)

1 1

0.5 0.5

0 0
0 20 40 60 80 100 0 20 40 60 80 100
Interest Rate Labor
Deviation (%)

Deviation (%)

1 0.4
0.5 0.2
0 0
0 20 40 60 80 100 0 20 40 60 80 100
Consumption Investment
Deviation (%)

Deviation (%)

1
10
0.5 5

0 0
0 20 40 60 80 100 0 20 40 60 80 100
Capital Output
Deviation (%)

Deviation (%)

1
1
0.5 0.5

0 0
0 20 40 60 80 100 0 20 40 60 80 100
t t

31
Refer to Math Appendix A.6.1 for an overview of growth rate properties.

37
How do technology shocks translate into output movements in this model? A positive
technology shock in period t represents a higher-than-average TFP. The figure above plots
the IRFs for a 1% shock to zt (or a one-percent technology shock).
Higher productivity rises wages, so labor supply in period t increases as workers find
work more profitable than leisure. Period-t output rises through the direct effect of higher
productivity and the indirect effect of higher labor input. The return to capital (and thus
the interest rate) increases as well, but the capital stock in period t is predetermined.
The boost in period-t output has dynamic consequences. Part of the increase in output is
consumed, while the remainder is saved and invested: As savings rise so does investment.32
Moreover, the less quickly the productivity shock dies out (i.e. the higher the productivity
shock persistence, ρ), the more profitable it will be to save and invest. That is, the investment
response to a current shock is higher than if technology growth were uncorrelated over time.
This raises the capital stock in periods t > 1 while technology is still above trend due to
autocorrelation, ρ. These dynamic effects constitute the model’s “propagation mechanism”,
where an “impulse” of a temporary technology shock shapes the path of future macroeconomic
variables.

3.2.6 Quantitative Evaluation

Given the functions g(·) and h(·), output and other variables of interest can be simulated
by selecting an initial capital stock. This process generates a time series for each variable,
forming the researcher’s “data set”. Sample second moments of these variables are then
computed and compared to actual data.33
Performing this exercise reveals that the variation in output predicted by the model is
somewhat lower than that observed in US data, though the discrepancy is not large. This
may be because the RBC model captures only a specific type of shock: the TFP shock.
Moreover, the model successfully replicates the volatility of investment and real wages
relative to output. Similarly, the correlations between consumption and output, as well as
between investment and output, closely resemble those observed in the data.
However, the model struggles to match the observed volatility of consumption and worker

32
However, investment volatility is notably higher. To illustrate this point, consider that I/K = 4%,
where, for instance, I = 4 and K = 100. Now, assume a marginal change in the desired capital stock of 1%
(a relatively modest adjustment from 100 to 101). In response to this, I must undergo a more substantial
change, increasing from 4 units to 5 units. This implies a 25% increase in I.
33
As the particular moments that we are interested in are those of the cyclical components of the macroe-
conomic series (and not of the entire macro series), we should follow the standard practice and report the
results for the filtered data. In particular, identify the cyclical component of the data by using the HP filter.
The empirical evaluation of the model is then conducted by comparing the moments of the (filtered) artificial
data to the (filtered) actual data.

38
hours. In particular, the variation in hours worked in the model is less than half of that in
the data. This discrepancy arises primarily from fluctuations in the number of employed
workers in the data. The simple model presented here focuses on variations in hours worked
per worker (the intensive margin) while abstracting from changes in labor-force participation
and unemployment (the extensive margin). In reality, most people either work full time or
not at all. One potential way to address this issue is by introducing indivisible labor into the
model.34
Overall, the RBC model presented here is quite specialized, yet it serves as the foundation
for modern macroeconomic models. While this model includes only technology shocks, more
advanced models incorporate a variety of other shocks, such as monetary shocks, fiscal policy
shocks, and demand shocks. Additionally, the current model assumes perfectly functioning
markets, whereas contemporary models introduce various frictions—such as imperfections in
credit and labor markets—to better reflect real-world economic dynamics.

3.2.7 Higher-Order Perturbations (additional)

In a first-order perturbation, what matters is the size of the shock, but not its variance (i.e.,
uncertainty does not matter). To introduce uncertainty, we need to solve for ≥ 2-order ap-
proximations. Since our equilibrium conditions reflect the FOCs of all agents in the economy,
neglecting higher-order expansions effectively assumes that marginal utilities are linear (i.e.
that u′ (·) is a linear function). This implies certainty equivalence (i.e. risk neutrality, which
corresponds to σ → 0 in our typical iso-eleastic utility function, or whenever the utility
function is quadratic). However, the isoelastic utility function, for instance, exhibits convex
marginal utility (i.e. u′′′ (·) > 0) for any σ > 0.
However, far from the approximation point, higher-order perturbations may actually per-
form worse than a linear approximation. In particular, the perturbation solution may ex-
hibit a different shape than the true policy function. This can lead to simulations that
explode—not due to an error, but as a theoretical property of the approximation method.
For example, suppose we want to approximate the “true”‘ policy function xt = 1 +
α log xt−1 . In steady state, x̄ = 1. Further, the first-order (linear) Taylor approximation of
the equation is xt = 1+α(xt−1 −1). Similarly, the second- and third-order approximations are
xt = 1+α(xt−1 −1)−α/2(xt−1 −1)2 and xt = 1+α(xt−1 −1)−α/2(xt−1 −1)2 +α/3! (xt−1 −1)3 ,
respectively. Graphically:

34
For instance, suppose each individual either works a fixed amount of hours ¯l or 0. Let πt be the
probability of being employed. With a continuum [0, 1] of agents, the aggregate (average) hours worked
are given by: lt = πt ¯l. The consumer’s utility in period t is now given by: u(ct , 1 − lt ) = (1 − ϕ) log ct +
ϕπt log(1 − lt ). The model with indivisible labor generates larger fluctuations of aggregate hours worked.

39
To address this issue, Kim et al. (2008) proposed a practical correction to the nonlinear
state-space representation, ensuring the stability of approximations up to second order. This
technique, known as ’pruning,’ eliminates terms in the solution that could lead to instability.
In essence, higher-order terms are rewritten in relation to lower-order terms to ensure that
simulations remain stationary:

40
APPENDIX

A Mathematical Appendix
A.1 Differentiation
Derivatives characterize how functions change:

The derivative s′ (t), evaluated at a specific point t, provides the instantaneous rate of
change or “slope” of the function s(t) at that precise moment. For example, consider what
additional distance we will cover by walking for a small time interval dt, assuming t represents
the minutes we’ve already been traveling. In this scenario, we assume that dt is incredibly
tiny, less than a second, and we can express this concept as:

ds(t) s(t + dt) − s(t)


= (146)
dt | dt
{z }
dt→0

In the usual notation, the derivative of a function f : D → R at point x ∈ D, if it exists,


is given by:
df (x) f (x + h) − f (x)
f ′ (x) ≡ = lim (147)
dx h→0 h

41
A.1.1 Derivative Rules

Table A.1: Common Functions

Function f (x) Derivative f ′ (x)


a 0
ax a
xa axa−1
ax ax ln a
ln x 1/x
ex ex

Notes: a can be any real-valued constant, independent of the variable x.

Table A.2: Rules

Rule Name Function Derivative


- af (x) af ′ (x)
Sum/difference rule f (x) ± g(x) f ′ (x) ± g ′ (x)
Product rule f (x)g(x) f ′ (x)g(x) + f (x)g ′ (x)
f ′ (x)g(x)−f (x)g ′ (x)
Quotient rule f (x)
g(x) g(x)2

Chain rule f (g(x)) f ′ (g(x)) · g ′ (x)

Notes: a can be any real-valued constant, independent of the variable x.

xxx

A.1.2 L’Hôpital’s Rule

Let f (x) and g(x) be two real-valued functions twice continuously differentiable. Suppose
that either:
lim f (x) = lim g(x) = 0 or lim f (x) = lim g(x) = ±∞ (148)
x→a x→a x→a x→a

where a ∈ R is some constant. Imagine we are interested in the limit of the ratio, f (x)/g(x),
as x → a. L’Hôpital’s rule is:
f (x) f ′ (x)
lim = lim ′ (149)
x→a g(x) x→a g (x)

provided that the limit on the RHS exists. If the RHS still equals 0/0 or ±∞, we can apply
the rule again, until we get a result that is hopefully not and indeterminate form.

42
A.1.3 Higher-Order Derivatives
2
f ′′ (x) = d dx
f (x)
2 measures the rate of change of the slope f ′ (x) itself (i.e. the “slope of the
slope”). It gives us information about the curvature of the function: whether the slope is
increasing/decreasing.
To illustrate, the following plot shows the behavior of a concave function that reaches its
maximum value at x∗ . As the function approaches this maximum, it increases at a decreasing
rate until it reaches x∗ . Therefore, its first-order derivative f ′ (x) is positive, and its second-
order derivative f ′′ (x) is negative for all x < x∗ . Beyond x∗ , the first-order derivative becomes
zero, i.e. f ′ (x) = 0 for all x ≥ x∗ .

A.1.4 Taylor’s Theorem

Let f (x) be a real-valued univariate function. Taylor’s theorem says that we can approximate
this function around the point x∗ with a polynomial of degree n as follows:

df (x)
f (x) =f (x∗ ) + · (x − x∗ )
dx x∗
d f (x)
2
1
+ · (x − x∗ )2 ·
dx2 x∗
2!
d f (x)
3
1 (150)
+ · (x − x∗ )3 ·
dx3 x∗
3!
+ ...
dn f (x) 1
+ · (x − x∗ )n · + Rn
dxn x∗
n!

43
where (dn f (x)/dxn )|x∗ is the nth derivative of f (x) with respect to x evaluated at the point
x∗ , n! is the n factorial [n · (n − 1) · . . . · 2 · 1], and Rn is a residual.
The expression (150) with omitted residual Rn is the Taylor-series expansion of f (x)
around x∗ . The presence of Rn in the equation indicates that the Taylor expansion is not an
exact formula for f (x) but an approximation, which gets better as the value of n increases.
Intuitively, f (x∗ ) ensures the value of the polynomial matches with the value of f (x) at
x = x∗ , (df (x)/dx)|x∗ (x − x∗ ) ensures the slope of the polynomial matches the slope of f (x)
around x∗ , (d2 f (x)/dx2 )|x∗ (x − x∗ )2 /2! ensures the rate at which the slope changes is the
same around x∗ , (d3 f (x)/dx3 )|x∗ (x − x∗ )3 /3! provides the jerk, and so on. The factorials, n!,
cancel out the cascading effects of many power-rule applications. For example, dx2 /dx = 2x,
so we correct for 2 · 1 = 2!. Likewise, dx3 /dx = 3x2 , so we correct for 3 · 2 · 1 = 3!, etc.
If we use a polynomial of order 1 to approximate a function around a point x∗ , we say
that we linearize the function around x∗ . We can also log-linearize a function f (x) by using
a first-order Taylor expansion of log x around log x∗ .

Two-Dimensional First-Order Approximations:

Let f (x, y) be a twice continuously differentiable real-valued function. Then:

f (x, y) ≈ f (x∗ , y ∗ ) + fx (x∗ , y ∗ ) · (x − x∗ ) + fy (x∗ , y ∗ ) · (y − y ∗ ) (151)

The constant term f (x∗ , y ∗ ) represents the value of the function at the point (x∗ , y ∗ ). The
linear terms, fx (x∗ , y ∗ )(x − x∗ ) and fy (x∗ , y ∗ )(y − y ∗ ), correspond to the first-order partial
derivatives of f (x, y) evaluated at (x∗ , y ∗ ).
First-order approximations work well when (x, y) is close to (x∗ , y ∗ ).

A.1.5 Log-Linearization

Log-linearization is a method used to approximate nonlinear equations by expressing variables


as logarithmic deviations from some initial values (e.g. their steady-state values). This
transforms nonlinear relationships into linear ones. The process involves:

1. Taking the natural logarithm of variables.

2. Using a first-order Taylor expansion around a point of interest (e.g. the steady state).
∗ ∗
   
Suppose x ≈ x∗ and y ≈ y ∗ , and let xe := ln x − ln x∗ = ln xx∗ = ln 1 + x−x
x∗
≈ x−xx∗
denote the percent deviation from steady state x . Then, one can show that, for variables

(x, y) and a constant α:

44
1. αx
f =x
e

x∗ e y∗
2. x]
+y = x∗ +y ∗
x + x∗ +y ∗
ye

3. xy
f =x
e + ye

4. xfα = αxe
f ′ (x∗ )x∗
5. fg
(x) = f (x∗ )
xe

fx (x∗ ,y ∗ )x∗ fy (x∗ ,y ∗ )y ∗


6. f^
(x, y) = f (x∗ ,y ∗ )
xe + f (x∗ ,y ∗ )
ye

Below are some proofs:

• Proof of (2): Take logs: ln(x + y). Take a 1st-order Taylor expansion around the
steady state, as in (151):

1 1
ln(x + y) ≈ ln(x∗ + y ∗ ) + (x − x∗ ) + ∗ (y − y ∗ ) (152)
+y ∗ x∗ x + y∗
x∗ x − x∗ y∗ y − y∗
= ln(x∗ + y ∗ ) + ∗ + (153)
x + y ∗ x∗ x∗ + y ∗ y ∗
∗ ∗
x y
≈ ln(x∗ + y ∗ ) + ∗ xe + ∗ ye (154)
x +y ∗ x + y∗

x∗ e y∗
That is, x]
+ y = ln(x + y) − ln(x∗ + y ∗ ) ≈ x∗ +y ∗
x + x∗ +y ∗
ye □

• Proof of (5): Take logs and a 1st-order Taylor expansion around the steady state:

1
ln f (x) ≈ ln f (x∗ ) + f ′ (x∗ )(x − x∗ ) (155)
f (x∗ )
f ′ (x∗ ) ∗ x − x∗
= ln f (x∗ ) + x (156)
f (x∗ ) x∗

f ′ (x∗ )x∗
That is, fg
(x) = ln f (x) − ln f (x∗ ) ≈ f (x∗ )
xe □

xxx

A.2 Optimization
The maxima/minima of a real-valued function, if it exists, lies where the function neither
increases nor decreases. That is, at f ′ (x) = 0. Whether such a point represents a (local)
maximum or minimum is determined by the curvature of the function f (x) at that point,
denoted as f ′′ (x). If f ′′ (x) < 0 (concavity), then that point corresponds to a maximum.
Conversely, if f ′′ (x) > 0 (convexity), then it signifies a minimum.

45
A.2.1 Constrained Optimization: Equality Constraints

Suppose we want to find the maximum of the function f (x, y) : R2 → R subject to the
constraint that the chosen point lies along a plane generated by the restriction g(x, y) = a:

max f (x, y)
x,y
(157)
s.t. g(x, y) = a

We proceed by setting up the Lagrangian, L, as:

L(x, y, µ) = f (x, y) + µ [a − g(x, y)] (158)


| {z } |{z} | {z }
objective Lagrange rearranged
function multiplier constraint

Necessary First-Order Conditions (FOCs) for optimality:

∂L ∂L ∂L
= 0, = 0, =0 (159)
∂x ∂y ∂µ

Necessary Second-Order Conditions (SOCs) for optimality: If the Hessian matrix eval-
uated at the candidate points from the FOCs, (x∗ , y ∗ , µ∗ ), is negative-definite (positive-
definite), then we have found a local maximum (minimum).
 
∂2L ∂2L ∂2L
2
 ∂x ∂x∂y ∂x∂µ 
 ∂2L
 ∂y∂x ∂2L
∂y 2
∂2L 
∂y∂µ 
 (160)
 2
∂ L ∂2L ∂2L
∂µ∂x ∂µ∂y ∂µ2

xxx

Multiple Equality Constraints

Suppose we face m equality restrictions of the form

gi (x, y) = ai for i = 1, . . . , m

Then, the Lagrangian function will be written as:


m
L(x, y, µ1 , . . . , µm ) = f (x, y) + µi [ai − gi (x, y)] (161)
X

i=1

46
A.3 Homogeneous Functions
A function f (x, y) is said to be homogeneous of degree k if:

f (λx, λy) = λk f (x, y), ∀λ > 0 (162)

A.3.1 Partial Derivatives of Homogeneous Functions

If a function f (x, y) is homogeneous of degree k, then each of its partial derivatives, fx (x, y)
and fy (x, y) in this case, is homogeneous of degree k − 1.

A.3.2 Euler’s Homogeneous Function Theorem

If a function f (x, y) is homogeneous of degree k, then

∂f ∂f
k · f (x, y) = x +y (163)
∂x ∂y

Example: Euler’s theorem implies that the neoclassical production function, which is ho-
mogeneous of degree one, satisfies:

∂F ∂F
F (K, L, A) = K +L (164)
∂K ∂L

A.4 Implicit Function Theorem


Assume that f (x, y) is twice continuously differentiable. Let g(x, y) = 0 be an equation
that involves x and y only through f (x, y) and that implicitly defines y as a function of x:
y = ye(x). Then, the slope of the implicit function ye(x) is:

dye ∂g(x, y)/∂x


=− (165)
dx ∂g(x, y)/∂y

The theorem is useful when no closed-form solution exists for ye(x). For example, consider
f (x, y) = ln x + 3x2 y + ey , and the equation g(x, y) = ln x + 3x2 y + ey − 20 = 0, which
implicitly defines y as a function of x. An explicit function ye(x) cannot be found. However,
by the implicit function theorem, dxde
y
= − 1/x+6xy
3x2 +ey
.

47
Multivariate Case

Let f (x1 , . . . , xn ) be an n-variate twice continuously differentiable function. Let


g(x1 , . . . , xn ) = 0 be an equation that involves x1 , . . . , xn only through f (x1 , . . . , xn ) and
that implicitly defines xn as a function of x1 , . . . , xn−1 : xn = xen (x1 , . . . , xn−1 ). Then, for all
i ∈ {1, . . . , n − 1}:
∂ xen ∂g(·)/∂xi
=− (166)
∂xi ∂g(·)/∂xn

A.5 Convexity and Concavity


Convex Sets

A set S is convex iff for any x, y ∈ S and λ ∈ [0, 1], (λx + (1 − λ)y) ∈ S. Graphically:

Similarly, a set S is convex iff for any xi ∈ S and λi ∈ [0, 1] with λi = 1, ( λi xi ) ∈ S.


P P
i i

Concave Functions

A real-valued function f on an interval is concave iff for any x, y in the interval and λ ∈ [0, 1],
f (λx + (1 − λ)y) ≥ λf (x) + (1 − λ)f (y).35 Graphically:

Similarly, a real-valued function f is concave iff for any xi and λi ∈ [0, 1] with λi = 1,
P
i
f ( i λi xi ) ≥ i λi f (xi ). This is sometimes referred to as the Jensen’s inequality.
P P

35
On the contrary, a real-valued function f on an interval is convex iff for any x, y in the interval and
λ ∈ [0, 1], f (λx + (1 − λ)y) ≤ λf (x) + (1 − λ)f (y).

48
Quasiconcave Functions

A real-valued function f on an interval is quasiconcave iff for any x, y in the interval and
λ ∈ [0, 1], f (λx + (1 − λ)y) ≥ min(f (x), f (y)).36
Furthermore, a function f on an interval is quasiconcave if its upper contour sets (i.e.
the set of points where the function is greater than or equal to a certain value, say a)
{x : f (x) ≥ a} are convex sets. That is, if

f (x) ≥ a and f (y) ≥ a implies that f (λx + (1 − λ)y) ≥ a

for any a ∈ R, x, y in the interval, and λ ∈ [0, 1].


In the context of utility functions, u(·) is quasiconcave due to the convex nature of its
upper contour sets:

In particular:

u(x) ≥ u and u(y) ≥ u implies that u(λx + (1 − λ)y) ≥ u

for any u ∈ R, x, y ∈ X, and λ ∈ [0, 1].

A.6 Growth Rates


A.6.1 Growth Rate Properties

Let x(t) and y(t) be differentiable functions of time with growth rates:

ẋ ẏ
gx = , gy =
x y

36
On the contrary, a real-valued function f on an interval is quasiconvex iff for any x, y in the interval
and λ ∈ [0, 1], f (λx + (1 − λ)y) ≤ max(f (x), f (y)).

49
where ẋ = dx
dt
is the time derivative of x. Then, the following properties hold:

1. If z = x + y, then gz = xgx +ygy


x+y
(weighted average of individual growth rates).

2. If z = xy, then gz = gx + gy .

3. If z = xy , then gz = gx − gy .

4. If z = xa , then gz = agx .

5. If z = ln x, then gz = gx
x
.

Below are some proofs:

• Proof of (1): For z = x + y, differentiate: ż = ẋ + ẏ. Dividing by z: gz = ż


z
= ẋ+ẏ
x+y
.
Since gx = ẋ
x
and gy = ẏy , we get: gz = xgx +ygy
x+y
This is a weighted average □

• Proof of (2): For z = xy, differentiate: ż = xẏ + y ẋ. Dividing by z: gz = ż


z
= y ẋ+xẏ
xy
=

x
+ ẏy = gx + gy □

A.6.2 Cummulative Average Growth Rate

The cumulative average growth rate (CAGR) ḡ experienced by a time series {yt }Tt=0 can be
found by observing that:

yT = y0 (1 + ḡ) · (1 + ḡ) · (1 + ḡ) · . . . = y0 (1 + ḡ)T (167)


| {z }
T times

!1
yT T
=⇒ ḡ = −1 (168)
y0

A.6.3 Geometric Average Growth Rate

The geometric average growth rate g̃ of a time series {yt }Tt=0 is given by:

q "T # T1
g̃ = (1 + g1 ) · (1 + g2 ) · . . . · (1 + gT ) − 1 = (1 + gt ) −1 (169)
T
Y

t=1

where gt = yt−1
yt
− 1 denotes the one-period percent change of yt . Yet, g̃ is nothing else than
the CAGR:
"T # T1
g̃ = (1 + gt ) −1 (170)
Y

t=1

50
"T !# T1
yt
= 1+ −1 −1 (171)
Y

t=1 yt−1
"T !# T1
yt
= −1 (172)
Y

t=1 yt−1
!1
y1 y2 y3 yT T
= · · · ... · −1 (173)
y0 y1 y2 yT −1
!1
yT T
= − 1 = CAGR(y0:T ) (174)
y0

A.6.4 Continuously Compounded Growth Rates

Let k denote the number of compounding times per period. Then,


k·T
g

yT = y0 · lim 1+ = y0 · (eg )T (175)
k→∞ k

ln yT
⇐⇒ = gT (176)
ln y0
1 1
=⇒ g = (ln yT − ln y0 ) = ∆T ln y0 (177)
T T

A.6.5 Percent Changes vs. Compounded Growth Rates

∆T ln y0 is approximately equal to a percent change whenever yT ≈ y0 :


! !
yT yT − y0 yT − y0
ln yT − ln y0 = ln = ln 1 + ≈ (178)
y0 y0 y0

It is important to note that, even though we have T + 1 values for the variable yt , the
exponent in the CAGR formula (168), and the denominator in the growth rate formula (177)
is T . This is because there are T periods of growth.
However, (compounded) growth rates are generally preferred over percent changes because:

1. Growth rates are defined over R.

2. Multi-period growth rates are equal to the sum of individual single-period growth rates:

gT :0 = ln yT − ln y0 (179)
= ln yT − ln yT −1 + ln yT −1 − . . . − ln y1 + ln y1 − ln y0 (180)
T T
= ∆ ln yT + ∆ ln yT −1 + . . . + ∆ ln y1 = ∆ ln yi = (181)
X X
gi:i−1
i=1 i=1

51
B MATLAB
B.1 Introduction to MATLAB
MATLAB is a programming language and computational tool commonly used in economics
for numerical tasks such as solving DSGE models, conducting simulations, and analyzing
data. It supports efficient matrix operations, numerical optimization, and visualization.
In the MATLAB editor window, you can create a new script (.m file). Below is an example
demonstrating some of the most basic MATLAB commands that you may find useful.
1 % % INTRODUCTION TO MATLAB
2 % Pablo De Llanos
3 % Columbia University
4 % Macroeconomic Analysis II
5

6 % % - - - - - - - - - - 1. MISCELLANEOUS - - - - - - - - - - %%
7

8 % Housekeeping
9 clear all % clear the Workspace
10 close all % close any additional open window ( e . g . plots )
11 clc % clear the Command Window
12

13 % Variables
14 x = 10 % assign value 10 to variable x
15 y = 20 % assign value 20 to variable y
16

17 % Finish with a semicolon to avoid displaying the output


18 x = 30 % output will be printed in the command window
19 x = 30; % output will not be printed
20

21 % Basic operations
22 sum_xy = x + y ; % sum of x and y
23 product_xy = x * y ; % product of x and y
24 disp ( sum_xy ) ; % display the sum
25 disp ( product_xy ) ; % display the product
26 sqrt_16 = sqrt (16) ; % square root of 16
27 exp_3 = exp (3) ; % exponential of 3 ( e ˆ3)
28 log_10 = log (10) ; % natural log of 10
29 round_2_65 = round (2.65) ; % round 2.65 to the nearest integer number
30

31 % String variables
32 name = ' Pablo '; % assign the string ' Pablo ' to variable ' name '
33 surname = ' De Llanos '; % assign the string ' De Llanos ' to variable ' surname '

52
34 fullname =[ name surname ]; % concatenate ' name ' and ' surname ' , without space
35 full_name =[ name ' ' surname ]; % concatenate ' name ' and ' surname ' with
space
36 disp ( fullname ) % display the concatenated name without space
37 disp ( full_name ) % display the concatenated name with space
38 surnames = { ' De Llanos ' , ' Artero ' };
39 surnames {2} % access the second element in ' surnames ' ( i . e . " Artero ")
40

41 % % - - - - - -- - - - 2. MATRICES - - - - - - - - - - %%
42 clear all ; close all ; clc ;
43

44 % Vectors
45 r = [1 2 3]; % row vector
46 c = [1; 2; 3]; % column vector
47 r (2) % access the 2 nd element of vector r
48 r (2: end ) % access the 2 nd to last elements of vector r
49 r (:) % access all elements of vector r (":" means ALL )
50 r (2) =7; % change the 2 nd element of vector r by '7 '
51

52 % Transpose
53 trans_r = r '; % transpose of vector r
54 trans_c = c '; % transpose of vector c
55

56 % Creating vectors as sequences


57 seq_veq = [0:0.5:5]; % row vector (0 ,0.5 ,1 ,... ,4.5 ,5)
58 vec_05_100 = linspace (0 ,5) % 100 x1 ' linearly ( equally ) spaced ' row
vector , for range [0 ,5]
59 vec_010_3 = linspace (0 ,10 ,3) % 3 x1 ' linearly ( equally ) spaced ' row vector ,
for range [0 ,10]
60

61 % Matrices
62 M = [1 2 3; 4 5 6; 7 8 9]; % 3 x3 matrix
63 z = zeros (1 ,2) % 1 x2 matrix of zeros
64 o = ones (2 ,3) % 2 x3 matrix of ones
65 e = eye (4 ,4) % 4 x4 identity matrix
66 nanmat = NaN (3 ,3) % 3 x3 matrix of NaNs (" Not a Number ")
67 rep = repmat (10 ,3 ,4) % 3 x4 matrix of 10 s
68

69 % Manipulating matrices and vectors


70 % Example with 2 x2 matrices A and B
71 A = [1 1; 1 1];
72 A' % transpose
73 A (1 ,1) % access the 1 st element of A
74 A (1 ,1) =5; % change the 1 st element of A by '5 '

53
75 A (2 ,:) % access the 2 nd row of A
76 A (: ,1) % access the 1 st column of A
77 size ( A ) % obtain the 'm x n ' size of matrix A
78 size (A ,1) % number of rows ( m )
79 size (A ,2) % number of columns ( n )
80 min ( A ) % minimum element of each column
81 std ( A ) % standard deviation of elements of each column
82 var ( A ) % variance of elements of each column
83 diag ( A ) % return the diagonal as a vector
84 det ( A ) % determinant
85 trace ( A ) % trace ( sum of diagonal elements )
86 eig ( A ) % eigenvalues
87 rank ( A ) % rank
88 tril ( A ) % lower triangular
89 triu ( A ) % upper triangular
90 sum (A ,1) % sum by column
91 sum (A ,2) % product by row
92 cumsum (A ,1) % cumulative sum by column
93 cumsum (A ,2) % cuymulative sum by row
94 prod (A ,1) % product by column
95 prod (A ,2) % product by row
96 inv ( A ) % inverse of A
97

98 B = [2 1; 1 1];
99 A + B % addition
100 A - B % subtraction
101 A * B % product
102 A .* B % element - wise multiplication
103 kron (A , B ) % kronecker product
104 A \ B % equivalent to inv ( A ) * B but computed more efficiently
105 A / B % equivalent to A * inv ( B ) but computed more efficiently
106

107 % % - - - - - -- - - - 3. LOGICAL & RELATIONAL OPERATORS - - - - - - - - - - %%


108 clear all ; close all ; clc ;
109

110 % ( i ) RELATIONAL OPERATORS


111 % " equal to ": ==
112 % " not equal to " ˜= (!= in STATA )
113 % " less than " (" greater than ") : < ( >)
114 % " less than or equal to " , : <=
115

116 % ( ii ) LOGICAL OPERATORS


117 % " and " ( true if both conditions are true ) :
118 % &&: short - circuit logical " AND " operator : for logical expressions

54
119 % &: element - wise logical " AND " operator : for arrays
120 % " or " ( true if at least one of the conditions is true ) :
121 % ||: short - circuit logical " OR " operator : for logical expressions
122 % |: element - wise logical " OR " operator : for arrays
123

124 % Finding matrix elements greater than X :


125 vec = [1 , 2 , 3 , 4 , 5]; % some vector
126 mat = [1 1 ; 4 5]; % some matrix
127 greater_3_vec = vec > 3
128 smaller_4_mat = mat < 4
129

130 % Using logical operations to reference matrix elements


131 A = [ -1 , 2 , -3; 4 , 5 , -6]; % some matrix
132 A (A <0) % vector with elements meeting the condition " <0"
133 A (A <0) = 1; % replace negative elements in A with '1 '
134 A (1 , A (1 ,:) >0) = 5; % replace positive elements in 1 st row of A with
'5 '
135 selectedElements = A (A >2 & A <=5) % elements in A that are greater than
2 and less than or equal to 5
136

137 % % ----- 3.1 CONDITIONAL STATEMENTS : 'if ' , ' elseif ' , ' else ' ----- %%
138 % Conditional statements enable the execution of different blocks of code
depending on whether some specified conditions are met .
139 % 'if ': If the condition is true , the code block inside is executed .
140 % ' else ': Used with 'if '. When the 'if ' condition is false , the code
block inside the ' else ' is executed .
141 % ' elseif ': Used with 'if '. It covers other cases defined by
additional conditions . When the ' elseif ' condition is true , the code
block inside the ' elseif ' is executed .
142

143 % ( i ) 'if '


144 number = 5;
145 if number > 0
146 disp ( ' The number is positive . ') ;
147 end % always remember to close the conditional statements with 'end '
148

149 % ( ii ) 'if ' + ' else '


150 if number > 0
151 disp ( ' The number is positive . ') ;
152 else
153 disp ( ' The number is not positive . ') ;
154 end
155

156

55
157 % ( iii ) Multiple conditions : ' elseif '
158 if number > 0
159 disp ( ' The number is positive . ') ;
160 elseif number < 0
161 disp ( ' The number is negative . ') ;
162 else
163 disp ( ' The number is zero . ') ;
164 end
165

166 % % ----- 3.2 CONDITIONAL STATEMENTS : Joint conditions ----- %%


167 % Joint conditions in MATLAB use logical operators " AND " (&&) and " OR "
(||) to combine multiple criteria within a conditional statement .
168

169 % ( i ) '&& '


170 if number >0 && number <10
171 disp ( ' Number is greater than 0 and less than 10. ') ;
172 else
173 disp ( ' Number does not meet both conditions . ') ;
174 end
175

176 % ( ii ) '|| '


177 if number <0 || number >10
178 disp ( ' Number is less than 0 or greater than 10. ') ;
179 else
180 disp ( ' Number does not meet either of the conditions . ') ;
181 end
182

183 % Use parentheses to group conditions and control the order of evaluation
, especially when combining '&& ' and '|| ' in the same statement :
184 % Example using '&& ' and '|| ' together
185 % Check if a grade is passing by meeting either :
186 % ( a ) final exam >=50
187 % ( b ) continuous evaluation >=60
188 grade_exam =85;
189 grade_ps1 =50;
190 grade_ps2 =60;
191 evalu =1; % 1 means unique ( final exam only ) , 2 continuous ( two psets )
192 if ( evalu ==1 && grade_exam >=50) || ( evalu ==2 && grade_ps1 >=60 &&
grade_ps2 >=60)
193 disp ( ' Pass ') ;
194 else
195 disp ( ' Do not pass ') ;
196 end
197

56
198 % % - - - - - -- - - - 4. LOOPS - - - - - - - - - - %%
199 clear all ; close all ; clc ;
200

201 % 'for ' loops : run commands FOR a set of values . Used to repeat a group of
statements a fixed , predetermined number of times .
202 % ' while ' loops : run commands WHILE something is true . That is , it
continues executing a code block as long as the specified condition
remains true .
203

204 % ( i ) 'for '


205 % Example 1: display the numbers '1 ' to '5 '
206 for i = 1:5
207 disp ( i )
208 end
209

210 % Example 2: fill in vector values


211 x = zeros (1 ,10) ; % empty 1 x10 matrix of zeros
212 for i =1:10
213 x (1 , i ) = 10+ i
214 end
215

216 % ( ii ) ' while '


217 % Example 1: display the numbers '1 ' to '5 '
218 count = 1;
219 while count <=5
220 disp ( count ) ;
221 count = count +1;
222 end
223

224 % Example 2: number of years needed to reach an investment goal


225 Y0 = 1000; % initial investment
226 r = 0.05; % annual interest rate
227 target = 1500; % investment goal
228 Yt = Y0 ; % current amount (= initial investment at t =0)
229 year = 0; % period (= initial period at t =0)
230 while Yt < target
231 Yt = Yt *(1+ r ) ;
232 year = year +1; % years count
233 end
234 disp ([ ' Years taken to reach the target amount : ' num2str ( year ) ]) ;
235

236 % % ----- 4.1 NESTED LOOPS ----- %%


237 % Nested loops in MATLAB allow the execution of a set of statements
multiple times , with each set of iterations performed within another

57
loop ( i . e . loops within loops ) .
238

239 % Example 1: Printing combinations of names and surnames


240 names = { ' Alice ' , ' Bob ' , ' Charlie ' };
241 surnames = { ' Smith ' , ' Johnson ' , ' Williams ' };
242 names {1} % access the first element in ' names ' ( i . e . " Alice ")
243

244 disp ( ' List of all possible combinations of names and surnames : ') ;
245 for i = 1: length ( names ) % loop over names
246 for j = 1: length ( surnames ) % loop over surnames
247 combinedName = [ names { i } ' ' surnames { j }];
248 disp ( combinedName ) ;
249 end
250 end
251

252 % Example 2: Storing values in a matrix


253 matrix = NaN (3 ,3) ; % 3 x3 matrix
254 for i = 1:3 % loop over rows
255 for j = 1:3 % loop over columns
256 matrix (i , j ) = i * j ; % fill w / product of row and column indices
257 end
258 end
259 disp ( matrix ) ;
260

261 % % - - - - - -- - - - 5. RANDOM VARIABLES - - - - - - - - - - %%


262

263 % Working with random variables in MATLAB involves generating random


numbers and simulating stochastic processes .
264

265 % % ----- 5.1 GENERATING RANDOM NUMBERS ----- %%


266

267 % Random numbers are not truly " random ." MATLAB uses a random number
generator ( rng ) that determines the starting point for generating
numbers based on the " seed " we set . Therefore , to ensure replicability ,
we should set a seed using the 'rng ' function .
268

269 rng (1234) ; % set the seed for replicability of results


270

271 % ( i ) Uniform distribution


272 % ' rand ' and ' unifrnd ': uniform random numbers
273 % ' unifpdf ': uniform PDF
274 randNum = rand % random number uniformly distributed U [0 ,1]
275 randMatrix = rand (3 ,3) % 3 x3 matrix of random numbers U [0 ,1]
276 randMatrix2 = unifrnd (3 ,8 ,[2 ,4]) % 2 x4 matrix of random numbers U [3 ,8]

58
277 % ( ii ) Normal distribution
278 % ' randn ' and ' normrnd ': Normal random numbers
279 % ' normpdf ': Normal PDF
280 randnNum = randn % random number normally distributed N ( mean =0 , std =1)
281 randnMatrix = randn (3 ,3) % 3 x3 matrix of random numbers N (0 ,1)
282 randnMatrix2 = normrnd (5 ,1 ,[2 ,4]) % 2 x4 matrix of random numbers N (
mean =5 , std =1)
283

284 % ( iii ) Other distributions ?


285 % You can search for your questions on Google , or ask ChatGPT or other
generative AI tools for help .
286

287 % % - - - - - -- - - - 6. PLOTS - - - - - - - - - - %%
288 % Preferences for plots ( LaTeX format )
289 set (0 , ' d e f a u l t t e x t i n t e r p r e t e r ' , ' latex ') ;
290 set ( groot , ' d e f a u l t A x e s T i c k L a b e l I n t e r p r e t e r ' , ' latex ') ;
291 set ( groot , ' d e f a u l t L e g e n d I n t e r p r e t e r ' , ' latex ') ;
292 set ( groot , ' d e f a u l t T e x t I n t e r p r e t e r ' , ' latex ') ;
293

294 % Example 1: PDF of two normally distributed variables


295 x = [ -5:.01:5]; % range for x - axis
296 y_A = normpdf (x ,2 ,.25) ; % N (2 ,.25) variable taking values in range
[ -5 ,5]
297 y_B = normpdf (x ,1 ,1) ; % N (1 ,1) variable taking values in range
[ -5 ,5]
298

299 % Plot :
300 fig1 = figure (1) ;
301 plot (x , y_A , 'b ' , ' LineWidth ' ,2) ; % plot PDF of variable A
302 hold on
303 plot (x , y_B , 'r ' , ' linewidth ' ,2) ; % plot PDF of variable B
304 xlabel ( ' Value of Random Variable $x$ ') ;
305 ylabel ( ' Probability Density $f ( x ) $ ') ;
306 grid on
307 legend ( ' Variable A ' , ' Variable B ' , ' location ' , ' best ') ;
308 set ( gcf , ' color ' , 'w ') ; % background color
309 exportgraphics ( fig1 , ' fig1 . pdf ') ; % save as PDF
310

311 % Example 2: PDF of two log - normally distributed variables


312 x = [0:.01:20]; % range for x - axis
313 y_A = lognpdf (x ,2 ,.25) ; % lognormal (2 ,.25) variable taking values in
range [0 ,20]
314 y_B = lognpdf (x ,1 ,1) ; % lognormal (1 ,1) variable taking values in
range [0 ,20]

59
315 % Plot :
316 fig2 = figure (2) ;
317 plot (x , y_A , 'b ' , ' LineWidth ' ,2) ;
318 hold on
319 plot (x , y_B , 'r ' , ' linewidth ' ,2) ;
320 xlabel ( ' Value of Random Variable $x$ ') ;
321 ylabel ( ' Probability Density $f ( x ) $ ') ;
322 grid on
323 legend ( ' Variable A ' , ' Variable B ' , ' location ' , ' best ') ;
324 set ( gcf , ' color ' , 'w ') ;
325 exportgraphics ( fig2 , ' fig2 . pdf ') ;
326 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - END

B.2 Solving DSGE Models with DYNARE


DYNARE is a software platform for handling a wide class of nonlinear models with forward-
looking variables under rational expectations, such as DSGE and OLG models:

1. The DYNARE pre-processor translates .mod files into suitable inputs for the MATLAB
routines.

2. These MATLAB routines are used to either solve or estimate models.

3. The results (output) are then presented in MATLAB.

60
B.2.1 DYNARE Conventions

Time Periods and State Variables

• Today’s time-series yt are represented as y in DYNARE.

• Lagged variables yt−1 are represented as y(-1) (determined by the model in the previous
period).

• Lead variables yt+1 are represented as y(+1) (determined by the model in the next
period).

You must lag the predetermined state variables when writing the equations for your model.
This informs DYNARE that a variable is predetermined (i.e. determined by the model in the
previous period). For example, in the context of the RBC model, the predetermined variable
kt is represented as k(-1) in DYNARE, while kt+1 is represented as k.

Naming Conventions

When defining variables and parameters, ensure they do not share names with DYNARE
commands or built-in functions. Using reserved keywords can lead to errors or unexpected
behavior. Similarly, avoid naming a variable or parameter “i” to prevent conflicts with the
imaginary unit i and the loop index i in many programming contexts. Similarly, avoid using
“inv” as it may conflict with functions related to matrix inversion.

Log-linear approximations

In this course, we aim to approximate the solutions of the natural logs of the variables so
that the impulse responses are expressed in percentage terms.
By default, DYNARE approximates the levels of the variables. To make DYNARE per-
form a linear approximation of the logs of the variables, substitute y with exp(y) in the
equilibrium equations describing your model.

B.2.2 Solving the RBC Model

Let xt = (xct , xst ) be a matrix containing the endogenous control and state variables. State
variables describe the system’s current condition (or state), and evolve over time. Control
variables are chosen (or controlled) by agents at each period based on the system’s current
state. Let ut be a matrix of exogenous state variables. Given the uncertainty of their future
realizations, ut could take infinite histories, or paths, h(t) = (ut , ut−1 , . . . , u0 ).

61
For a stochastic model characterized by a set of nonlinear equations such that:

Et f(xt , xt+1 , ut , ut+1 , . . .) = 0 (182)

DYNARE solves DSGE models in two steps. First, it solves the model under certainty (i.e.
in steady-state equilibrium):
f(x, x, u, u, . . .) = 0 (183)

Then, it approximates a policy function around the steady state. This policy function is an
unknown, time-invariant vector-valued function that maps the predetermined state variables
into optimal choices for the endogenous control variables.

Example 1: u(ct , 1 − lt ) = (1 − ϕ) log ct + ϕ log(1 − lt )


Given z0 , k0 , and the exogenous realizations {ϵt }∞ t=0 , the equilibrium is defined by a set of
allocations {zt+1 , kt+1 , ct , lt , yt , xt }∞
t=0 and prices {rt , wt }t=0 satisfying the equilibrium condi-

tions:

1. Euler equation: 1−ϕ


ct
= βEt c1−ϕ
t+1
(1 − δ + rt+1 )

2. Labor-supply: ϕ
1−lt
= wt 1−ϕ
ct

3. FOC for capital: rt = α kytt

4. FOC for labor: wt = (1 − α) yltt

5. Goods market clearing: y t = ct + x t

6. Law of motion for capital: kt+1 = (1 − δ)kt + xt

7. Law of motion for TFP: log zt = ρ log zt−1 + ϵt

8. Production function: yt = zt ktα lt1−α

The first step is to create a new script in MATLAB (.m file) to define the model parameters:
1 % % MAIN FILE TO SOLVE AN RBC MODEL
2 % Pablo De Llanos
3 % Columbia University
4 % Macroeconomic Analysis II
5

6 clear all ; close all ; clc ;

62
7 % % - - - - - - - - - - DYNARE - - - - - - - - - - %%
8 % Set model parameters :
9 global phi alpha delta rho beta
10 phi =0.7;
11 alpha = 0.32;
12 delta = 0.025;
13 rho = 0.95;
14 beta = 0.9;
15 save ( ' param . mat ' , ' phi ' , ' alpha ' , ' delta ' , ' rho ' , ' beta ') ;

The second step is to create a DYNARE (.mod) file using your preferred text editor. Be sure
to save the file with the .mod extension and place it in the same directory as your MATLAB
script (.m file):
1 % % PROGRAM TO SOLVE AN RBC MODEL WITH DYNARE
2

3 % % Labeling block
4 % Endogenous variables (8) - in logs :
5 var
6 y % output
7 I % investment
8 k % capital
9 l % labor
10 z % productivity
11 c % consumption
12 w % real wage
13 r % real interest rate
14 ;
15

16 % Exogenous variables (1) :


17 varexo
18 eps_z % productivity shock
19 ;
20

21 % % Parameters block
22 % Define parameters :
23 parameters phi alpha delta rho beta ; % model parameters
24 parameters r_ss l_ss k_ss y_ss w_ss c_ss i_ss z_ss ; % steady - state values
25

26 % Set model parameter values loading the ` param . mat ' file :
27 load param . mat ;
28 set_param_value ( ' phi ' , phi ) ; set_param_value ( ' alpha ' , alpha ) ;
29 set_param_value ( ' delta ' , delta ) ; set_param_value ( ' rho ' , rho ) ;
30 set_param_value ( ' beta ' , beta ) ;

63
31 % Set steady - state values using steady - state closed - form equations :
32 r_ss = 1/ beta -(1 - delta ) ;
33 l_ss = 1/(1+ phi /(1 - phi ) /(1 - alpha ) *(1 - alpha * delta / r_ss ) ) ;
34 k_ss = l_ss *( alpha / r_ss ) ˆ(1/(1 - alpha ) ) ;
35 y_ss = k_ss ˆ alpha * l_ss ˆ(1 - alpha ) ;
36 w_ss = (1 - alpha ) * y_ss / l_ss ;
37 c_ss = y_ss - delta * k_ss ;
38 i_ss = delta * k_ss ;
39 z_ss = 1;

Declare the 8 equations describing the model (Remember to lag the endogenous predeter-
mined state variables, e.g. kt , and to replace each variable that is in levels by exp(variable)):
1 % % Model block
2 % Equilibrium conditions in logs , for log - linearization (8) :
3 model ;
4

5 % Euler equation :
6 (1 - phi ) / exp ( c ) = beta *(1 - phi ) / exp ( c (+1) ) *(1 - delta + exp ( r (+1) ) ) ;
7

8 % Production function :
9 exp ( y ) = exp ( z ) * exp ( k ( -1) ) ˆ alpha * exp ( l ) ˆ(1 - alpha ) ;
10

11 % Productivity equation ( already log - linearized )


12 z = rho * z ( -1) + eps_z ;
13

14 % ...
15 % Your job is to fill in the remaining 5 equations !
16

17 end ;

Provide DYNARE with initial values (or guesses) to start solving the equilibrium model.
We’ll use the steady-state values we found as these initial guesses:
1 % % Initialization block
2 % Initial guess for the endogenous variables in logs (8)
3 initval ;
4 y = log ( y_ss ) ; % steady - state log - value of output
5 I = log ( i_ss ) ; % steady - state log - value of investment
6 k = log ( k_ss ) ; % steady - state log - value of capital
7 l = log ( l_ss ) ; % steady - state log - value of labor
8 z = log ( z_ss ) ; % steady - state log - value of productivity
9 c = log ( c_ss ) ; % steady - state log - value of consumption
10 w = log ( w_ss ) ; % steady - state log - value of real wage
11 r = log ( r_ss ) ; % steady - state log - value of real interest rate
12 end ;

64
13 % Compute the steady state :
14 steady ( maxit =10000) ; % maximum number of iterations
15 check ; % check that the steady state is indeed found
16 resid ; % inspect the model equations residuals ( all should be 0)

Specify the variance of the (log) shock. Here, I am applying a 1% increase in productivity:
1 % Variance of exogenous shocks (1) :
2 shocks ;
3 var eps_z ; stderr log (1.01) ; % 1% shock in logs
4 end ;

Ask DYNARE to solve the model and give us the IRFs, using the command stoch simul:
• Specify the order of the Taylor approximation (e.g. first order), number of periods to
calculate the IRF (e.g. 100) and the (log) variables for which we want to calculate the
IRFs (e.g {y, I, k, l, z, c, w, r}).
Then, save the results (which will get stored in the variable oo ) in the file ‘simulation.mat’
1 % % Solution block
2 % Perform the simulation of the model . Get results for specified variables
3 stoch_simul ( order =1 , irf =100 , noprint , nodisplay ) y c I l k w r z ;
4

5 % Store the results :


6 savefile = ' simulation . mat ';
7 save ( savefile , ' oo_ ') ;

Save the .mod file (e.g. ‘rbc.mod’) and go back to your .m file (from step 1) to plot the IRFs.
In your .m file, add a line calling DYNARE to run your ‘rbc.mod’ file:
1 % Run the Dynare . mod file
2 dynare q3 . mod ;

Load the results from DYNARE:


3 % % - - - - - - - - - - RESULTS - - - - - - - - - - %%
4 % Load the results from Dynare
5 load ( ' simulation . mat ') ;

The IRFs are now stored in the variable oo . For example, oo .irfs.y eps z provides the
IRFs for {y}Tt=0 . You can plot it using the plot command:
6 % Plot the IRF for y :
7 plot (100* oo_ . irfs . y_eps_z ) % x100 to get IRFs in percentage terms
8 title ( ' Output : % change from SS ')

Beware that oo .irfs.k eps z contains the IRFs for {kt+1 }Tt=0 , not {kt }Tt=0 :
9 irf_k = zeros (1 ,100) ;
10 irf_k (2: end ) = oo_ . irfs . k_eps_z (1: end -1) ;

65
C Data Appendix
C.1 GDP per Capita and Well-Being

Figure C.1: Raw Correlations of GDP (PPP) per Capita

(a) Poverty (b) Access to electricity (c) Child mortality

(d) Human development (e) Life expectancy (f) Gender equality

(g) Crime (h) Education (i) Democracy

C.2 GDP per Working-Age Adult


Fernández-Villaverde, Ventura, and Yao (2023): “As the populations of advanced economies
age, output growth per capita is becoming a misleading indicator for growth theory. Changing
demographics mean that output growth per capita can obscure important trends in output
per working-age adult or output per hour worked, which are more natural summary

66
statistics for growth theory to focus on.”
“Between 1991 and 2019, GDP in Japan grew at an annual rate of 0.83%, much lower than
the 2.53% of the U.S. (...) However, the outlook changes significantly when demographics
are considered. From 1991 to 2019, Japan’s GDP per working-age adult grew annually by
1.39%. In comparison, the U.S. grew at 1.65% in the same measure, a difference of only
0.26% (...) Remarkably, from 1998 to 2019, Japan grew slightly faster than the U.S. in terms
of GDP per working-age adult.”

(a) GDP per capita (b) GDP per working-age adult

“(...) Since the production function depends on labor, not total population, variations in
the ratio of labor over total population shift the slope of the growth path up or down and
induce transitional dynamics. In terms of the Euler equation characterizing the equilibrium
behavior of the economy, having a lower labor/population ratio is equivalent to having a
negative technological shock in a standard real business cycle model (and with the same
persistent and propagation effects).”

67
C.3 U.S. Empirical Regularities

Figure C.3: Kaldor’s Growth Facts

(1) GDP per capita (2) Consumption-output ratio (3) Capital-output ratio

(4) Real wages (5) Return on capital (6) Factor shares

(7) Hours worked per capita

68
C.4 Recent Trends in Income Shares and Hours Worked

Figure C.4: Labor Share Across Countries

(a) Advanced Economies (b) Developing Economies

(c) Scandinavian Economies

69
Figure C.5: Hours Worked per Capita Across Countries

C.4.1 Hours Worked per Worker

Figure C.6: Weekly U.S. Hours Worked per Worker in Nonfarm Establishments

70
Figure C.7: Average Hours Worked per Worker in Advanced Economies

Notes: The figure shows data for the following countries: Belgium, Denmark, France, Germany, Ireland,
Italy, Netherlands, Spain, Sweden, Switzerland, the UK, Australia, Canada, and the US. The scale is
logarithmic which suggests that hours fall at roughly 0.57 percent per year.

xxx

Figure C.8: Average Hours Worked per Week vs. GDP per Capita

71
C.5 U.S. Business Cycles

Figure C.9: Real GDP: Trend and Cycle

(a) Real GDP per capita, 1870-2012 (b) Percentage Deviations from the Trend

Figure C.10: Comovements of Deviations from the Trend

(a) Consumption (b) Investment

(c) Employment

72
References
Fernández-Villaverde, J., G. Ventura, and W. Yao. 2023. “The Wealth of Working Nations.”
Working Paper No. 31914, National Bureau of Economic Research, November.

Jones, C.I., and P.J. Klenow. 2016. “Beyond GDP? Welfare across Countries and Time.”
American Economic Review 106:2426–57.

Kim, J., S. Kim, E. Schaumburg, and C.A. Sims. 2008. “Calculating and using second-order
accurate solutions of discrete time dynamic equilibrium models.” Journal of Economic
Dynamics and Control 32:3397–3414.

Kydland, F.E., and E.C. Prescott. 1982. “Time to Build and Aggregate Fluctuations.” Econo-
metrica 50:1345–1370.

MaCurdy, T.E. 1981. “An Empirical Model of Labor Supply in a Life-Cycle Setting.” Journal
of Political Economy 89:1059–1085.

Uzawa, H. 1961. “On a Two-Sector Model of Economic Growth.” Review of Economic Studies
29:40–47.

73

You might also like