Using it for an answer you could easily get analytically isn't very useful outside of education/fun.
or would you rather perturbate your variables and resolve mean and variance. My philosophy drives me towards the computational approach over the analytical mathematical approach.
The calculations should be arriving at the same numbers in the end, and implementing a simulation vs. an error propagation tree isn't going to favour the simulation for simple scenarios.
MCM is great for when doing usual error propagation is infeasible. It is sloppy when the error propagation could be done with a one or two analytic formula. Simulation isn't appropriate for problems that are easy analytically. For example, in practice, most of the examples in the article are not suitable problems for breaking out MCM (and although the author probably knows that, maybe not everyone on HN does). The Pi one might be a standard application, but even there Pi in particular is not a great choice for a showcase because Pi has some very nice analytic approximations.
If a modeler has assumed two different models of a situation and are getting vastly different results then that is evidence something is wrong, but it is also evidence that the modeler is out of their depth. It is not appropriate to fit two different models and then claim that the differences are delivering insight. The differences are revealing big gaps in the modelers understanding of key influences, rendering both models highly suspect. They should not be creating models, they should be putting more time into understanding the thing they are modeling.
There are times when a modeler would have two different models, but they should certainly not be surprised that they give different results. Indeed, they should be assuming two different models because they are going to give completely different results. There will probably be other edge cases, but in my experience they are rarer than people just making mistakes about where MCM is appropriate.
For something as straightforward as Bernoulli, where you plug values into a formula and are done, there is no reason to use MCM. However, I am in agreement that in more complicated cases (e.g. a probability distribution is based on some result of one Markov or Markov-like calculation — or possibly multiple), and the theory is slightly or much more complicated then there is a lot of value in Monte Carlo methods.
If I were using simulation it is because I think that something fishy happens in extreme events (eg, maybe stock returns all starting to become highly correlated in a liquidity crisis, destroying i.i.d assumptions). Or as other commenters mentioned because the thing being simulated has a distribution that is not analytically tractable. But there has to be some phenomena in there that is more complicated than standard distributions or a steady state Markov model, because they are more productive models when they work.
> Is there a way to constrain the MC sampling to the tails of a distribution?
You could sample 100 numbers at a time and drop out the middle 95? The question is maybe not well posed.
This example isn't so much different; MCM = screw driver, problem = nail and learning proper statistics = driving to the hardware store and buying a hammer.
The only aspect where the comparison is somewhat lacking, is that the costs of having a hammer (both aquisition and storage) are minimal compared to in-depth knowledge about statistics.
MCM are not strong if the tail variance isn't an important feature of what is being modeled. I've seen simulations where the modeler starts with an analytic model - from which they could trivially calculate the mean and variance of a KPI - then used a MCM simulation to find out essentially what the mean and variance of the KPI.
So I get that this code is just for illustrative, educational purposes. That is fine. Well done Christof, thanks for the contribution to education. But if anyone is actually using MCM to simulate well known probability distributions they should really put the effort in to learning how to work with well known probability distributions. I feel pretty confident that simulating the Bernoulli in a professional setting is a mistake, because I've seen it done and it was a mistake. For amateurs who aren't confident with math then they can use MCM if they like; but statistics is dangerous and they should be aware that they are using the wrong tool for the job and it is a tell they will get other things wrong. You get a lot of insight from a good analytic model.
If there is some interesting tail issue (eg, maybe after 3 heads there is guaranteed to be a tails and your insurance contract pays out on a tails) then sure, use MCM. Great tool if you have the right problem.