# Home Made Annuity

The Home-Made Annuity is what I call an annuity made from another investment. For example, investing a lump sum of money into the S and P 500 and pulling out $X every year. The question I aim to answer is exactly how much should be deposited initially, given outflows of $X for n years, which is the present value of this annuity.

## Simplifying Assumptions

This model makes the following assumptions:

- The money received each year from the annuity is adjusted for inflation, but constant in base year dollars.
- The present value of the annuity is positive
- The cash flows out are positive

This model uses the following variable definitions:

- is the return or interest in period i
- is the inflation in period i
- is the dividend payment in period i, after taxes (in dollars)
- is the fee payment at period i ( in dollars)
- is the present value of the annuity for n periods
- is the money required out of the fund, in base year dollars, every year
- is the money required out of the fund after accounting for taxes, in base year dollars, every year

Let = and =

## General Model

The basic definition of the present value of an annuity:

where n is the number of periods, and r is the rate (6% => r = 0.06). This model is the closed form of the sum of annuity payments discounted at rate r in each period; however, it won't be needed. The model takes into consideration the additional variates mentioned above.

The objective is to find out the amount that is needed to invest today, to pull out $X, adjusted for inflation, each year for n years. Let represent the annuity's value at period i, the initial investment, in 2 years, will be equal to:

This starts to get nasty quickly. What’s happening is that every year the fund appreciates by value , dividends enter the fund, feed leave the fund, and A (some inflation) is withdrawn. For this model the end value must equal 0, so that only what is required to make the yearly withdrawals is deposited in the beginning. After doing this, the above formula can be solved in a more general sense to get an expression for .

For the 2-period scenario, this is a nice compact solution in the form of a sum. What about the n period scenario? A rigorous proof by mathematical induction would suffice, but I thought about it for a while and the n period sum makes sense logically, so I'll leave it as a proof by observations that

Not bad. This looks strikingly similar to the original Present Value of an annuity formula, this one cannot be made compact as all rates are variable and change in this model (like they do in real life). But there is still the problem of ; recall that these numbers rely on the balance of the annuity lump sum in period i. That is, they rely indirectly on . This means there is no direct solution to the problem (or at least not one worth trying to derive, if it exists, it’s REALLY nasty), only a function of the solution that equals some constant.

## Dividends and Fees

How exactly is defined? Recall that it is the amount of money deposited in dividends at period i, not the percent return. This number is unknown! The dividend yield as a percent of the amount that is currently invested is, however, know. The dividends cannot be taken out as a percent return in period i in the model because taxes must be paid on them before re-investing, so they are defined to be cash payments. They also cannot be applied like the value A because they change in each period and are directly proportional how much money is currently in the fund. The model fee's 's are treated the same way, although the investor does not pay taxes on them. It may be possible to view them more like the 's, but as the math unfolds, it will become clear that this adds no run time to the model. For my own convenience, if I were to build the model as the vendor of the annuity, this model makes it easy to shift the tax burden to the fee's collected.

To find , must first be derived, the balance of the annuity in the bank at period i. To define that, the dividends in the prior period and the fees in the prior period are first required. Assuming that : the dividend yield in period i and : the fee percent in period i are know:

## Tax Function

Taxes, in the real world, are progressively calculated by tax brackets, and the tax function t() reflects this. The bracket function is a non-differentiable, not continuous, strictly increasing step function. The tax function takes dollars in the base year and returns the amount of dollars that would be paid in federal and state capital gains tax. The dollar amount input has to be deflated to the base year, and the tax amount returned has to be inflated to the year when returned.

A vs P: P is defined as the amount desired each year, and A as the actual amount that must be pulled out of the fund to make that happen (both in base year dollars). So how is A defined in a formula?

Looks good. Although, while taxes have been accounted for, tax on the taxes has not! If A is defined as above, less then P dollars will be returned. The real formula is

Awesome problem solved. Although ... now the tax on the tax increase that is being pulled out is increasing the tax, requiring more to be pulled out, to truly receive P dollars each year! This will recurs infinitely, more, but a decreasing amount, of money will have to be pulled out of the fund to account for this difference; an approximation of A will have to suffice.

Probably, accuracy around a tenth or hundreth of a cent is good enough.

## Concise Model

With all the pieces in place, the exact form of the model comes into focus. Recall the general formula for the value of the annuity:

Let ; this is the function of the solution, and the RHS of the equation above will remain constant with respect to the solution; so it can be calculated once and then let equal C. The new formula to solve is

Instead of trying to solve it explicitly, because of the complexity, the proper may be found with logarithmic convergence using a (kind of)Newtonian algorithm for guessing the solution. This is possible because is strictly positive and our objective function is strictly increasing.

I've written out the general form of the solution algorithm in sudo-python.

## Algorithm

```
# first, calculate phi and psi (doable in o(n) time for number of periods), hold on to them
# next calculate C with this function, hold on to it as well.
def function1:
C = 0
for i in range(1,n+1):
C += (A * phi[i])/psi[i]
return C
# for our best guess, a_n
def function2:
S2 = 0
f = [0]
d = [0]
B = [alpha_1 * a_n]
for i in range(1,n+1):
B[i] = alpha[i]*(B[i-1] - A*phi[i-1] - f[i-1] + d[i-1])
f[i] = B[i] * F[i]
d[i] = B[i] * D[i] - t(B[i]*D[i]/phi[i])*phi[i]
S2 += (f[i]-d[i])/psi[i]
return S2
# make guesses until we get it right, narrow down choices logarithmically.
def function3:
lowInitial = .01 # a reasonable lowest guess of the anuitys value
highInitial = A * n * 10 # 10 times how much we're taking out. Very high.
lowGuess = function2(lowInitial)
highGuess = function2(highInitial)
while 1:
newInitial = (highInitial + lowInitial)/2
newGuess = function2(newInitial)
if abs(newGuess-highGuess) > abs(newGuess-lowGuess):
highInitial = newInitial
else:
lowInitial = newInitial
# precision down to 1/1000 of a cent. We can change this precision to improve performance
if newGuess - C < .00001:
return newGuess
```

# The Quick and Easy Way

Wow math sucks a lot. This is a cool formula, but it's abstract; I certainly don't have a real world interpretation of the constant C nor the function . After thinking about it, I decided there's a much simpler way to do this. The function used to logarithmically pick a good solution to the LHS of the equation above can be repurposed to find the root of a recursively defined function that finds the value of the annuity at time i. This is the same function from the general model:

Except re-defined recursively for period i:

is no longer needed. When the true value of the annuity is correct, will hold. Let this new recursively defined objective function of be known as . Fortunately, f() is strictly increasing; the more one invests the more they receive (always true, unless somehow an investment was so bad it put its shareholders in debt). Guessing the that satisfies this is just as easy as finding the thats satisfies .