Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
thorek1 committed Oct 10, 2023
1 parent f6f8f70 commit a0b1941
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 26 deletions.
4 changes: 2 additions & 2 deletions docs/src/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ @TechReport{diffstatespace
doi={10.3386/w30573},
}

@article{smets_wouters_2003,
@article{smetswouters2003,
author = {Smets, Frank and Wouters, Raf},
title = {AN ESTIMATED DYNAMIC STOCHASTIC GENERAL EQUILIBRIUM MODEL OF THE EURO AREA},
journal = {Journal of the European Economic Association},
Expand All @@ -173,7 +173,7 @@ @article{smets_wouters_2003
}


@article{schorfheide_2000,
@article{schorfheide2000,
author = {Schorfheide, Frank},
title = {Loss function-based evaluation of DSGE models},
journal = {Journal of Applied Econometrics},
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/estimation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This tutorial is intended to show the workflow to estimate a model using the No-

## Define the model

The first step is always to name the model and write down the equations. For the [schorfheide_2000](@citet) model this would go as follows:
The first step is always to name the model and write down the equations. For the [schorfheide2000](@citet) model this would go as follows:

```@setup tutorial_2
ENV["GKSwstype"] = "100"
Expand Down
70 changes: 49 additions & 21 deletions docs/src/tutorials/rbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,79 @@ The following tutorial will walk you through the steps of writing down a model (
**Household's Problem**:
Households derive utility from consuming goods and discount future consumption. The decision they face every period is how much of their income to consume now versus how much to invest for future consumption.

\[ E_0 \sum_{t=0}^{\infty} \beta^t \ln(c_t) \]
```math
E_0 \sum_{t=0}^{\infty} \beta^t \ln(c_t)
```

Their budget constraint reflects that their available resources for consumption or investment come from returns on their owned capital (both from the rental rate and from undepreciated capital) and any profits distributed from firms.

\[ c_t + k_t = (1-\delta) k_{t-1} + R_t k_{t-1} + \Pi_t \]
```math
c_t + k_t = (1-\delta) k_{t-1} + R_t k_{t-1} + \Pi_t
```

The FOC with respect to \( c_t \) represents the intertemporal trade-off. It balances the marginal utility of consuming one more unit today against the expected discounted marginal utility of consuming that unit in the future.
Combining the first order (optimality) conditions with respect to ``c_t`` and ``k_t`` shows that households balance the marginal utility of consuming one more unit today against the expected discounted marginal utility of consuming that unit in the future.

\[ \frac{1}{c_t} = \beta E_t \left[ (R_{t+1} + 1 - \delta) \frac{1}{c_{t+1}} \right] \]
```math
\frac{1}{c_t} = \beta E_t \left[ (R_{t+1} + 1 - \delta) \frac{1}{c_{t+1}} \right]
```

**Firm's Problem**:
Firms rent capital from households to produce goods. Their profits, \( \Pi_t \), are the difference between their revenue from selling goods and their costs from renting capital. Competition ensures that profits are 0.
Firms rent capital from households to produce goods. Their profits, ``\Pi_t``, are the difference between their revenue from selling goods and their costs from renting capital. Competition ensures that profits are 0.

\[ \Pi_t = q_t - R_t k_{t-1} \]
```math
\Pi_t = q_t - R_t k_{t-1}
```

Given the Cobb-Douglas production function with a stochastic technology process:

\[ q_t = \exp(z_t) k_{t-1}^{\alpha} \]
```math
q_t = \e^{z_t} k_{t-1}^{\alpha}
```

The FOC with respect to capital \( k_{t} \) determines the optimal amount of capital the firm should rent. It equates the marginal product of capital (how much additional output one more unit of capital would produce) to its cost (the rental rate).
The FOC with respect to capital ``k_{t}`` determines the optimal amount of capital the firm should rent. It equates the marginal product of capital (how much additional output one more unit of capital would produce) to its cost (the rental rate).

\[ R_t = \alpha \exp(z_t) k_{t-1}^{\alpha-1} \]
```math
R_t = \alpha \e^{z_t} k_{t-1}^{\alpha-1}
```

**Market Clearing**:
This condition ensures that every good produced in the economy is either consumed by households or invested to augment future production capabilities.

\[ q_t = c_t + i_t \]
```math
q_t = c_t + i_t
```

With:

\[ i_t = k_t - (1-\delta)k_{t-1} \]
```math
i_t = k_t - (1-\delta)k_{t-1}
```

**Equations describing the dynamics of the economy**:

1. **Technology Process**: Traces the evolution of technological progress. Exogenous innovations are captured by \( \epsilon_{t} \).
\[ z_{t+1} = \rho z_{t-1} + \sigma^z \epsilon^z_{t} \]
- **Household's Optimization (Euler Equation)**: Signifies the balance households strike between current and future consumption. The rental rate of capital has been substituted for.

2. **Production**: Describes the output generation from the previous period's capital stock, enhanced by current technology.
\[ q_t = \exp(z_t) k_{t-1}^{\alpha} \]
```math
\frac{1}{c_t} = \frac{\beta}{c_{t+1}} \left( \alpha e^{z_{t+1}} k_t^{\alpha-1} + (1 - \delta) \right)
```

- **Capital Accumulation**: Charts the progression of capital stock over time.

```math
c_t + k_t = (1-\delta)k_{t-1} + q_t
```

3. **Household's Optimization (Euler Equation)**: Signifies the balance households strike between current and future consumption. The rental rate of capital has been substituted for.
\[ \frac{1}{c_t} = \beta \left[ (\alpha \exp(z_{t+1}) k_t^{\alpha-1} + 1 - \delta) \frac{1}{c_{t+1}} \right] \]
- **Production**: Describes the output generation from the previous period's capital stock, enhanced by current technology.

4. **Capital Accumulation**: Charts the progression of capital stock over time.
\[ k_t = (1-\delta)k_{t-1} + q_t - c_t \]
```math
q_t = e^{z_t} k_{t-1}^{\alpha}
```

- **Technology Process**: Traces the evolution of technological progress. Exogenous innovations are captured by ``\epsilon^z_{t}``.

```math
z_{t+1} = \rho^z z_{t-1} + \sigma^z \epsilon^z_{t}
```

## Define the model

Expand All @@ -69,7 +97,7 @@ using MacroModelling
1 / c[0] = (β / c[1]) * (α * exp(z[1]) * k[0]^(α - 1) + (1 - δ))
c[0] + k[0] = (1 - δ) * k[-1] + q[0]
q[0] = exp(z[0]) * k[-1]^α
z[0] = ρ * z[-1] + σᶻ * ϵᶻ[x]
z[0] = ρᶻ * z[-1] + σᶻ * ϵᶻ[x]
end
```

Expand All @@ -82,7 +110,7 @@ Next we need to add the parameters of the model. The macro [`@parameters`](@ref)
```@repl tutorial_1
@parameters RBC begin
σᶻ= 0.01
ρ = 0.2
ρᶻ= 0.2
δ = 0.02
α = 0.5
β = 0.95
Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/sw03.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Work with a complex model - Smets and Wouters (2003)

This tutorial is intended to show more advanced features of the package which come into play with more complex models. The tutorial will walk through the same steps as for the simple RBC model but will use the nonlinear [smets_wouters_2003](@citet) model instead. Prior knowledge of DSGE models and their solution in practical terms (e.g. having used a mod file with dynare) is useful in understanding this tutorial.
This tutorial is intended to show more advanced features of the package which come into play with more complex models. The tutorial will walk through the same steps as for the simple RBC model but will use the nonlinear [smetswouters2003](@citet) model instead. Prior knowledge of DSGE models and their solution in practical terms (e.g. having used a mod file with dynare) is useful in understanding this tutorial.

## Define the model

The first step is always to name the model and write down the equations. For the Smets and Wouters (2003) model this would go as follows:
The first step is always to name the model and write down the equations. For the [smetswouters2003](@citet) model this would go as follows:

```@setup tutorial_2
ENV["GKSwstype"] = "100"
Expand Down

0 comments on commit a0b1941

Please sign in to comment.