Economic Flat Earth revisited

[EDITED] I now have another case of the economic flat earth problem, this time in the context of precautionary savings. TL;DR: more than likely caused by latent problems when experienceassetz attempts to interpolate points that border on -Inf.

Starting from LifeCycleModel21, my agents also have the opportunity to invest in a retirement scheme and/or solar+battery shares. The former pays 7%, with employers matching employee contributions, but funds cannot be withdrawn until retirement. The latter offset energy costs efficiently (up to zeroing them out when generation/capacity equals energy consumption) and generates income weakly (crediting half the value of excess generation to other income that is not eligible for retirement funding).

I think the root cause is that when the return function delivers an infeasible solution to ValueFnIter_FHorz_ExpAssetz_raw, that -Inf value poisons all the “preceding” age calculations. I came to this conclusion by changing the ExogShock function to make the Z value in the employment/unemployment interpretation a 50/50 split and saw precautionary spending as expected. As I shifted how much my agent is paid while employed vs. unemployed, I saw the precautionary spending disappear the moment that the unemployment benefit fell below retirement contributions and energy costs. I.e., as soon as the ReturnFn ever returned -Inf.

I know that the code to deal with -Inf in grid interpolation is still fresh (which experienceassetz does in its own way). I think I hit that edge case. So I’ll use a large negative number for now.

As for my other ramblings…the changes I made to grid sizes et al did have various side-effects that likely make the -Inf not reachable. That was the real problem. With a large negative number, judiciously applied, things behave now as expected.

I’ll write more when I’m more confident about the sources of (programming) error.

For reference:

My return function: QEA-2026/QEA_ReturnFn.m at main · MichaelTiemann/QEA-2026 · GitHub

I think I have found a better way to describe my problem, which leads to both a solution and a conundrum.

Imagine a model where agents can decide whether to buy alcohol or see a movie, but only if they have enough money at the end of the week. Agents below the legal drinking age cannot buy alcohol at all (regardless of their assets). Agents who have better or worse luck with employment may have discretionary assets to spend or not.

If we forbid agents based on agej, all agents of that age are forbidden, so we can return -Inf to exclude their choice. Easy.

If we forbid agents based on sufficiency of a, and F ultimately depends not only on a but also on z or e, then returning -Inf for the unlucky ones can prohibit all agents who share probabilities with the unlucky ones. I think this is one of the cliffs of the economic flat earth phenomena I’m confronting.

If instead of returning -Inf, we highly disfavor those who don’t have the means, but allow those with the means to exercise their choice, the resulting value function for the cohort is the finite weighted probabilities of the agents and their respective scores. If most can afford the choice, and a few cannot, the weighted score will be favorable and the Mean will reflect it. But it also means risking the fact that we make it possible for cohorts who all lack sufficient means to slip through, albeit with a low Value function. (Aside: this is not unlike the distinction when using sum with includenan vs. omitnan.)

What is the “right” way to write value functions so that we can see heterogenous effects across agents without either (1) permitting all to make impossible choices that none can afford, or (2) forbidding all to make choices that some could legitimately make?

And just to check the maths: what happens to agents who are forbidden by all choices at a given stage? Do they simply disappear? And if so, should they take weight with them or not (by allowing a forbidden state to gain weight that does not otherwise affect the value functions as the model evolves)? I still lack an intuitive grasp of this aspect of the Toolkit.

What makes all of this more interesting/complicated is debt: a debt-funded aprime at one point in time may prove infeasible at another. When and how we mark states truly infeasible or merely disfavored has significant implications across both the Means and the Minimums/Maximums.

Here you can see the delineation of unlucky agents (chronically unemployed, then medical problems). In my new return function, there’s a Jubilee when agej==Jr (meaning that if they make it that far, debt is forgiven). You can see the unlucky agents being crushed by debt as their assets turn increasingly negative over time. The blue line is Mean, Purple and Yellow are Q19 and Q2 quantiles, and green is Maximum.