Feb 5, 2026

GPT Prompt06 - Stochastic Present Value

 We are here -- this is the end, btw -- in my GPT Prompt Series

  • GPT Prompt 01 - Spending Strategy Comparisons
  • GPT Prompt 02 - Lifetime Probability of Ruin (LPR)
  • GPT Prompt 03 - Dynamic HJB Spend Optimization 
  • GPT Prompt 04 - Portfolio Longevity Heat Map 
  • GPT Prompt 05 - Perfect Withdrawal Rate (PWR) 
  • GPT Prompt 06 - Stochastic Present Value (SPV) <-- [this post]

When we say "Stochastic Present Value," all we mean is:
  • We are just valuing a cash flow over some interval, either fixed or life contingent, 

  • Rather than the discount rate being deterministic we are making the rate a random variable where the rate choice is a bit subjective [note 1]. That means unlike a single number result, as in an NPV calc, we end up with a distribution of results related to the randomness of the variable. That distribution has its own analytic virtues which I won't dwell too much upon, 

  • The "use case" for SPV in Retirement Finance is often found in a "feasibility" test or: is our current wealth sufficient to fund the expected cash flow. In this sense it is very much a Pension Risk tool in addition to being part of a retiree's dashboard or the "can I even..." go or no go flag,

  • When the interval is life-contingent we are more or less pricing an annuity and the price of market annuities can be used to gauge feasibility just like SPV. In addition the annuity price can be used to monitor boundary conditions as retirement evolves (boundary monitoring is not in this post). I only have access to immediateannuities.com btw, and, importantly:

  • We may be over complicating things by just a bit. In the end, just running a simple or actuarial balance sheet (the latter of which also values cash flow liabilities but deterministically. See Ken Steiner's site https://howmuchcaniaffordtospendinretirement.blogspot.com/ for the gold standard) is often good enough. We are not managing a pension fund,

  • With SPV feasibility, we are saying something very very close to the fail metrics in a forward looking sustainability diffusion tools like Monte Carlo (MC) simulations,

  • The cash flow itself can be stochastic...or a step function, or shaped up or down or a U or a hump, or whatever. Not in this post, tho.

GPT Prompt05 - Perfect Withdrawal Rates

We are here in my GPT Prompt Series
  • GPT Prompt 01 - Spending Strategy Comparisons
  • GPT Prompt 02 - Lifetime Probability of Ruin (LPR)
  • GPT Prompt 03 - Dynamic HJB Spend Optimization 
  • GPT Prompt 04 - Portfolio Longevity Heat Map 
  • GPT Prompt 05 - Perfect Withdrawal Rate (PWR) <-- [this post]
  • GPT Prompt 06 - Stochastic Present Value (SPV)

In 2015, Suarez, Suarez and Waltz, out of Trinity University, wrote a paper "The Perfect Withdrawal Amount: A Methodology for Creating Retirement Account Distribution Strategies" that describes the Perfect Withdrawal, the amount, with perfect foreknowledge of returns, that can be periodically taken from a portfolio over some interval (a life or horizon) and then end at some terminal boundary (say death) with zero dollars (or alternatively with a remainder bequest).  From the paper, the core math is this: 
where n is in their case a fixed horizon, ri... is a known sequence of returns and K(E) is a bequest and K(s) is the starting endowment. We can set K to zero in the no bequest case and we can also animate r via simulation while also making N a life contingent distribution of possibilities using actuarial math. That latter N thing was my innovation added onto Suarez by the way, it was not in the paper. That version can be represented more like this (Suarez writes it in accumulated-value form; I wrote it in discounted-value form):



Feb 4, 2026

GPT Prompt04 - Portfolio Longevity Heat Map

This may, in fact, be the least useful and perhaps the hardest to explain, in terms of its usefulness, of the miscellaneous prompts in my recent Prompt Series:
  • GPT Prompt 01 - Spending Strategy Comparisons
  • GPT Prompt 02 - Lifetime Probability of Ruin (LPR)
  • GPT Prompt 03 - Dynamic HJB Spend Optimization 
  • GPT Prompt 04 - Portfolio Longevity Heat Map <-- [this post]
  • GPT Prompt 05 - Perfect Withdrawal Rate (PWR)
  • GPT Prompt 06 - Stochastic Present Value (SPV)
My original goal in doing this type of exercise was to create a simple XY chart for (infinite horizon, not 30 years or "to 95") portfolio longevity (X axis) at "all" spend rates (Y axis) rather than just one. I thought it looked pretty cool but my quant-friend David: "why would you even do that? How is this used?" To which I might have said: "I have no idea, I just think it is interesting to behold the relationship between spending rates and portfolio-lives in all its glory, no real necessary functional use for a retiree." I mean, that's a little tongue-in-cheek, I will grant, but it is mostly true. The best I can say is that understanding how portfolio longevity (entirely unconstrained by years or terminal life or anything) responds to spending (all of them) and then understanding the sensitivity of portfolio longevity along its spend-path critical points is worth at least one minute or two of thought. Whether it improves retirement decision making is totally up in the air. This just falls into the category of "I wanted to see what it looked like" and here we are.  

GPT Prompt03A - HJB Spending Optimization

Fair warning: this was the most annoying prompt in history. I have almost never gotten this to replicate or work well or right twice in a row and my lesson was that the more specific I got the more it screwed up and the fixes it recommended just made things worse and worse until I was in a death spiral. My guess is that this kind of prompt will bedevil others, too. Backing up and keeping the prompt high level and letting it do it's own thing was better. A little black-boxy but at least one can interrogate.

So, here we go: this Post is my attempt to create a prompt for a formal Hamilton–Jacobi–Bellman approach to optimize retirement spending by age using backward induction and stochastic dynamic programing (the AI's job this time, not mine. I once did one of these in R-code but it took me a month, ran forever, and I was never sure if what I had was right or even close). This is consumption-only, btw, and I am not solving the joint consumption-allocation problem. I asked Chat once about that joint solution and it implied that it was maybe a little too computationally intensive to even bother. You can try, tho. 

In the context of my prompt-project this is where we are:

  • GPT Prompt 01 - Spending Strategy Comparisons
  • GPT Prompt 02 - Lifetime Probability of Ruin (LPR)
  • GPT Prompt 03 - Dynamic HJB Spend Optimization <-- [this post]
  • GPT Prompt 04 - Portfolio Longevity Heat Map
  • GPT Prompt 05 - Perfect Withdrawal Rate (PWR)
  • GPT Prompt 06 - Stochastic Present Value (SPV)

Feb 2, 2026

GPT Prompt02 - Lifetime Probability of Ruin (LPR)

Wait, isn't Lifetime Probability of Ruin (LPR) just another Monte Carlo retirement fail-rate thing? No, sort of but not really.  LPR is rooted in (or is) the Kolmogorov PDE for Life Probability of Ruin that I first saw in Milevsky's Seven Equations book.  Took me a while to figure it out, though. I once even taped the PDE on my fridge for an entire year to see if anything would sink in. Finally, at about the year mark, I had a dream where the coefficient of the 2nd term was spinning in a circle. I woke up and thought: "damn, I know what that is!" and I walked to my desk, coded it as a loop and holy crap it worked. Here is the 7 Equations version:


The epiphany on waking was that the "1" was a unit of consumption subtracted from a wealth process and that we were dealing with a mortality weighted infinite MC sim. After that it was a piece of cake. Plus I had the finite differences solution for the PDE above that Prof Milevsky had once sent me. Except for the wobble of simulation, the two solutions, mine and his, looked perfectly aligned.

Now, the reason I like LPR and why it is different from a standard MC fail-thingy is that the MC fail-thingy, which delivers a "probability of retirement ruin" number, under-imagines the real problem and disrespects the full scope of the idea. By that I mean, in Prof Milevsky's words, LPR considers the "full constellation of asset exhaustion possibilities" to infinity (not just an arbitrary 30 years) as well as the full term structure of mortality to infinity (not just 30 years or to age 95 tho in practice we might limit it to ~120 years of age total and the whole sim doesn't really need to go past about 100 or 200 years and any portfolios that survive to 100 or 200 are to be considered "forever" portfolios. I think I ended up using 100 back in the day but I see 200 below. Can't remember). MC sims usually elide themselves right past all this full composition stuff. Plus, note that compared to finite differences and PDE solutions we can also play around with non normal return distributions tho it is easier to not do that.

Here, btw, is where we are in this mini-series of Prompts:

  • GPT Prompt 01 - Spending Strategy Comparisons
  • GPT Prompt 02 - Lifetime Probability of Ruin (LPR) <-- [this post]
  • GPT Prompt 03 - Dynamic Programming / HJB
  • GPT Prompt 04 - Portfolio Longevity Heat Map
  • GPT Prompt 05 - Perfect Withdrawal Rate (PWR)
  • GPT Prompt 06 - Stochastic Present Value (SPV)

GPT Prompt01 - Consumption Utility Strategy Evaluation

I slaved for 12 years! in the mines of this blog, toiling night and day, for all three of my readers. My now ex gf during five of those years once accused me of loving retirement finance and my computer more than her ;-) something which I can neither confirm nor deny, then or now. 

Recently, just for fun and to see how it would go, I spent a couple hours recreating and recasting five or six of what I consider my sufficiently important or interesting coding projects into AI prompts <dramatic eye roll on all those wasted years>. I maybe should have waited for the advent of AI and saved myself at least some of those 11.999 years where I maybe didn't have to do anything. Or gone to a bar. Or traveled. Whatever, I thought I would share some of the prompts and projects here. To wit (each will be a separate post):

  • GPT Prompt 01 - Spending Strategy Comparisons [this post]
  • GPT Prompt 02 - Lifetime Probability of Ruin (LPR)
  • GPT Prompt 03 - Dynamic Programming / HJB
  • GPT Prompt 04 - Portfolio Longevity Heat Map
  • GPT Prompt 05 - Perfect Withdrawal Rate (PWR)
  • GPT Prompt 06 - Stochastic Present Value (SPV)