# Solving a Permanent Income Model¶

Eventually, we want to solve Huggett (1996), but that's complicated. So we start simpler.

## Model¶

- A household lives for \(T\) periods.
- Preferences are \(\sum_{t=1}^T \beta^t \frac{c_{t}^{1-\sigma}}{1-\sigma}\)
- Lifetime income is \(Y\).
- Lifetime budget constraint: \(Y=\sum_{t=1}^T R^{1-t} c_t\)

## Solution¶

The consumption growth rate is given by \(g(c)=(\beta R)^{1/\sigma}\).

Present value of consumption:

Recall: \(\sum_{t=0}^{T-1} x_t = \frac{x^T - 1}{x - 1}\)

Therefore:

## Algorithm¶

- Inputs: \(Y, R, T, \beta, \sigma\).
- Compute \(c_1\).
- \(c_t = c_1 g(c)^{t-1}\)

Excercise: write this! My solution

## Testing¶

We need a test.

This is where using packages comes in handy: it makes writing tests easy.

For now, we just wing it and write a test script.

We want to test:

- Euler equation holds.
- Budget constraint holds.

Exercise: write this!

## Changing the Utility Function¶

In real world applications, you want to explore alternative functional forms etc.

Let's try log utility instead.

In our simple example, this is easy because log utility is just the special case of \(\sigma=1\).

But let's pretend this were not the case (we cannot try any old utility function because we have baked into our solution that consumption growth is a constant).

This simple change requires that we hunt through all of our code to find which lines depend on the functional form for utility.

Once we have found all of those, we need to replace each with

```
if logUtility
# use the log expression
else
# use the CRRA expression
end
```

And then we have to keep track of the fact that each utility function requires its own set of parameters.

Those parameters have to be passed from one function to the next all throughout the code.

There has to be a better way!