# Permanent Income Model 3: Shooting¶

Generalize the model to non-homothetic preferences.

Now $$g(c)$$ depends on $$c$$. There is no closed-form solution.

## Algorithm: Shooting¶

Search over values for $$c_{T}$$. For each:

• Compute $$c_t$$ from the Euler equation (backwards).
• Compute the present value of consumption.
• Check the lifetime budget constraint.

Note: Searching over values of $$c_{1}$$ creates numerical problems in some models.

• Roughly: small changes in $$c_{1}$$ can imply large changes in $$c_{T}$$.
• Example: transition path of a standard growth model (between steady states).
• Higher $$c_{1}$$ implies lower saving, higher interest rate, higher consumption growth
• This creates a feedback loop where consumption growth explodes.

## Interpolation¶

A simple way of finding the optimal $$c_T$$:

• Compute the present value of consumption on a grid of $$c_T$$.
• Interpolate between grid points to find the value that satisfies the budget constraint.

### Algorithm outline:¶

1. Initialize the model (unchanged).
2. Set up a grid for $$c_{T}$$.
3. For each grid point: Solve for the present value of consumption.
4. Interpolate to find the $$c_{T}$$ for which the present value of $$c$$ equals $$Y$$.

Compute the present value of consumption:

1. Input $$c_{T}$$ and model.
2. Compute the consumption path $$c_{t}$$.
3. Compute the present value.

Computing the consumption path:

1. Start with $$c_{T}$$.
2. Compute consumption growth.
3. Compute $$c_{t-1} = c_{t} / g(c)$$.
4. Iterate backwards.

Exercise: write this code - and don't forget the tests

### Root Finding¶

In my solution, the interpolation is simply hand coded. Usually, one would use a package for this (such as Interpolations.jl).

Interpolation is, of course, inefficient. We need to compute a large number of grid points for $$c_T$$.

A better solution is to use a numerical optimizer.

Solving this model is an example of root finding. We are looking for the solution to $$f(c_T)=0$$.

There are various libraries that offer algorithms for root finding and for the more common problem of minimizing a function.

Using these libraries requires that we install packages. In this case, we will use Roots.jl.

See root finding.

find_zero finds the root of a function f(x). This is what we will use.

Excercise: write this code. My solution with test