Archive for Bayes theorem

broken random generators

Posted in Statistics with tags , , , , , , on July 22, 2026 by xi'an

Nothing exciting or catastrophic here! Just a Friday afternoon puzzle entry on the successor to The Riddler (which I had not visited for a long while)… The first riddle reads as follows:

A random number generator on my calculator should generate random numbers between 0 and 1. But my suspicion is that the calculator is “tanked,” meaning it only generates random numbers between 0 and some value 0 < a < 1. Beyond that, I have no knowledge regarding the value of a. At the moment, it’s equally likely to be any value from 0 to 1. As an experiment, I ask the calculator to generate one random number. It produces a value of exactly 0.5. Based on this result, what can I expect the value of a to be, on average?

This is a direct (Bayesian) calculation of a posterior expectation when a given x=0.5 (a Uniform (0,a) realisation) is distributed as 1/(a log(2)) over (½,1), with expectation 1/(2 log(2)), about 0.72.

The added riddle just modifies the conditioning event (bringing it closer to Bayes experiment):

A second calculator is similarly “tanked.” As before, every value of a between 0 and 1 is equally likely at first. A friend generates one random number and only reveals that it’s somewhere between 0 and 0.5. On average, what can I expect the value of a to be?

This is also a direct (Bayesian) calculation with a Bernoulli output z, with probability min(0.5,a)/a, which results in a posterior expectation of a equal to 3/(4*(1+log(2))), about 0.44. And… I happened to get selected for my (correct) answer to this question!

BAYSM 2025 [registration and abstract submission]

Posted in Statistics, University life with tags , , , , , , , , , , , , , on February 19, 2025 by xi'an

Bayesian inference from the ground up [no book review]

Posted in Books, Kids, Statistics, University life with tags , , , , , , , , , , , , , on November 7, 2023 by xi'an

an introduction to MCMC sampling

Posted in Books, Kids, Statistics with tags , , , , , , , , , on August 9, 2022 by xi'an

Following a rather clueless question on X validated, I had a quick read of A simple introduction to Markov Chain Monte–Carlo sampling, by Ravenzwaaij, Cassey, and Brown, published in 2018 in Psychonomic Bulletin & Review, which I had never opened to this day. The setting is very basic and the authors at pain to make their explanations as simple as possible, but I find the effort somehow backfires under the excess of details. And the characteristic avoidance of mathematical symbols and formulae. For instance, in the Normal mean example that is used as introductory illustration and that confused the question originator, there is no explanation for the posterior being a N(100,15) distribution, 100 being the sample average, the notation N(μ|x,σ) is used for the posterior density, and then the Metropolis comparison brings an added layer of confusion:

“Since the target distribution is normal with mean 100 (the value of the single observation) and standard deviation 15,  this means comparing N(100|108, 15) against N(100|110, 15).”

as it most unfortunately exchanges the positions of  μ and x (which is equal to 100). There is no fundamental error there, due to the symmetry of the Normal density, but this switch from posterior to likelihood certainly contributes to the confusion of the QO. Similarly for the Metropolis step description:

“If the new proposal has a lower posterior value than the most recent sample, then randomly choose to accept or
reject the new proposal, with a probability equal to the height of both posterior values. “

And the shortcomings of MCMC may prove equally difficult to ingest: like
“The method will “work” (i.e., the sampling distribution will truly be the target distribution) as long as certain conditions are met.
Firstly, the likelihood values calculated (…) to accept or reject the new proposal must accurately reflect the density of the proposal in the target distribution. When MCMC is applied to Bayesian inference, this means that the values calculated must be posterior likelihoods, or at least be proportional to the posterior likelihood (i.e., the ratio of the likelihoods calculated relative to one another must be correct).”

which leaves me uncertain as to what the authors do mean by the alternative situation, i.e., by the proposed value not reflecting the proposal density. Again, the reluctance in using (more) formulae hurts the intended pedagogical explanations.

baseless!

Posted in Books, Statistics with tags , , , , , , , , , , on July 13, 2021 by xi'an