# I used a Monte Carlo simulation to pick my health insurance plan

We have to pick a new health insurance plan this month, and we've had a tough time making the decision.

You can't just add up what you'll spend - what each thing costs depends on how much you've already spent!

And some things are inherently probabilistic - will I go through procedure X this year? How many visits will I need for condition Y? How many urgent care visits?

So complex and uncertain!

Inspired by vaguely recalling that I read Lucas F. Costa's blog post some time ago, I applied the Monte Carlo method to my health insurance decision.

I have a simplistic understanding of Monte Carlo simulations:

- Assign probabilities to everything that can happen in your scenario
- Randomly selecting outcomes for each possible event, then repeat the calculations a gazillion times
- Measure how things typically play out

It can get much fancier (hello, MCMC!) but I think that's the gist of it.

I put together a simple TypeScript file with some arithmetic operations and calls to `Math.random()`

and ran it with Bun. I punched in all the reasons my wife and I will or might spend on healthcare, added in the premiums, and took the average result.

Surprisingly, the expensive plan will save us a couple thousand dollars this year, even accounting for the higher premiums.

I feel better about the decision since I did something resembling rigorous calculation of which plan is best. Usually I just guesstimate and anxiously hope for the best.