# Time in Laplace's rule in the context of a "for all" problem

We are working with a sequence of independent binary events on a discrete time-scale, say seconds, with success probability $\pi$. Call this sequence of events $X_{t}$, $t=1\ldots$. For instance, $X_{t}=1$ if it rains at second $t$ and $0$ otherwise. For each positive integer $m$, define the “for all”''"-type variable

$$Y_{t}^{m}=\begin{cases} 1 & \text{if }X_{t(m-1)+1}=\cdots=X_{tm}=1,\\ 0 & \textrm{otherwise}. \end{cases}$$

For instance, the variable $Y_{t}^{60}=1$ if it rained during the entirety of the the $t$th minute. We can do the same thing for days, with $m=86400$, weeks ($m=7\times86400$), and so on.

Each variable $Y_{t}^{m}$ has its own success probability $\pi^{m}$, with $P(X_{t}=1)=\pi$ being the most refined probability. Suppose you choose an $m$, such as $m=86400$ for daily data, and decide on a uniform prior for $\pi^{m}$. Then you can deduce the implied prior for $u=\pi^{m'}$, where $m'$ is another positive integer. The induced prior is $p(u)=(m/m')u^{m/m'-1},$ or a $Beta(m/m',1)$ prior, as can be seen from the following manipulation \begin{eqnarray*} P(U\leq u) & = & P(\pi^{m\cdot m'/m}\leq u),\\ & = & P(\pi^{m}\leq u^{m/m'}),\\ & = & u^{m/m'}, \end{eqnarray*} with the the derivative being the induced prior $p(u)=(m/m')u^{m/m'-1}=(m/m')u^{m/m'-1}.$ Then it is well known that the posterior $p(u\mid\{Y_{t}^{m}\})$ is beta distributed with parameters

\begin{eqnarray*} \alpha & = & S_{n}+m/m',\\ \beta & = & n-S_{n}+1, \end{eqnarray*} where $S_{n}$ are the number of success in your data and $n$ is the number of trials on the $m'$ scale.

Since the expectation of the a $Beta(\alpha,\beta)$ variable is $\alpha/(\alpha+\beta)$, it follows that

$E[Y_{n+1}=1]=\frac{\alpha}{\alpha+\beta}=\frac{S_{n}+m/m'}{n+1+m/m'},$ where $m$ is the original time scaling and $m'$ is the new time scaling.

## Rain example

Suppose our discrete time unit is seconds, and suppose it has rained every second for the last week. Assume a uniform prior on the probability for raining for a whole day. Then \begin{eqnarray*} & & P(\text{rains next day}\mid\text{rained every day last week})\\ & = & \frac{7+1}{7+1+1}=\frac{8}{9}=0.888\ldots. \end{eqnarray*} Calculating on the hour scale instead, we find that $m/m'=24$, that $S_{n}=24\cdot7$ and $n=24\cdot7$ \begin{eqnarray*} & & P(\text{rains next day}\mid\text{rained every day last week}),\\ & = & \int u^{24}f(u\mid S_{n}+24,n-S_{n}+1)du,\\ & = & \prod_{r=0}^{k-1}\frac{S_{n}+m/m'+r}{n+1+m/m'+r},\\ & = & \prod_{r=0}^{k-1}\frac{24\cdot8+r}{24\cdot8+1+r}. \end{eqnarray*} By taking logarithms, one can show that $\prod_{r=0}^{n-1}\frac{nm+r}{nm+1+r}=\frac{m}{m+1},$ for all $n,m$, hence $\prod_{r=0}^{k-1}\frac{24\cdot8+r}{24\cdot8+1+r}=\frac{8}{8+1}=0.888...,$ and the probabilities match.

We can do the same exercise with minutes instead, where $m/m'=60^{2}\cdot24$, and $S_{n}=n$ are equal to $60^{2}\cdot24\cdot7$, \begin{eqnarray*} & & P(\text{rains next day}\mid\text{rained every day last week})\\ & = & \prod_{r=0}^{k-1}\frac{60^{2}\cdot24\cdot8+r}{60^{2}\cdot24\cdot8+1+r},\\ & \approx & 0.888.... \end{eqnarray*}