Macro II Notes - Topic 3 - Update 8
Macro II Notes - Topic 3 - Update 8
Pablo De Llanos∗
Columbia University
∗ 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
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 exogenous variables are determined outside the model. In particular, the
model takes their values and behavior as given.
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)
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
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:
where Ui := Ui (1).
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:
4
C ∈ (0, ∞), while log C ∼ N (µ, σ 2 ).3 Therefore,
1 2
c ≡ E[C] = eµ+ 2 σ (7)
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
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.
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.
Y
|{z} = F ( |{z} L )
K , |{z} (17)
output physical labor
capital
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
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.
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:
2.2.2 Production
Yt = F (Kt , γ t L) (24)
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)
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).
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
Defining K̂t := , we have:
γt
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)
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.
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:
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)
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 .
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
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
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.
t c + i
t = rt kt + wt lt (56)
|{z} |{z} |{z} |{z}
consumption investment capital wage
income income
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:
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:
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 )
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:
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.
16
Example 1: v(1 − lt ) = 1 − lt
(ct · (1 − lt ))1−σ − 1
u(ct , 1 − lt ) = (66)
1−σ
where
t (1 − lt )
uc (ct , 1 − lt ) = c−σ 1−σ
(67)
t (1 − lt )
c−σ = βc−σ
t+1 (1 − lt+1 ) (1 − δ + rt+1 ) (68)
1−σ 1−σ
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)
γ
γσ
r= +δ−1 (71)
β
(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
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?
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:
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)
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)
L̄
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̄.
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.
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:
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:
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)
! 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.
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.
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
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
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.
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:
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.
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:
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.
y t = ct + x t (110)
• Production function:
yt = zt ktα lt1−α (111)
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):
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 :
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:
31
7. Law of motion for TFP: log zt = ρ log zt−1 + ϵt
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
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 ′ ):
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 − δ
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
k′ (k − k̄) (z − 1)
≈ 1 + gk + gz (141)
k̄ k̄ k̄
gz
k̃ ′ ≈ gk k̃ + z̃ (142)
k̄
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.
Remember our estimation problem: given z0 , k0 , and the exogenous realizations {ϵt }∞ t=0 , the
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.
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.
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.
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:
41
A.1.1 Derivative Rules
xxx
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∗ .
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∗ .
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
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
∗
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
• 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
∂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
gi (x, y) = ai for i = 1, . . . , m
i=1
46
A.3 Homogeneous Functions
A function f (x, y) is said to be homogeneous of degree k if:
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.
∂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
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
A set S is convex iff for any x, y ∈ S and λ ∈ [0, 1], (λx + (1 − λ)y) ∈ S. Graphically:
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
In particular:
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:
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
.
The cumulative average growth rate (CAGR) ḡ experienced by a time series {yt }Tt=0 can be
found by observing that:
!1
yT T
=⇒ ḡ = −1 (168)
y0
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
ln yT
⇐⇒ = gT (176)
ln y0
1 1
=⇒ g = (ln yT − ln y0 ) = ∆T ln y0 (177)
T T
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:
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
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
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
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
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
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
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
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
57
loop ( i . e . loops within loops ) .
238
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
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
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
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
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
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
1. The DYNARE pre-processor translates .mod files into suitable inputs for the MATLAB
routines.
60
B.2.1 DYNARE Conventions
• 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.
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:
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.
tions:
2. Labor-supply: ϕ
1−lt
= wt 1−ϕ
ct
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
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
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
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
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 ;
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
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.”
“(...) 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
(1) GDP per capita (2) Consumption-output ratio (3) Capital-output ratio
68
C.4 Recent Trends in Income Shares and Hours Worked
69
Figure C.5: Hours Worked per Capita Across Countries
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
(a) Real GDP per capita, 1870-2012 (b) Percentage Deviations from the Trend
(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