Live data from Hacker News

How to replace estimations and guesses with a Monte Carlo simulation

lucasfcosta.com

71–80 of 162 posts

Re: How to replace estimations and guesses with a Monte Carlo simulation

#71
post #39
post #18

Earlier quoted context omitted.

GIGO, the first thing I learnt, as I entered the industry 20 years ago. This was from a 60 year old engineer who told me that experience is only a nice name for "all the @#$% I made I will try not to make again". A very nice thing about Monte Carlo simulation is that at the end your distribution of results are all within the feasible range. If you do error propagation using uncertainty on your parameters, you can get…

> A very nice thing about Monte Carlo simulation is that at the end your distribution of results are all within the feasible range. I guess Monte Carlo helps provide conservative estimates behind a façade of rigour, but the truth of the matter is that in the end it's still GIGO. Any empirical distribution only reflects the empirical measures that were used to generate it. If you bundle everything from the time it too…

I’m smiling a bit while reading your comment. You are completely correct that that estimate is virtually meaningless. And yet… that doesn’t mean it’s completely useless!

I’ve been using a somewhat meaningless Monto Carlo inspired approach to project planning for a while in my consulting company. The vast majority of the projects I do have only a small amount in common with previous projects, so when I’m estimating I’m informed by past estimate vs actual numbers, but not really relying on much other than intuition and gut feelings from past work.

My basic approach is to estimate 2- or 3-sigma upper/lower estimates for each task, modelled (incorrectly) as a Normal distribution in hours, and then sum the random variables to come up with a final distribution (whose variance is quite a bit smaller than what you see on the original bag of tasks). From there, if I am making a quote, I’ll quote at +3-sigma x hourly rate as a high-end effort estimate. If it seems like a very meeting-heavy client, I’ll either add meetings in as development tasks or just pad it out by a %age or fixed hours/week.

This technique has worked amazingly well for me, and it’s been quite rare that I blow the estimate, and in the… one time I can think of, we missed by very little and there were tasks that we hadn’t thought of when we did the estimate.

To your point though (with walking the dog), there’s a really key thing that this process doesn’t capture, somewhat on purpose: the resulting estimate is in effort-hours, not delivery date. While modelling per-task effort hours as Normal is suspect, modelling task delivery dates as Normal is completely irrecoverably wrong: delivery dates, in my experience, only ever slide in one direction. People get sick and the project slips a week; people don’t ever get super healthy and effectively knock out 80 or 120 hours worth of tasks in a week.

I honestly haven’t found a good way to estimate delivery dates very well. At one point I did put together some regression on my “actual billed hours per week” based on my billing, but ran into the same problem. “Oh, my dog died and my mother-in-law got sick during that project.”

Someone who’s better at statistics might have a better way to model that as a high-skew distribution, but when I tried doing that myself I ended up with a distribution that didn’t feel like it did a good job of capturing the non-negligible long tail of things that slow down calendar estimates without burning hours.

Re: How to replace estimations and guesses with a Monte Carlo simulation

#72
post #44

While a different application than shown here, my project management class taught me one of the biggest benefits of Monte Carlo simulation - estimating uncertainty. Traditionally, net present value calculations are done with single point estimates. For example, analyzing a rental property we want to buy, we'd estimate the vacancy rate, interest rate, property appreciation, maintenance expenses, and do all of that on…

Estimating uncertainty is preferred, but if you have people who insist on a single number, then teach them that it should be the median instead of the mean. Means tend to overvalue "moonshots" where there's a 99% chance you lose money, but if the payoff in that 1% where you win is large enough, it can still result in a positive mean. And a mean can often be an outcome that isn't actually possible, but falls between s…

Heh, when people ask for a single number estimate, I give them mu + 3-sigma. If you’re curious, I’ve got a sibling comment that describes a bit more.

Re: How to replace estimations and guesses with a Monte Carlo simulation

#73

While a different application than shown here, my project management class taught me one of the biggest benefits of Monte Carlo simulation - estimating uncertainty. Traditionally, net present value calculations are done with single point estimates. For example, analyzing a rental property we want to buy, we'd estimate the vacancy rate, interest rate, property appreciation, maintenance expenses, and do all of that on…

It's not just business people. I have yet to find a task tracking system (Jira etc.) that lets you assign a range of points to a task. People try and use nonsense like Fibonacci numbers to imply uncertainty, but then just add up all the numbers to get a number with no uncertainty measure.

Story points are a curse on the software development industry. However much people say "they're indicative, and don't map to hours", someone, somewhere, will map them to hours.

The most accurate project plan I was ever involved in had only 3 values that could be assigned to a piece of work during the early estimation phase: hours, days, and weeks. Each of those was then turned into a range of possible hours they could represent, with that range expanding as you got into larger units. You could then slice and dice the numbers however you choose to get anywhere between the most pessimistic timeline to the most optimistic timeline. Probably unsurprisingly the project was delivered somewhere between the two.

Re: How to replace estimations and guesses with a Monte Carlo simulation

#74
I think it's understandable why programmers dread doing estimates so much. But I believe there are multiple factors contributing to the current overall mess and the guilt should be shared among several areas -- and that includes us.

Estimates are often, if not always, mistaken as commitments or deadlines. But we don't do a great job on explaining that estimates are probabilistic by nature, there are risks involved, and leaving those risks entirely to developers may be comforting at the beginning, but harmful to the entire Organization in the long term.

Granted, that would be a huge cultural change, which surely is not going to happen overnight. Besides, political conditions are seldom in our favor. But I advocate that we should do the possible to dialogue.

Re: How to replace estimations and guesses with a Monte Carlo simulation

#75

Code used Rust, interesting, I have come to expect Python and just recently used the open source version of Matlab called Octave.

Author here. I thought no one was going to make comments about Rust, but I just loved using it for this post.

Thanks, Peter :)

Re: How to replace estimations and guesses with a Monte Carlo simulation

#76

I really dislike posts in this vein, because they use statements like "This post will teach you how to replace estimations and guesses with a Monte Carlo simulation." as though the output of a Monte Carlo simulation were not an estimate, but some higher truth. The process of simulating many different outcomes with a touch of randomness gives the layperson the impression that we are really _doing_ something, when in f…

Author here. Thanks a lot for your feedback.

Indeed, "estimations" might not be the best word as you're still, in some way, estimating with the Monte Carlo approach. I thought of this differentiation because I consider the MC approach to yield a forecast, while an "estimation" is the typical term used in agile settings for "guessing how long/much work it will take.". I'll think of ways of making this distinction clearer.

As for the misused mathematical terminology I guess you're referring to "confidence intervals"? If so, I understand it also has a clear definition within statistics, but I used it in the broader sense. I'd be grateful if you could point out which terms you'd recommend replacing and what you think I could replace it for.

Thanks a lot.

Re: How to replace estimations and guesses with a Monte Carlo simulation

#77

I think it's understandable why programmers dread doing estimates so much. But I believe there are multiple factors contributing to the current overall mess and the guilt should be shared among several areas -- and that includes us. Estimates are often, if not always, mistaken as commitments or deadlines. But we don't do a great job on explaining that estimates are probabilistic by nature, there are risks involved, a…

When I am leading teams, I also ask for a certainty score along with the estimate, then track them together with daily updates. Like all human processes it is not infallible but it allows more reliable planning. I always wish I had a tool that would include this in the estimate process. Hansoft got close but nobody uses it!

Re: How to replace estimations and guesses with a Monte Carlo simulation

#78
I think that one of the factors making it so difficult to produce accurate estimates on software projects is their usually high levels of variability. There are often so many big differences between projects and it's hard to consistently draw lessons from past experiences.

However, it seems that when such variability is low, it gets easier to make predictions.

I've seen an ERP company which used to provide good estimates for most of their customization projects. However, they used a home-built, suited-to-the-task programming language, the team was experienced and relatively stable, and the projects' scopes were usually narrow.

Those factors are not easily reproducible, for sure. But I believe they indicate that taking measures to reduce variability and standardize processes may pay dividends in the long run -- projects may take longer than they would take under agile approaches, but the improved predictability may be desirable.

Re: How to replace estimations and guesses with a Monte Carlo simulation

#79
The issue with focusing on realistic estimates is it omits the psychology of deadlines, incentives, ownership, competitiveness and determination.

Going back to your university days, who hasn't left things to the last minute and been amazingly productive in the last couple days before the coursework or exam was due?

The issue with aggressive deadlines is burnout, creative oppression, flawed risk management etc

As always it's a balance. Grass is always greener but chances are it's neither.

Re: How to replace estimations and guesses with a Monte Carlo simulation

#80

I think it's understandable why programmers dread doing estimates so much. But I believe there are multiple factors contributing to the current overall mess and the guilt should be shared among several areas -- and that includes us. Estimates are often, if not always, mistaken as commitments or deadlines. But we don't do a great job on explaining that estimates are probabilistic by nature, there are risks involved, a…

> Estimates are often, if not always, mistaken as commitments or deadlines

This. This is the problem with "estimates."

My solution - and this will sound bad - is to over-estimate.

Post reply on HN