# A Decentralized DSGE Model

In previous articles, we went through a simple DSGE model. We computed first order conditions and steady-state equations and we ran a simulation in Dynare. Maybe some of you were confused by one thing: there was no firm in the model. We had only a representative household, we even had a production function, but this function was a part of a household budget constraint. Isn’t this strange? Where is the firm? And where is a profit maximization task? We will discuss it in this article. We will define a new DSGE model which contains both firm and household. Then we will solve it and we will run a new simulation in Dynare.

There are several ways how to define the environment of the model. This is the “standard” way which you may know from the basic economics courses: There are households and firms in the model. The households provide labour and savings to the firms and firms provide consumer goods to the households. Transactions are made on labour, capital and consumption goods markets. This is the case which we are analyzing in this article.

We could use a different definition. The household can perform the functions of the firm: it can employ adult members of the family as workers and consume the produced goods. The savings of the household are used as capital.

We could also assume that the economy contains an element which is called a benevolent social planner. The social planner has no connection to socialism, communism or any other totalitarian regime. In DSGE models, the social planner is only a formal assumption which makes the solution of the model easier. The solution of the model is exactly the same for both versions. The social planner dictates the choices of consumption to maximize the household utility. This is why we call the planner benevolent. It’s only desire is the household’s welfare.

# Model Definition

So, let’s start with the decentralized model. We will define a new DSGE model with both household and firm and we will compute its first order condition and steady-state variables values.

## The Representative Household

We will start with the household. Let’s use a slightly different definition of the household problem. It still maximizes the present value of its present utility and all future utilities. Utility in each time period depends on household consumption and a ratio of free time to disposable time. We will use different utility function than last time. We will use a logarithm also for the amount of free time. It means that now we have diminishing marginal utility of free time directly in the utility function.

$\max \mathbb{E}_0 \sum\limits_{t=0}^{\infty} \beta^t [ \ln ( c_t ) + \psi \ln ( 1 - n_t ) ] \, .$

A household budget constraint is also different. We will have no production function there. Household provides the production factors (labour and capital) to the firm and household incomes are given by firm’s payments for the production factors. We also have markets in our model: a labour market and a capital market. Now we have to express the value of these payments. An amount of labour provided by the household is given by variable $n_t$. In the centralized model, we had a variable $k_t$ which gave us the amount of capital in production. Now we will add a new variable $a_t$ which gives us an amount of assets owned by the household. The firm’s capital is owned by household and the firm pays interests for it. An interest rate is determined on capital goods market.

Now we have to express values of payments for both labour and capital. Amount of labor is given by variable $n_t$. We denote wage by $w_t$ and interest rate by $r_t$. Remember, that we are talking about real wage and real interest rate. We have no price level in this model, actually, we have no paper money at all. We assume that the household and the firm use the consumption goods as the medium of exchange.

Now we know everything to define the household budget constraint:

$c_t + a_{t+1} = w_t n_t + a_t (1 + r_t) \, .$

### First Order Conditions

Let’s solve the first order conditions. I have explained, why we need the first order condition, in the previous article. We will start with the Lagrange function:

$\mathscr{L} = \mathbb{E}_0\sum_{t=0}^{\infty} \beta^t [\ln ( c_t ) + \psi \ln ( 1 - n_t )] + \sum_{t=0}^{\infty} \lambda_t [ w_t n_t + a_t (1 + r_t) - c_t - a_{t+1} ] \, .$

#### Euler Equation

First, we will derive the Euler Equation. We will start by computing a derivatative of the Lagrange function with respect to (w.r.t.) $a_{t+1}$ and seting it euqal to zero:

$\frac{\partial \mathscr{L}}{\partial a_{t+1}} = -\lambda_{t} + \lambda_{t+1} \cdot \left( 1 + r_t \right) = 0 \, .$

If you feel confused by this result, plese read this article. We explained there the derivative of the Lagrange function in much greater detail.

We can make an easy modification to get:

$\lambda_{t} = \lambda_{t+1} \cdot \left( 1 + r_t \right) \, .$

It would be nice to substitute $\lambda_{t}$ and $\lambda_{t+1}$. We can easily express these Lagrange multipliers from a derivate of the Lagrange function w.r.t. the amount of consumption. We will start with $c_t$:

$\frac{\partial \mathscr{L}}{\partial c_t} = \mathbb{E}_0 \beta^t \cdot \frac{1}{c_{t}} - \lambda_t = 0 \, .$

We can rewrite the result as

$\lambda_t = \mathbb{E}_0 \beta^t \cdot \frac{1}{c_{t}} \, .$

If we derive the Lagrangien function w.t.r. $c_{t+1}$, we will get similar result:

$\lambda_{t+1} = \mathbb{E}_0 \beta^{t+1} \cdot \frac{1}{c_{t+1}} \, .$

Now we can make the substitution which we described above:

$\beta^t \cdot \frac{1}{c_{t}}= \mathbb{E}_t \beta^{t+1} \cdot \frac{1}{c_{t+1}} \left( 1 + r_t \right) = 0 \, .$

We can easily eliminate $\beta$ on the right side. Now we have the Euler Equation:

$\frac{1}{c_{t}} = \mathbb{E}_t \beta \cdot \frac{1}{c_{t+1}} \left( 1 + r_t \right) \, .$

#### Labor Supply

We also need to determine labor supply. Let’s start with a derivative of the Lagrange function w.r.t. $n_t$:

$\frac{\partial \mathscr{L}}{\partial n_t} = \beta^t \cdot \left( - \psi \frac{1}{1-n_t} \right) + \lambda_t w_t = 0 \, .$

The value of Lagrange multiplier $\lambda_t$ proves to be really useful because we can substitute it once more:

$\beta^t \cdot \left( \psi \frac{1}{1 - n_t} \right) = \beta^t \cdot \frac{1}{c_{t}} w_t \, .$

Finally, we just make a small modification to get a simplier labor supply as:

$\frac{\psi}{1 - n_t} = \frac{w_t}{c_{t}} \, .$

Now we are finished with the description of the representative household. You probably miss a production function or a stochastic shock. It is still present in the model, but it is a part of the representative firm description.

#### Household’s investment

We now have the variable which defines the amount of asset which the household owns. The amount of investment is given by the difference between an amount of assets in the previous time period and an amount of assets in the current time period. The net investments at time $t$ is given by variable $i_t$ and the variable is given by the following equation:

$i_t = a_t - a_{t-1} \, .$

## The Representative Firm

We need to define the production function just at the beginning. Again, we use the Cobb-Douglas production function. We also denote a new variable $y_t$, which gives us an amount of goods produced at time $t$. In our simple economy with one representative firm, this variable represents a product. The product depends on both the amount of labour and capital and a current value of a technology level. So let’s add a new variable $A_t$ which is the current value of the technology level. The technology level is affected by a stochastic shock. We will define the stochastic shock later, first we write down the production function formula:

$y_t = e^{z_t} k_t^\alpha l_t^{1-\alpha} \, .$

We assume, that the firm maximizes its profit. Because we have no price level in our economy and the produced good is used as the medium of exchange, the income of the company equals the amount of production (or by the product). The costs of the firm are given by payments for the labour and capital to the household. But the costs of the firm are also increased by capital depreciation. So costs of capital are a sum of the interests payment to the household and the capital depreciation. We can distinguish two types of interest rate. We have already defined $i_t$ which is the net interest rate received by the household. Now we will add a gross interest rate, which we denote by $\mu_t$. The gross interest rate represents the firm’s cost for one unit of capital and it is defined by:

$\mu_t = r_t + \delta \, ,$

where $\delta$ is the depreciation rate of the capital.

So the real profit is the difference between product and production costs, which we write down as:

$\pi_t = e^{z_t} k_t^\alpha l_t^{1-\alpha} - w_t l_t - \mu_t k_t$

### Profit Maximization Conditions

Now we need to compute the first-order conditions. We have no other constraints now – we only need to find the ideal amounts of work and capital which maximize the profit. The representative firm cannot change the capital and labour prices. These prices are determined by the labour and capital market.

#### Labor Demand Condition

To get the first order conditions, we only need to take the derivative of the profit function w.r.t. the $l_t$ and $k_t$ variables. Let’s start with the labor:

$\frac{\partial \pi_t}{\partial l_t} = e^{z_t} k_t^\alpha l_t^{-\alpha} (1-\alpha) - w_t = 0 \, .$

We can easily rewrite the result as

$w_t = e^{z_t} k_t^\alpha l_t^{-\alpha} (1-\alpha) \, .$

This equation says that the marginal productivity of the labor equals the wage (or you can say the marginal costs of labor) when the firm maximizes its profit. This makes sense. For example, if the marginal productitify of the labor is higher that its cost the company could easily increase its profit by hiring more man hours (and vice versa).

#### Capital amount condition

Now we will continue with a derivative of the profit function w.r.t. the amount of kapital:

$\frac{\partial \pi_t}{\partial k_t} = e^{z_t} \alpha k_t^{\alpha-1} l_t^{1-\alpha} - \mu_t = 0 \, .$

We can rewrite it as

$\mu_t = e^{z_t} \alpha k_t^{\alpha-1} l_t^{1-\alpha} \, .$

This equation says us that the cost of capital equals the marginal productivity of capital. Now we will proceed to market equilibrium conditions.

### The Stochastic Shock

If you do not understand, how the stochastic shock works and why we need it, please look at this article. The definition of the shock is still the same:

$z_t = \rho z_{t-1} + \epsilon_t \, .$

## Market clearing conditions

We have three markets in our economy goods market, capital market, and labour market. We must calculate market equilibrium conditions for each market.

Let’s start with goods market. The goods are demanded by household and the bought goods are split into consumption and investments. The supply of the goods equal to firm’s production $y_t$. So the market clearing condition is:

$c_t + i_t = y_t \, .$

The labour market is easier. The market is in the equilibrium when the labour supply equals the labour demand:

$n_t = l_t \, .$

The last market is the capital market. But we do not need to develop a condition for the capital market. It is because of Walras Law.

### Walras Law

The Walras law says, that if there are $n$ markets in the economy and $n - 1$ markets are cleared, then the last one has to be also cleared. So we need only two of the conditions, because if two markets are cleared, then the last one must be also cleared.

# The Simulation

Now we will proceed with simulation in Dynare. I will write down all equations which we will use. Please note that we defined or derived all of these equation in this article, so non of them should be a surprise for you:

the household budget constraint $\, c_t + a_{t+1} = w_t n_t + a_t (1 + r_t) \, ,$
Euler’s equation $\, \frac{1}{c_{t}} = \beta \cdot \frac{1}{c_{t+1}} \left( 1 + r_t \right) \, ,$
the labor supply equation $\, \frac{\psi}{1 - n_t} = \frac{w_t}{c_{t}} \, ,$
the household investments equation $\, i_t = a_t - a_{t-1} \, .$
the production function $\, y_t = e^{z_t} k_t^\alpha l_t^{1-\alpha} \, ,$
the gross and net interest rates equation $\, \mu_t = r_t + \delta \, ,$
the labor demand equation $\, w_t = e^{z_t} k_t^\alpha l_t^{-\alpha} (1-\alpha) \, ,$
the capital demand equation $\, \mu_t = e^{z_t} \alpha k_t^{\alpha-1} l_t^{1-\alpha} \, ,$
the good market clearing condition $\, c_t + i_t = y_t \, ,$
the labor market clearing condition $\, n_t = l_t \, ,$
and the stochatic shock definition $\, z_t = \rho z_{t-1} + \epsilon_t \, .$

var c k l z w r y i n a mu;
varexo e;
parameters alpha beta delta psi sigma A rho;
alpha = 0.4;
beta = 0.95;
delta = 0.1;
psi = 2;
sigma = 0.01;
rho = 0.9;
model;
c(-1) + a = w(-1) * l(-1) + r(-1) * a(-1) + (1) * a(-1);
1/c = beta * 1 / c(+1) * (r(+1) + 1);
psi / (1 - n) = w / c;
i = a - a(-1);
y = exp (z) * k ^ (alpha) * l ^ (1 - alpha);
mu = r + delta;
w = A * exp(z) * k ^ alpha * (1 - alpha) * l ^ (- alpha);
mu = A * exp(z) * alpha * k ^ (alpha - 1) * l ^ (1 - alpha);
y = c + i;
n = l;
z = rho*z(-1)+e;
end;
initval;
l = 0.28904;
k = 1.4398;
c = 0.40543;
w = 1.1405;
r = 0.15263;
y = 0.54941;
i = 0.14398;
z = 0;
e = 0;
end;
check;

shocks;
var e = sigma^2;
end;

stoch_simul(irf=50);

Here you can see the impulse response curves.

Here you can see results of the simulation:

STEADY-STATE RESULTS:

c 0.438652
k 1.14955
l 0.23077
z 0
w 1.14049
r 0.0526316
y 0.438652
i 0
n 0.23077
a 3.33374
mu 0.152632

EIGENVALUES:
Modulus Real Imaginary

1.084e-018 1.084e-018 0
1.31e-017 1.31e-017 0
3.039e-017 -3.039e-017 0
0.1657 0.1657 0
0.8913 0.8913 0
0.9 0.9 0
1.104 1.104 0
4.982e+015 -4.982e+015 0

There are 2 eigenvalue(s) larger than 1 in modulus
for 2 forward-looking variable(s)

The rank condition is verified.

warning: implicit conversion from real matrix to real scalar
warning: called from
dyn_second_order_solver at line 121 column 14
stochastic_solvers at line 225 column 12
resol at line 137 column 14
stoch_simul at line 88 column 34
modelnikoldynare at line 170 column 6
dynare at line 180 column 1

MODEL SUMMARY

Number of variables: 11
Number of stochastic shocks: 1
Number of state variables: 6
Number of jumpers: 2
Number of static variables: 5

MATRIX OF COVARIANCE OF EXOGENOUS SHOCKS

Variables e
e 0.000100

POLICY AND TRANSITION FUNCTIONS
c k l z w r y i n a mu
Constant 0.438616 1.149318 0.230770 0 1.140402 0.052650 0.438616 0 0.230770 3.333742 0.152650
(correction) -0.000036 -0.000233 0 0 -0.000092 0.000019 -0.000036 0 0 0 0.000019
l(-1) 0.103438 4.701137 0.461540 0 0.953240 -0.191361 1.243933 1.140494 0.461540 1.140494 -0.191361
z(-1) 0.222155 -1.131009 0 0.900000 0.577603 0.227473 0.222155 0 0 0 0.227473
w(-1) 0.020930 0.951237 0.093389 0 0.192880 -0.038720 0.251700 0.230770 0.093389 0.230770 -0.038720
a(-1) 0.071748 0.655741 0.021299 0 0.218124 -0.043788 0.124380 0.052632 0.021299 1.052632 -0.043788
c(-1) -0.090696 -4.122017 -0.404684 0 -0.835813 0.167788 -1.090696 -1.000000 -0.404684 -1.000000 0.167788
r(-1) 0.302358 13.741742 1.349112 0 2.786384 -0.559361 3.636100 3.333742 1.349112 3.333742 -0.559361
e 0.246839 -1.256677 0 1.000000 0.641781 0.252748 0.246839 0 0 0 0.252748
l(-1),l(-1) 0.047276 4.697919 -0.385762 0 0.122915 0.175253 0.047276 0 -0.385762 0 0.175253
z(-1),l(-1) -0.030809 -7.208058 -0.233747 0 -0.080104 -0.172193 -0.030809 0 -0.233747 0 -0.172193
z(-1),z(-1) 0.091222 0.785471 0 0 0.237177 0.151254 0.091222 0 0 0 0.151254
w(-1),l(-1) 0.109828 6.023190 0.248572 0 0.885554 -0.096865 1.109828 1.000000 0.248572 1.000000 -0.096865
w(-1),z(-1) -0.006234 -1.458493 -0.047297 0 -0.016208 -0.034842 -0.006234 0 -0.047297 0 -0.034842
w(-1),w(-1) 0.001936 0.192344 -0.015794 0 0.005032 0.007175 0.001936 0 -0.015794 0 0.007175
a(-1),l(-1) -0.003243 1.460442 -0.106074 0 -0.008433 0.093190 -0.003243 0 -0.106074 0 0.093190
a(-1),z(-1) 0.020662 -0.841897 -0.010787 0 0.053721 -0.053866 0.020662 0 -0.010787 0 -0.053866
a(-1),w(-1) -0.000656 0.295509 -0.021463 0 -0.001706 0.018856 -0.000656 0 -0.021463 0 0.018856
a(-1),a(-1) -0.004785 0.077928 -0.004074 0 -0.012441 0.012966 -0.004785 0 -0.004074 0 0.012966
c(-1),l(-1) -0.082904 -8.238391 0.676482 0 -0.215546 -0.307329 -0.082904 0 0.676482 0 -0.307329
c(-1),z(-1) 0.027014 6.320117 0.204953 0 0.070236 0.150981 0.027014 0 0.204953 0 0.150981
c(-1),w(-1) -0.016775 -1.666973 0.136881 0 -0.043614 -0.062186 -0.016775 0 0.136881 0 -0.062186
c(-1),a(-1) 0.002844 -1.280534 0.093007 0 0.007394 -0.081710 0.002844 0 0.093007 0 -0.081710
c(-1),c(-1) 0.036346 3.611763 -0.296574 0 0.094497 0.134735 0.036346 0 -0.296574 0 0.134735
r(-1),l(-1) 0.276382 27.464674 -2.255218 0 0.718576 1.024555 0.276382 0 -2.255218 0 1.024555
r(-1),z(-1) -0.090056 -21.069643 -0.683259 0 -0.234150 -0.503333 -0.090056 0 -0.683259 0 -0.503333
r(-1),w(-1) 0.055924 5.557257 -0.456325 0 0.145398 0.207311 0.055924 0 -0.456325 0 0.207311
r(-1),a(-1) 0.081216 8.390987 0.094623 0 0.811163 0.104612 1.081216 1.000000 0.094623 1.000000 0.104612
r(-1),c(-1) -0.242335 -24.081377 1.977404 0 -0.630056 -0.898343 -0.242335 0 1.977404 0 -0.898343
r(-1),r(-1) 0.403941 40.140554 -3.296078 0 1.050223 1.497422 0.403941 0 -3.296078 0 1.497422
e,e 0.112620 0.969718 0 0 0.292811 0.186733 0.112620 0 0 0 0.186733
l(-1),e -0.034232 -8.008953 -0.259719 0 -0.089005 -0.191326 -0.034232 0 -0.259719 0 -0.191326
z(-1),e 0.202715 1.745492 0 0 0.527060 0.336119 0.202715 0 0 0 0.336119
w(-1),e -0.006927 -1.620548 -0.052552 0 -0.018009 -0.038713 -0.006927 0 -0.052552 0 -0.038713
a(-1),e 0.022958 -0.935441 -0.011985 0 0.059690 -0.059851 0.022958 0 -0.011985 0 -0.059851
c(-1),e 0.030015 7.022353 0.227725 0 0.078040 0.167757 0.030015 0 0.227725 0 0.167757
r(-1),e -0.100062 -23.410715 -0.759177 0 -0.260166 -0.559259 -0.100062 0 -0.759177 0 -0.559259

APROXIMATED THEORETICAL MOMENTS

VARIABLE MEAN STD. DEV. VARIANCE
c 0.4390 0.0137 0.0002
k 1.1505 0.0575 0.0033
l 0.2307 0.0058 0.0000
z 0.0000 0.0229 0.0005
w 1.1413 0.0392 0.0015
r 0.0526 0.0031 0.0000
y 0.4390 0.0229 0.0005
i -0.0000 0.0144 0.0002
n 0.2307 0.0058 0.0000
a 3.3387 0.1360 0.0185
mu 0.1526 0.0031 0.0000

APPROXIMATED MATRIX OF CORRELATIONS

Variables c k l z w r y i n a mu
c 1.0000 0.8381 0.3219 0.8766 0.9779 -0.0083 0.8015 0.3219 0.3219 0.9449 -0.0083
k 0.8381 1.0000 0.6630 0.7787 0.9064 -0.1022 0.9201 0.6630 0.6630 0.7497 -0.1022
l 0.3219 0.6630 1.0000 0.6317 0.5129 0.4761 0.8242 1.0000 1.0000 0.0531 0.4761
z 0.8766 0.7787 0.6317 1.0000 0.9344 0.4458 0.9233 0.6317 0.6317 0.6710 0.4458
w 0.9779 0.9064 0.5129 0.9344 1.0000 0.0976 0.9089 0.5129 0.5129 0.8685 0.0976
r -0.0083 -0.1022 0.4761 0.4458 0.0976 1.0000 0.2957 0.4761 0.4761 -0.3076 1.0000
y 0.8015 0.9201 0.8242 0.9233 0.9089 0.2957 1.0000 0.8242 0.8242 0.5987 0.2957
i 0.3219 0.6630 1.0000 0.6317 0.5129 0.4761 0.8242 1.0000 1.0000 0.0531 0.4761
n 0.3219 0.6630 1.0000 0.6317 0.5129 0.4761 0.8242 1.0000 1.0000 0.0531 0.4761
a 0.9449 0.7497 0.0531 0.6710 0.8685 -0.3076 0.5987 0.0531 0.0531 1.0000 -0.3076
mu -0.0083 -0.1022 0.4761 0.4458 0.0976 1.0000 0.2957 0.4761 0.4761 -0.3076 1.0000

APPROXIMATED COEFFICIENTS OF AUTOCORRELATION

Order 1 2 3 4 5
c 0.9821 0.9561 0.9246 0.8892 0.8512
k 0.8170 0.7196 0.6432 0.5765 0.5170
l 0.8487 0.6748 0.5207 0.3903 0.2812
z 0.9000 0.8100 0.7290 0.6561 0.5905
w 0.9748 0.9218 0.8655 0.8103 0.7571
r 0.5441 0.3886 0.2954 0.2234 0.1642
y 0.9274 0.8051 0.6892 0.5873 0.4989
i 0.8487 0.6748 0.5207 0.3903 0.2812
n 0.8487 0.6748 0.5207 0.3903 0.2812
a 0.9944 0.9791 0.9563 0.9276 0.8945
mu 0.5441 0.3886 0.2954 0.2234 0.1642

We will analyze the results and compute the steady-state in a next article.