# Choice of priors to connect a half-life random variable with a Bernoulli trial

In my application (spaced-repetition system for quizzes), I have an unknown half-life (in units of time), $h>0$. This half-life governs a Bernoulli trial $X$, such that $P(X=1) = 2^{-t / h}$, for some known, deterministic time $t>0$ (same units as $h$, this corresponds to when the Bernoulli test was conducted).

I’d like to know what prior to place on $h$ such that the posterior $P(h | x)$ is conjugate, i.e.,

• $h \sim \, ???$ such that
• $π = 2^{-t/h}$, a deterministic function, and
• $x \sim Bernoulli(π)$, so that
• the posterior $p(h | x) \propto p(x | h) \cdot p(h)$ has same structure as $p(h)$, i.e., conjugate.

I’d be happy to give $h$ a Gamma prior, because that’s conjugate to the Exponential distribution, which $π$ appears to have, up to a constant factor, but my experimental result, $x$, is binary-valued, not a count as expected by an Exponential random variable.

I’d also be happy to give $π$ a Beta prior, since that’s the conjugate prior to the Bernoulli distribution, but I can’t find a neat way to convert a Beta-distributed $π$ into any kind neat distribution on $h$.

I’d like everything to be conjugate to allow for quick updates for online updates (i.e., successive $x$ will come irregularly as a student learns a fact). If I must do MCMC, that’ll greatly expand the memory/storage requirements between updates.

• Why do you need $\pi=2^{-t/h}$? A Beta-Bernoulli model followed by sampling from the posterior of $h$ (given $\pi$) seems much easier. – jth Apr 10 '17 at 1:40
• @jth Thanks for the note. I need some way to capture the Bernoulli probability on the passage of time $t$, and in the application, exponential decay is the standard one. (This matters because if we model each fact a student is learning as exponentially evaporating from memory, this model has to tell us which fact is closest to being forgotten right now.) I wonder if there’s some way to normalize time with $h$ and use Beta-Bernoulli… I will see! – Ahmed Fasih Apr 10 '17 at 1:58
• @jth I think I see what you mean. I can draw samples of $h$, convert to $π$ and fit a Beta distribution, update the posterior conjugatedly, convert the resulting $π$ back to $h$ and fit a Gamma to it again. I like it! – Ahmed Fasih Apr 10 '17 at 2:12

After some Monte Carlo simulation and analysis, I realized that the half-life $h$ in this context is totally a nuisance parameter and that I can deal solely with priors on $π$.
I wrote up the math to accompany a little (Python) library I wrote: https://fasiha.github.io/ebisu/ but in a nutshell, rather than a prior on $h$, I just put a Beta prior on $π$ at some time, and then propagate that distribution through time via the deterministic equation $π = 2^{-t/h}$ (which makes the new prior non-Beta), then apply the Bernoulli likelihood analytically, before fitting the final posterior to a new Beta distribution to function as the prior for the next round.